0% found this document useful (0 votes)
18 views5 pages

Practical 3

Uploaded by

vansh.mscit24
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)
18 views5 pages

Practical 3

Uploaded by

vansh.mscit24
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

Vansh Shah Msc.

IT SU245148

1. Perform the following computations


on table data:

A. List the names of all clients having ‘a’ as the


second letter in their names.
 select * from client_master where name like ‘_a%’;

B. List the clients who stay in a city whose first


letter is ‘M’.
 select * from client_master where city like ‘M%’;

C. List all clients who stay in 'Bangalore' or


'Mangalore.
 select * from client_master where city in (‘Bangalore’,
‘Mangalore’);

D.List all clients whose BalDue is greater than value


10000.
 select * from client_master where baldue>10000;

E. List all information from the Sales_Orders table


for orders placed in the month of June.
 select * from Sales_Orders where
rtrim(to_char(orderdate, “Month’)) = ‘June’;

F. List the order information for ClientNo ‘C00001’


and ‘C00002’.
 select * from Sales_Orders_Details where orderno in
(select orderno from Sales_Orders where ClientNo in
(‘C00001’, ‘C00002’ ));

1
Vansh Shah Msc.IT SU245148

G.List products whose selling price is greater than


500 and less than or equal to 750.
 select * from product_master where sellprice>500 and
sellprice<=750;

H.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.
 select productno, description, profitpercent,
unitmeasure, qtyonhand, reorderlvl, sellprice, (sellprice
* 0.15+sellprice) as new_price, costprice from
product_master where sellprice>500;

I. List the names, city and state of clients who are


not in the state of ‘Maharashtra’.
 select name, city, state from client_master where state
<> ‘Maharashtra’;

J. Count the total number of orders.


 select count(orderno) as “Total Orders” from
Sales_Orders;

K. Calculate the average price of all the products.


 select avg(sellprice) as “Average Sell Price” from
product_master ;

L. Determine the maximum and minimum product


price, Rename the output as max price and
min_price respectively.
 select max(sellprice) as “Max_Price” , min(sellprice) as
“Min_Price” from product_master;

2
Vansh Shah Msc.IT SU245148

M. Count the number of products having price less


than or equal to 500.
 select count(productno) as “No Of Products Price <=
500” from product_master where sellprice <=500;

N.List all the products whose QtyOnHand is less


than reorder level.

 Select * from product_master where qtyonhand <


reorderlvl;

2. Exercise on Date Manipulation:

A. List the Order number and day on which clients


placed their order.
 select orderno, to_char(orderdate, ‘Day’) as “Order Day”
from Sales_Orders;

B. List the month (in alphabets) and date when the


orders must be delivered.
 select to_char(delydate, ‘Month’) as “Delivery Month”,
to_char(delydate, ‘DD’) as “Delivery_date” from
Sales_Orders;

C. List the OrderDate in the formate ‘DD-Month-YY’.


 Select to_char(orderdate, ‘DD-Month-YY’) as Order_Date
from Sales_Orders;

D.List the date, 15 days after today’s date.


 Select sysdate+15 as “Date After 15 Days” from dual;

3
Vansh Shah Msc.IT SU245148

3. Write 10 Queries on Date


Manipulation:

1. Get the current system date.


 select sysdate from dual;

2. Add 6 months to the current date and return the


last day of that month.

 Select last_day(add_months(sysdate,6) as “last day six


months later from dual;

3. Find the difference in months between your


birthdate and today’s date.
 Select months_between(sysdate, to_date(‘29-02-2024’,
‘DD-MM-YYYY’)) as “month_difference” from dual;

4. Round the 29th February 2024 to the nearest


month.
 Select round(to_date(’20-FEB-2024’, ‘DD-MON-YYYY”),
‘MONTH’) as “Rounded Date” from dual;

5. Display the current date in readable words.


 Select to_char(sysdate, ‘DDSP / MMSP / YYYYSP’) as
“Spelled Date” from dual;

6. Display the full date in a specific format.


 Select to_char(sysdate, ‘FMDay, FMMonth DD, YYYY) as
“formatted date” from dual;

7. Find the date exactly 45 days from today.


 Select sysdate + as “Date Days Later” from dual;

4
Vansh Shah Msc.IT SU245148

8. Find the first day of the current month.


 Select trunc(sysdate, ‘MM’) as “First day of month’ from
dual;

9. Get the current day of the week.


 Select to_char(sysdate, ‘DAY’) as ‘Day Of Week’ from
dual;

10. Display the current date in ISO format (YYYY-


MM-DD).
 Select to_char(sysdate, ‘YYYY-MM-DD’) as “ISO Date”
from dual;

You might also like