This database has toy brands, toys, shopping carts and nothing else. toys.brand_id references brands, with the default rule.
-
The brand Daemon Cats (brand 3) closed. Remove brand 3. Which table does the DETAIL line name?
-
The shop keeps the toys of a closed brand, without a brand. Remove
toysand create it again with the same columns, so that removing a brand setsbrand_idto NULL in its toys. Then run this to put the toys back:sqlINSERT INTO toys (id, name, brand_id) VALUES (1, 'Kraken Plush', 1), (2, 'Mini Kraken', 1), (3, 'Pod Golem', 2), (4, 'Daemon Cat', 3), (5, 'Holo Cat', 3); -
Remove brand 3.
-
The items of a cart have no meaning without the cart. Create
cart_itemswithcart_id(whole number, required),product(text, required) andquantity(whole number, required), where removing a cart removes its items. Then fill it:sqlINSERT INTO cart_items (cart_id, product, quantity) VALUES (1, 'Kraken Plush', 1), (1, 'Holo Cat', 2), (2, 'Pod Golem', 1), (3, 'Mini Kraken', 3), (3, 'Daemon Cat', 1); -
Before you run it: how many rows will
cart_itemshold after you remove cart 1? -
Remove cart 1.