0% found this document useful (0 votes)
22 views7 pages

Practical6 Answer

Uploaded by

Jharanaa Savjani
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)
22 views7 pages

Practical6 Answer

Uploaded by

Jharanaa Savjani
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/ 7

Practical: 6

Aim : Implement SQL queries using Date


functions like add-months, months_between,
round, nextday, truncate, greatest, new-time
etc

1. Add column bdate in client_master table

Answer:

ALTER TABLE client_master ADD bdate varchar2(20);

2. Add column joining_date in salesman_master


table.

Answer:

ALTER TABLE salesman_master ADD joining_date


varchar2(20);
3. Add appropriate data in recently added column.
Answer:

client_master
UPDATE client_master SET BDATE = '01/01/1961'
WHERE CLIENTNO='C0001';

UPDATE client_master SET BDATE = '02/02/1962'


WHERE CLIENTNO='C0002';

UPDATE client_master SET BDATE = '03/03/1963'


WHERE CLIENTNO='C0003';

UPDATE client_master SET BDATE = '04/04/1964'


WHERE CLIENTNO='C0004';

UPDATE client_master SET BDATE = '05/05/1965'


WHERE CLIENTNO='C0005';

UPDATE client_master SET BDATE = '06/06/1966'


WHERE CLIENTNO='C0006';
salesman_master
UPDATE salesman_master SET joining_date =
'01/01/1961' WHERE SALESMANNO='S00001';

UPDATE salesman_master SET joining_date =


'02/02/1962' WHERE SALESMANNO='S00002';

UPDATE salesman_master SET joining_date =


'03/03/1963' WHERE SALESMANNO='S00003';

UPDATE salesman_master SET joining_date =


'04/04/1964' WHERE SALESMANNO='S00004';

4. List out the age of every customer.

Answer:

select CLIENTNO,NAME,BDATE,AGE from


client_master
5. List out joining date of sales man in 1st feb 1990
format.

Answer:

select
SALESMANNO,SALESMANNAME,JOINING_DATE
from salesman_master WHERE JOINING_DATE='01-
FEB-1990';

6. List out customers who born in February month.

Answer:

select name,BDATE from Client_master where


to_char(BDATE, 'mon')='feb';
7. List out customers who born in date between 10 to
20.

Answer:

select CLIENTNO,NAME,BDATE,AGE from


client_master where BDATE between '10jan1965' And
'20jan1969';

8. List out customers who born in year of 1965.

Answer:

select name,BDATE from Client_master where


to_char(BDATE, 'yy')='65';
9. Display the last day of current month.

Answer:

SELECT LAST_DAY( DATE '2020-08-01') "LAST DAY


OF AUGUST 2020" FROM dual;

10. Display the date of next Monday.

Answer:

SELECT NEXT_DAY( Date'2020-08-


17','MONDAY')"Next Monday" FROM dual;

11. Display name of older customer.


Answer:

select name "OLDER CUSTOMER",AGE "AGE" from


client_master where age >=30;

12. Display name of younger customer.

Answer:

select name "Younger CUSTOMER",AGE "AGE" from


client_master where age <=30;

You might also like