DML
DML
NAME:
ROLL NO:
-----------------------------------------------------------------------------------
----------------
PROBLEM STATEMENTS:Consider database created in assignment 1 to design SQL queries
using SQL DML
satatements : Insert, Select, Update, Delete with operators, function and set
operator.
********************************************************************************
A) Exercise on retrieving records from a table.
********************************************************************************
********************************************************************************
B) Exercise on updating records in a table.
********************************************************************************
1) Delete all salesman from the salesman_master where salary are equal to Rs. 3500.
3) Delete from Client_Master where the cloumn satet holds the value 'Tamil Nadu'.
********************************************************************************
D) Perform the following computations on the table data.
********************************************************************************
1) List the name of all client having 'a' as the second letter in their names.
2) List the client who stay in in the city whose first letter is 'M'.
+---------------+----------+
| NAME | CITY |
+---------------+----------+
| HANSEL COLACO | BANGLORE |
+---------------+----------+
1 row in set (0.00 sec)
___________________________________________________________________________________
________
4) List all the clients whose Bal_due is greater than value 10000.
5) List all information from the Sales_Order table for Orders placed in month of
june.
7) List the products whose selling price is greater than 500 and less than or equal
to 750.
+------------+--------------+-----------------+--------------+-------------
+-------------+------------+------------+
| PRODUCT_NO | DESCRIPTION | PROFIT_PERSCENT | UNIT_MEASURE | QTY_ON_HAND |
REORDER_LVL | SELL_PRICE | COST_PRICE |
+------------+--------------+-----------------+--------------+-------------
+-------------+------------+------------+
| P06734 | COTTON JEANS | 5.00 | PIECE | 100 |
20 | 600.00 | 450.00 |
| P07865 | JEANS | 5.00 | PIECE | 100 |
20 | 750.00 | 500.00 |
| P07885 | PULL OVERS | 2.50 | PIECE | 80 |
30 | 700.00 | 450.00 |
+------------+--------------+-----------------+--------------+-------------
+-------------+------------+------------+
3 rows in set (0.00 sec)
___________________________________________________________________________________
________
8) List products whose selling price is more than 500 and less than or equal to
750.
mysql> SELECT * FROM PRODUCT_MASTER WHERE SELL_PRICE>500 AND SELL_PRICE<=750;
+------------+--------------+-----------------+--------------+-------------
+-------------+------------+------------+
| PRODUCT_NO | DESCRIPTION | PROFIT_PERSCENT | UNIT_MEASURE | QTY_ON_HAND |
REORDER_LVL | SELL_PRICE | COST_PRICE |
+------------+--------------+-----------------+--------------+-------------
+-------------+------------+------------+
| P06734 | COTTON JEANS | 5.00 | PIECE | 100 |
20 | 600.00 | 450.00 |
| P07865 | JEANS | 5.00 | PIECE | 100 |
20 | 750.00 | 500.00 |
| P07885 | PULL OVERS | 2.50 | PIECE | 80 |
30 | 700.00 | 450.00 |
+------------+--------------+-----------------+--------------+-------------
+-------------+------------+------------+
3 rows in set (0.00 sec)
___________________________________________________________________________________
________
9) List products whose selling price is more than 500., Calculate a new selling
price as,
original selling price *.15. Rename the new column in the output of the above query
as new_price.
10) List the Names, City, and State of clients who are not in the state of
'Maharashtra'.
13) Determine the maximum and minimum product prices. Rename the output as
max_price
and min_price respectively.
14) Count the number of products having price less than or equal to 500.
15) List all the products whose QtyonHand is less than reorder level.
+----------+---------------------+
| ORDER_NO | DAYNAME(ORDER_DATE) |
+----------+---------------------+
| O19001 | Saturday |
| O19002 | Friday |
| O19003 | Saturday |
| O19008 | Monday |
| O46865 | Wednesday |
| O46866 | Thursday |
+----------+---------------------+
6 rows in set (0.02 sec)
___________________________________________________________________________________
________
2) List the month(in alphabhets) and date when the orders must be delivered.
********************************************************************************