Question: MySQL - Please provide screenshot /******************************************************** * This script creates the database named my_guitar_shop *********************************************************/ DROP DATABASE IF EXISTS cs431_music_store; CREATE DATABASE cs431_music_store; USE cs431_music_store;
MySQL - Please provide screenshot

/******************************************************** * This script creates the database named my_guitar_shop *********************************************************/
DROP DATABASE IF EXISTS cs431_music_store; CREATE DATABASE cs431_music_store; USE cs431_music_store;
-- create the tables for the database CREATE TABLE categories ( category_id INT PRIMARY KEY AUTO_INCREMENT, category_name VARCHAR(255) NOT NULL UNIQUE );
CREATE TABLE order_instruments ( item_id INT PRIMARY KEY AUTO_INCREMENT, order_id INT NOT NULL, instrument_id INT NOT NULL, item_price DECIMAL(10,2) NOT NULL, discount_amount DECIMAL(10,2) NOT NULL, quantity INT NOT NULL, CONSTRAINT order_instruments_fk_orders FOREIGN KEY (order_id) REFERENCES orders (order_id), CONSTRAINT order_instruments_fk_instruments FOREIGN KEY (instrument_id) REFERENCES instruments (instrument_id)
INSERT INTO order_instruments (item_id, order_id, instrument_id, item_price, discount_amount, quantity) VALUES (1, 1, 2, '1199.00', '359.70', 1), (2, 2, 4, '489.99', '186.20', 1), (3, 3, 3, '2517.00', '1308.84', 1), (4, 3, 6, '415.00', '161.85', 1), (5, 4, 2, '1199.00', '359.70', 2), (6, 5, 5, '299.00', '0.00', 1), (7, 6, 5, '299.00', '0.00', 1), (8, 7, 1, '699.00', '209.70', 1), (9, 7, 7, '799.99', '240.00', 1), (10, 7, 9, '699.99', '210.00', 1), (11, 8, 10, '799.99', '120.00', 1), (12, 9, 1, '699.00', '209.70', 1);
2. Write a SELECT statement that returns these column names and data from the order instruments table: item id The item id column item_price The item_price column discount amount The discount_amount column quantity The quantity column price_total A column that's calculated by multiplying the item price by the quantity discount_total A column that's calculated by multiplying the discount amount by the quantity item_total A column that's calculated by subtracting the discount amount from the item price and then multiplying by the quantity Only return rows where the item_total is greater than 500. Sort the result set by the item_total column in descending sequence. Table 1 item_id item_price discount_amount Quantity price_total discount_total item_total 5 1199.00 359.70 2 2398.00 719.40 1678.60 3 2517.00 1308.84 1 2517.00 1308.84 1208.16 1 1199.00 359.70 1 1199.00 359.70 839.30 11 799.99 120.00 1 799.99 120.00 679.99 9 799.99 240.00 1 799.99 240.00 559.99
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
