7
sql
-- View all orders
SELECT * FROM orders;
-- Try to insert a new order with an ID that already exists (will fail)
INSERT INTO orders (order_id, client_id, amount, order_date)
VALUES (101, 3, 150.00, '2025-07-05');
-- View all order items
SELECT * FROM order_items;
-- Try to insert a product that's already in the same order (will fail)
INSERT INTO order_items (order_id, product_id, quantity)
VALUES (101, 501, 1);
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.