Assignment 4
Assignment 4
Based on last week database (School_Items), practice the following the questions in your assignment.
Relevant data tables in the School_Items database as follows.
Item table
bookShop table.
distribute table.
1. Find out the names of the databases created in your MySQL server.
show databases;
3. Find out the names of the tables you have created in your database.
show tables;
8. Sales details of the company are recorded in a table called sales. Create the structure for sales
table according to the details given below. (billNo should be define as the primary key)
13. Retrieve the item codes without repetition from distribute table.
15. List the item names and prices for most cheapest 3 items
17. Retrieve all records from Item table where price is greater than 1000.00.
18. Get the item names from the item table for known brands.
21. Select the details of items with a item code alphabetically between "IT10" and "IT19" from the
table item.
22. Select the details of items with a item code not between "IT10" and "IT19" from the table item.
24. Retrieve names and prices of items which are available at the book shops which are identified by
the codes of BS01 or BS02 according to the descending order of the price.
25. Retrieve name, price and bsCode of items which are available at the book shops identified by
BS01 or BS02 according to the descending order of the bookshop code.
28. How many steplers have been distributed to the Gunasena book shop?
30. Find the item name which has the largest unit price.
31. List the names of items sold within the month, May 2023.
32. One customer is going to by 5 steplers with 10% discount. How many rupees have to be paid by
the customer for this deal?
33. Get the total price of the stepler stock, distributed to the BS01 bookshop.
34. Get the total price of the stepler stock, distributed to the Sarasavi bookshop.