Let us see how to insert the data into the table.
We need to use INSERT clause to insert the data. Here is the sample syntax.
If we don’t pass columns after table name then we need to specify values for all the columns. It is not good practice to insert records with out specifying column names.
If we do not specify value for SERIAL
 field, a sequence generated number will be used.
It is not mandatory to pass the values for those fields where DEFAULT
 is specified. Values specified in DEFAULT
 clause will be used.
It is mandatory to specify columns and corresponding values for all columns where NOT NULL
 is specified.
user_id | user_first_name | user_last_name | user_email_id | user_email_validated | user_password | user_role | is_active | create_ts | last_updated_ts |
---|---|---|---|---|---|---|---|---|---|
1 | Scott | Tiger | scott@tiger.com | False | None | U | False | 2020-11-14 15:35:11.813351 | 2020-11-14 15:35:11.813351 |
user_id | user_first_name | user_last_name | user_email_id | user_email_validated | user_password | user_role | is_active | create_ts | last_updated_ts |
---|---|---|---|---|---|---|---|---|---|
1 | Scott | Tiger | scott@tiger.com | False | None | U | False | 2020-11-14 15:35:11.813351 | 2020-11-14 15:35:11.813351 |
2 | Donald | Duck | donald@duck.com | False | None | U | False | 2020-11-14 15:35:14.495991 | 2020-11-14 15:35:14.495991 |
user_id | user_first_name | user_last_name | user_email_id | user_email_validated | user_password | user_role | is_active | create_ts | last_updated_ts |
---|---|---|---|---|---|---|---|---|---|
1 | Scott | Tiger | scott@tiger.com | False | None | U | False | 2020-11-14 15:35:11.813351 | 2020-11-14 15:35:11.813351 |
2 | Donald | Duck | donald@duck.com | False | None | U | False | 2020-11-14 15:35:14.495991 | 2020-11-14 15:35:14.495991 |
3 | Mickey | Mouse | mickey@mouse.com | False | None | U | True | 2020-11-14 15:35:15.881686 | 2020-11-14 15:35:15.881686 |
%%sql
INSERT INTO users
(user_first_name, user_last_name, user_email_id, user_password, user_role, is_active)
VALUES
('Gordan', 'Bradock', 'gbradock0@barnesandnoble.com', 'h9LAz7p7ub', 'U', true),
('Tobe', 'Lyness', 'tlyness1@paginegialle.it', 'oEofndp', 'U', true),
('Addie', 'Mesias', 'amesias2@twitpic.com', 'ih7Y69u56', 'U', true)
user_id | user_first_name | user_last_name | user_email_id | user_email_validated | user_password | user_role | is_active | create_ts | last_updated_ts |
---|---|---|---|---|---|---|---|---|---|
1 | Scott | Tiger | scott@tiger.com | False | None | U | False | 2020-11-14 15:35:11.813351 | 2020-11-14 15:35:11.813351 |
2 | Donald | Duck | donald@duck.com | False | None | U | False | 2020-11-14 15:35:14.495991 | 2020-11-14 15:35:14.495991 |
3 | Mickey | Mouse | mickey@mouse.com | False | None | U | True | 2020-11-14 15:35:15.881686 | 2020-11-14 15:35:15.881686 |
4 | Gordan | Bradock | gbradock0@barnesandnoble.com | False | h9LAz7p7ub | U | True | 2020-11-14 15:35:20.938583 | 2020-11-14 15:35:20.938583 |
5 | Tobe | Lyness | tlyness1@paginegialle.it | False | oEofndp | U | True | 2020-11-14 15:35:20.938583 | 2020-11-14 15:35:20.938583 |
6 | Addie | Mesias | amesias2@twitpic.com | False | ih7Y69u56 | U | True | 2020-11-14 15:35:20.938583 | 2020-11-14 15:35:20.938583 |