Personal items

Report a typo

Copy the following template into the input field and realize correct IF statements instead of a commented #ToDo block.

Take to attention:

  • The "Tom Sawyer" book, glasses, and umbrella must be present in the table personal_items

  • Ice creams and some books must be present in the related purchases table book_basket, ice_basket

CREATE PROCEDURE items(
    item_name VARCHAR(30),
    description VARCHAR(30))
BEGIN
    #ToDo write correct IF...END IF;

#INSERT INTO personal_items(item, description) VALUES (item_name, description);
    
#INSERT INTO book_basket(item, description) VALUES (item_name, description);
    
#INSERT INTO ice_basket(item, description) VALUES (item_name, description);
    
END;

There are some calls below that should successfully work with this procedure. Take a look at their parameters to understand how to write correct IF statements and put the items into suitable baskets.

CALL items('book', 'Tom Sawyer');

CALL items('glasses', 'personal');

CALL items('umbrella', 'personal');

CALL items('ice cream', 'caramel');

CALL items('ice cream', 'banana');

CALL items('book', 'Sherlock Holmes');

CALL items('book', 'Don Quixote');

Note: not all books go into the books basket, only books that are not 'personal' goes into the book basket.

Write an SQL statement





___

Create a free account to access the full topic