Instruction
Perfect! It's time to sum up your knowledge of using CTEs with data-modifying statements. In this part, you have learned how to use a:
- CTE with an
INSERTstatement:WITH all_customers AS ( SELECT first_name, last_name, age FROM customer ) INSERT INTO customers SELECT * FROM all_customers; - CTE with a
UPDATEstatement:WITH products AS ( SELECT id FROM product WHERE id IN (1,4,6,7) ) UPDATE product SET price = price - 0.05 WHERE id IN (SELECT id FROM products); - CTE with
DELETEstatement:WITH customer_remove AS ( SELECT id FROM customer WHERE first_name = 'Ema' AND last_name = 'Green' ) DELETE FROM customer WHERE id = (SELECT id FROM customer_remove);
You also know how to use nested CTEs with INSERT, UPDATE, and DELETE statements.
Let's do a short review before we move on to the final quiz for this course. Are you ready?
Exercise
Click to continue.



