Docsity

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

Toggle sidebar
bg1
Important
•Section C(10 marks)- mostly from chapter 11,12 and very
important topic normalization from chapter 5
•Section B(5 marks)-mostly from chapter 1,2,3,4,14,
•No need to study chapter 6 and
•Section A(2 marks)- mostly small definitions given at the left
hand in our book
•Section D- The sql queries which i am sending. Important
are select and create queries.
• Data types from chapter 7.
•What id dml,dcl,ddl
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

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

Important

• Section C(10 marks)- mostly from chapter 11,12 and very

important topic normalization from chapter 5

• Section B(5 marks)-mostly from chapter 1,2,3,4,14,

• No need to study chapter 6 and

• Section A(2 marks)- mostly small definitions given at the left

hand in our book

• Section D- The sql queries which i am sending. Important

are select and create queries.

• Data types from chapter 7.

• What id dml,dcl,ddl

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.

SESSION-

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

SESSION-

TABLE-PRODUCT_MASTER

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

2. List the various products available from the product_master table.

3. Find the products whose selling_price is greater than 2000

and less than or equal to 5000.

4. Rename the new column in the above query as

new_selling_price.

Ans( SESSION-03)

1. SELECT * FROM product_master WHERE description=‘1.

drive’, description=‘1.22 drive’)

2. SELECT description from product_master;

3. SELECT * FROM product_master WHERE sell_price > 2000 and

sell_price <= 5000;

4. ALTER TABLE product_name RENAME COLOUMN sell_price to

new_sell_price

Ans( SESSION-04)

1. SELECT * FROM product_master order by descprition;

2. SELECT * FROM product_master WHERE cost price < 1500;

3. SELECT FROM product_no,description,sell_price from

product_master WHERE description like ‘M%’;

SESSION-

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,

SESSION-

  • (^) 1. List two DDL and two DML command syntax.
  • (^) 2. Table:- MENU

Write SQL commands for executing below actions on the above Menu table,

one by one, as mentioned below:-

a) Creating a suitable MENU table,

Dish_no number(3),

Description varchar2(10),

Price number(5,2).

b) Inserting the Coffee tuples with values

i) 50, coffee, 3.0., ii) 100, eggs, 8.0., iii) 200, vada, 20.0.,

iv) 250, sandwich, 20.0., and v) 300, ‘pizza’, 40.0.

c) Updating Coffee tuple price from 3.0 to 4.0.

e) Deleting the Pizza tuple.

f) Displaying all dishes having prices equal and above 20.0. Show the screen

display after execution.

Ans( SESSION-07)

1. DDl

  • (^) DROP TABLE tablename;
  • (^).

DML:

  • (^) UPDATE tablename SET

Column_name = value where

Column_name = value;

  • (^) INSERT INTO tablename

values(‘’,’’,’’)’