sql insert Flashcards
1
Q
How do you add a row to a SQL table?
A
insert into “table” (“column1”, “column2”, “column3”)
values (‘string’, ‘other string’, 99);
2
Q
What is a tuple?
A
list of values in SQL, ex: values for an insert statement
3
Q
How do you add multiple rows to a SQL table at once?
A
insert into “table” (“column1”, “column2”, “column3”)
values (‘string’, ‘other string’, 99),
(‘string’, ‘other string’, 55);
4
Q
How do you get back the row being inserted into a table without a separate select statement?
A
insert into “table” (“column1”, “column2”, “column3”)
values (‘string’, ‘other string’, 99)
returning *; // or (list of columns)