sql-insert Flashcards

1
Q

How do you add a row to a SQL table?

A

Insert into ‘’ (“column1, “column2”, “column3”) values (‘value1’, ‘value2’, value3);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a tuple?

A

A list of values. Always a fixed size. It has a defined data type. It corresponds with a specific column. Each position can have a specific data type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you add multiple rows to a SQL table at once?

A

Data rows can be batch inserted into a database table by specifying more than one tuple of values, separated by commas. Below we are inserting tow new rows into the “products” table.

insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’),
(‘Tater Mitts’, ‘Scrub some taters!’, 6, ‘cooking’)
returning *;

You can also insert one row at a time….
INSERT INTO “tableName”
SET “columnA” = ‘hi’,
“columnB” = ‘there’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly