In today’s article, we will be talking about Using PostgreSQL SELECT and INSERT together.
First, let’s query the data in the table with the SELECT statement;
1 | SELECT*FROM personel; |
In the table above, we see that there are three records. Let’s add a record with the name “Nezih” and the surname “er” and working in the Software department, but let’s do it with select.
1 2 | INSERT INTO personel(adi,soyadi,bölümü) SELECT 'Nezih','ER','Yazilim'; |
The plpgsql above (we can think of it as a Postgresql language) also shows that a record has been added to the table.
Let’s check this with the SELECT statement.
As you can see in the picture above, our Nezih record has been successfully added.