0% found this document useful (0 votes)
14 views

23bce086_DBMS_prac2

The document outlines a practical assignment for a Database Management Systems course, focusing on SQL queries to retrieve data based on specific criteria. It includes various tasks such as listing clients from specific cities, finding salesmen with a particular salary, and retrieving product information based on price ranges. The document provides examples of SQL queries and expected outputs for each scenario.

Uploaded by

23bce089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

23bce086_DBMS_prac2

The document outlines a practical assignment for a Database Management Systems course, focusing on SQL queries to retrieve data based on specific criteria. It includes various tasks such as listing clients from specific cities, finding salesmen with a particular salary, and retrieving product information based on price ranges. The document provides examples of SQL queries and expected outputs for each scenario.

Uploaded by

23bce089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Name: Harsh Shah

Roll Number: 23BCE089


Course Code & Title: 2CS505CC23 Database Management Systems
Practical: 2

Aim: Retrieving Data with SQL Queries:


Write SQL queries to retrieve table records satisfying following scenarios:
• Retrieving specific column data
• Sort and retrieving data in a specific order
• Retrieve Unique values
• Dealing with NULL values
• Text Pattern Matching predicates

1. Do as directed:
a) List all the clients who are located in Mumbai or Chennai.
(Use logical operator)

b) Find the names of salesman who have a salary equal to


Rs. 3000.

c) List the salesman who are associated with orders given.


d) List the orders whose status is either cancelled or
fulfilled. (Use IN)

e) List products whose selling price is greater than 500 and


less than or equal to 750. (Use logical as well as
BETWEEN operator). Notice the difference.

f) List the names of all clients have ‘a’ as the second letter
in their names.
g) List the products whose selling price is more than 500
with the new selling price, calculated as original selling
price plus 15%.

SQL> SELECT description, sellprice, sellprice * 1.15


AS new_selling_price FROM product WHERE
sellprice > 500;

DESCRIPTION SELLPRICE
NEW_SELLING_PRICE
--------------- ---------- -----------------
1.44 Floppies 525 603.75
Monitors 12000 13800
Mouse 1050 1207.5
1.22 Floppies 525 603.75
Keyboards 3150 3622.5

h) List the name, city and state of clients who are not in the
state of “Maharashtra”.

i) List the products with highest to lowest selling price.


SQL> SELECT * FROM product ORDER BY sellprice
DESC;

PRODUC DESCRIPTION PROFITPERCENT


UNITMEASUR QTYONHAND REORDERLVL
SELLPRICE
------ --------------- ------------- ---------- ---------- ----------
----------
COSTPRICE
----------
P03453 Monitors 6 Piece 10
3 12000
11200

P07868 Keyboards 2 Piece 10


3 3150
3050

P06734 Mouse 5 Piece 20


5 1050
500

PRODUC DESCRIPTION PROFITPERCENT


UNITMEASUR QTYONHAND REORDERLVL
SELLPRICE
------ --------------- ------------- ---------- ---------- ----------
----------
COSTPRICE
----------
P07685 1.22 Floppies 5 Piece 100
20 525
500

P00001 1.44 Floppies 5 Piece 100


20 525
500

j) List the orders ordered in the year 2017.

You might also like