Instruction
Perfect! It's time to sum up your knowledge about the CTEs with data modifying statements. In this part, you have learned how to use:
- CTE with
INSERTstatement:WITH all_customers AS ( SELECT first_name, last_name, age FROM customer ) INSERT INTO customer SELECT * FROM all_customers; - CTE with
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 are familiar also with using the nested CTEs with INSERT, UPDATE, DELETE statements.
Let's go to summary exercises. Are you ready?
Exercise
Click to continue.



