You are on page 1of 5

Kishinchand Chellaram College, Mumbai 20

FY / SY / TY B.Sc.(I.T.) Semester __________

Practical 1: 1. Create a db with name_rollno. CREATE DATABASE Nayaab_02 2. Create a table employee with columns, E_no , E_name , salary , date of joining, dept no , & job. create table employee( e_name varchar, e_no varchar(3), salary numeric(10), doj datetime, dept_no varchar(5), job varchar(10) ) 3. Insert atleast 5 records into the employee table. insert into employee values('P' ,'E3', 80000, '4-march-2004', 'd1', 'accountant') insert into employee values('K' ,'E4', 50000, '4-Apr-2003', 'd2', 'recep') insert into employee values('TP' ,'E5', 12000, '4-may-2002', 'd3', 'designer') insert into employee values('T' ,'E6', 10000, '12-june-2009', 'd10', 'T9') insert into employee values('T' ,'E8', 60000, '1-feb-1998', 'd20', 'programmer') delete from employee where e_no='E1'

4. Display all records 4rm employee table. select* from employee 5. Get the name of all employees whose salary is greater than 20000. select e_name from employee where salary>15000

Kishinchand Chellaram College, Mumbai 20


FY / SY / TY B.Sc.(I.T.) Semester __________

6. Get the name of all employees whose doj is 12th June 2009. select e_name from employee where doj='12-june-2009' 7. Get all employees who work 4 dept no d1 , d2 and d3. select * from employee where dept_no in('d1','d2','d3') 8. Get the detail of employees whose name starts with 'T'. select e_name from employee where e_name like 't' 9. Set the details of employees whose salary is in the range of 20000 - 30000. select salary from employee where salary between 20000 and 30000 10. Select all employees who joined b4 1st April 1998 or who are assigned dept no D10. select salary from employee where doj<'1-apr-1998' or dept_no='10' 11. Display the E_name, E_ no, dept no of all employees who joined on 2nd march 2001 n salary is > 50000. select e_name,e_no,dept_no from employee where doj='4-march-2004' and salary>'50000'

12. Select all records 4rm employee table without any duplication.

Kishinchand Chellaram College, Mumbai 20


FY / SY / TY B.Sc.(I.T.) Semester __________

select DISTINCT * from employee

13. Get the annual salary for all employees. select e_name, e_no, salary*12 as AnnualSalary from employee 14. Find all employees who do not belong 2 dept no d10 & d20. select * from employee where dept_no NOT IN('d10','d20') 15. Find the absolute value of -5 and 15. select abs(-5) select abs(15) 16. Find the rounded up and rounded down for the given values- 5.25 , 7.95 , -6.5. select ceiling(5.25) select ceiling(7.95) select ceiling(-6.5) select floor(5.25) select floor(7.95) select floor(-6.5) 17. Find the square of 60 , square root 25 and power of 60 raise to 4. select square(60) select sqrt(25) select power(60,4)

18. Get the number of records from the employee table. select count(*) from employee

Kishinchand Chellaram College, Mumbai 20


FY / SY / TY B.Sc.(I.T.) Semester __________

19. Get the number of employees who work for the dept_no d1. select count(e_no)

from employee where dept_no='d1' 20. Get the number of employees who work for the dept_no d10 n salary below 20000. select count(e_no) from employee where dept_no='10' and salary<'20000' 21. Get the number of dept after eliminating duplicates. select count (distinct dept_no) from employee 22. Get the total salary for employees in dept_no d20 and the job title is programmer. select sum(salary) from employee where dept_no='d20' and job ='programmer' 23. Display the e_name of employees in ascending order. select e_name from employee order by e_name 24. Display the name of employees in upper case letter. select upper(e_name) from employee

25. Get the dept_no , avg , min , max salary for all employees according to the dept. select dept_no,avg(salary) as avgsal,min(salary) as minsal,max(salary) as maxsal from employee

Kishinchand Chellaram College, Mumbai 20


FY / SY / TY B.Sc.(I.T.) Semester __________

group by dept_no

You might also like