Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

MYSQL PROGRAMS

1. Write MySQL Commands to implement the following Queries

TABLE: LAB

No ItemName CostPerItem Quantity Warranty Operational

1 Computer 60000 9 2 7

2 Printer 15000 3 4 2

3 Scanner 18000 1 3 1

4 Camera 21000 2 1 1

a. Create above table LAB.


b. Insert the values into table LAB
c. Update Quantity to 10 for the ItemName, Printer.
d. Arrange the tables based on ItemName in Descending Order.
e. To display the ItemName, whose CostPerItem is more than 20000.
f. To display the ItemNames which are having two years Warranty.

2. Write MySQL Commands to implement the following Queries

TABLE: SPORTS

GCode GameName No_Players PrizeMoney

101 Carom Board 2 5000

102 Table Tennis 2 12000

103 Lawn Tennis 4 8000

105 Chess 2 9000

108 Table Tennis 4 25000


a. Create the above table SPORTS.
b. Insert the values into table SPORTS.
c. Display the count of players enrolled for each game.
d. Alter the table to add the column DATE date and update the details for all the
rows.
e. Display the total count, sum of PrizeMoney of players for TableTennis game.
f. Display the records in descending order based on PrizeMoney.

3. Write MySQL Commands to implement the following Queries

TABLE: BOOKS

Book_Id Book_Name Publishers Price

F0001 The Tears First Publ. 750

F0002 Thunderbolt First Publ. 700

F0003 My First C++ EPB 250

F0004 C++ Brain TDH 325

F0005 Fast Cook EPB 350

a. Create the above table BOOKS.


b. Insert the values into table BOOKS.
c. Display Maximum and Minimum price from BOOKS table, Publisher wise.
d. Alter the table BOOKS to add the column QUANTITY int(5) and Update the values
for all the rows.
e. Display the books in the table arranged in ascending order by Book_NameTo Delete
the record whose Book_Id is F0001.

4. Write MySQL Commands to implement the following queries:

a. Create the tables WATCH and SALE, relate them using Foreign Key.
b. Insert the records into tables.
c. To display all the details of those watches whose name ends with ‘Time’
d. To display watch’s name and price of those watches with price range in between
5000- 15000.
e. To display total quantity in store of Unisex type watches.
f. To display watch name and their quantity sold in first quarter.

You might also like