DML Flashcards

1
Q

INSERT

VALUES

A
INSERT dataset.Inventory (product, quantity)
VALUES('top load washer', 10),
      ('front load washer', 20),
      ('dryer', 30),
      ('refrigerator', 10),
      ('microwave', 20),
      ('dishwasher', 30),
      ('oven', 5)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

INSERT SELECT

A
INSERT dataset.Warehouse (warehouse, state)
SELECT *
FROM UNNEST([('warehouse #1', 'WA'),
      ('warehouse #2', 'CA'),
      ('warehouse #3', 'WA')])
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

열 이름이 없는 INSERT

A

INSERT dataset.Warehouse

VALUES(‘warehouse #4’, ‘WA’), (‘warehouse #5’, ‘NY’)

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

DELETE 문

A

DELETE dataset.Inventory

WHERE quantity = 0

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

서브 쿼리가 포함된 DELETE

A

DELETE dataset.Inventory i
WHERE i.product NOT IN (
SELECT product from dataset.NewArrivals)

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

TRUNCATE TABLE

A

TRUNCATE TABLE dataset.Inventory

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

UPDATE

A

UPDATE dataset.Inventory
SET quantity = quantity - 10
WHERE product like ‘%washer%’

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