Created
February 24, 2019 09:26
-
-
Save kovid-rathee/a616d327da265c43f37f1daec49a0160 to your computer and use it in GitHub Desktop.
Create a table & insert records using Arrays in PostgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table sal_emp ( | |
name text, | |
pay_by_quarter integer[], | |
schedule text[][] | |
); | |
insert into sal_emp | |
values ('Bill', | |
'{10000, 10000, 10000, 10000}', | |
'{{"meeting", "lunch"}, {"training", "presentation"}}'); | |
insert into sal_emp | |
values ('Carol', | |
'{20000, 25000, 25000, 25000}', | |
'{{"breakfast", "consulting"}, {"meeting", "lunch"}}'); | |
insert into sal_emp | |
values ('Sean', | |
ARRAY[2000, 15000, 20000, 10000], | |
ARRAY[['meeting', 'lunch'], ['training', 'presentation']]); | |
insert into sal_emp | |
values ('Penn', | |
ARRAY[20000, 25000, 10000, 25000], | |
ARRAY[['breakfast', 'consulting'], ['meeting', 'lunch']]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment