Docsity

DBMS- SQL, Study notes of Database Management Systems (DBMS)

Toggle sidebar
bg1
Client_no Name City Pincode State Bal_Due
C00001 Ivan Bayross Bombay 400054 Maharashtra 15000
C00002 Vandana saitwal Madras 600001 Tamil Nadu 0
C00003 Pramada Jaguse Bombay 400057 Maharashtra 5000
C00004 Basu Navindgi Bombay 400056 Maharashtra 0
C00005 Avi Sreedharan Delhi 100001 New elhi 2000
Client_master
Problems:- 1.clients.
2. Print the entire client_master table.
3. Retrieve the list of names and the cities of all the clients.
4. Find the names of all the clients having ‘a’ as the second letter in their name.
5. Find out the clients who stay in city ‘Bombay’ or city ‘Delhi’ or city ‘Madras’.
6. List all the clients who are located in Bombay.
7. Print the list of clients whose balance due are greater than 10000.
8. List the names,city and state of clients not in the state of Maharashtra.
SESSION-02
pf3
pf4
pf5

Partial preview of the text

Download DBMS- SQL and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

Client_no Name City Pincode State Bal_Due

C00001 Ivan Bayross Bombay 400054 Maharashtra 15000

C00002 Vandana saitwal Madras 600001 Tamil Nadu 0

C00003 Pramada Jaguse Bombay 400057 Maharashtra 5000

C00004 Basu Navindgi Bombay 400056 Maharashtra 0

C00005 Avi Sreedharan Delhi 100001 New elhi 2000

Client_maste r

Problems:- 1.clients.

2. Print the entire client_master table.

3. Retrieve the list of names and the cities of all the clients.

4. Find the names of all the clients having ‘a’ as the second letter in their name

5. Find out the clients who stay in city ‘Bombay’ or city ‘Delhi’ or city ‘Madras’.

6. List all the clients who are located in Bombay.

7. Print the list of clients whose balance due are greater than 10000.

8. List the names,city and state of clients not in the state of Maharashtra.

Product_n o Description Profit_perc ent UOM Qty_on_h and Reorder_ lvl Sell_pri ce Cost_ Price P00001 1.44 Floppies 5 Piece 100 20 525 500 P03453 Monitors 6 Piece 10 3 12000 11280 P06734 Mouse 5 Piece 20 5 1050 1000 P07865 1.22 Floppies 5 Piece 100 20 525 500 P07868 Keyboard 2 Piece 10 3 3150 3050 P07885 CD Drive 2.5 Piece 10 3 5250 5100 P07965 540 HDD 4 Piece 10 3 8400 8000 P07975 1.44 Drive 5 Piece 10 3 1050 1000 P08865 1.22 Drive 5 Piece 2 3 1050 1000

TABLE-PRODUCT_MASTER

Problems:- 1. Find the products with descriptions ‘1.44 Drive’ and ‘1.22 Drive’.

  1. List the various products available from the product_master table.
  2. Find the products whose selling_price is greater than 2000 and less than or equal to 5000.
  3. Find the products whose selling price is more than 1500 and also find the new selling price as New_selling_price) as original selling price*15.
  4. Rename the new column in the above query as new_selling_price.

TABLE:-SALESMAN_ORDER_DETAIL

Column Name Data Type Size Attribute Constraints S_order_no Varchar2 6 Primary Key/Foreign Key references s_order_no Of Sales_Order table product_no Varchar2 6 Primary Key/Foreign Key references product_no Of Product_Master table Qty_ordered Number 8 Qty_desp Number 8 Product_rate Number 10,

Write the SQL commands for,

a) creating the above ‘Sales_Order_Details’ table.

b) inserting the values- O19001,P00001,4,4,

O19001,P07965,2,1,

O19002,P00001,10,0,

O19003,P06734,1,1,

c) Displaying occurrences with below requirements,

i) sales order number more than CH19000 and

ii) product rate more than 8000.

Column Name Data Type Size Attribute Constraints challan_no Varchar2 6 Primary Key/ First two letter to start with ‘CH’. S_ordert_no Varchar2 6 Foreign Key references s_order_no of sales_order table challan_date (^) Date Not null Billed_yn varchar2 1 ‘Y’ or ‘N’ Default is ‘N’ Challan_Header:- Write the SQL commands for, a) creating the above ‘Challan_Header’ table. b) inserting the values- CH9001,O19001,12-dec-95, Y CH6865,O46865,12-nov-95, Y CH3965,O10008,12-oct-95, N c) Displaying challan numbers more than CH6000 and billed one. Challan_Header