Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

ASSIGNMENT 1

DATA QUERY LANGUAGE

VVP
ENGINEERING
COLLEGE
CE DEPARTMENT

SUBMITTED BY: VADOLIYA ABHISHEK


G2
200470107034
Assignment 1

Assignment-I

1) List all employees of emp table


Ans: select * from emp

<ENROLLMENTNO TOPIC 1
>
Assignment 1

2) List employee no, name and salary


Ans: select EMPNO, ENAME, SAL from emp

3) list all salesman of company


Ans: select * from emp where JOB='SALESMAN'

4) list employees hired on 12th March 1981


Ans: select * from emp where hiredate='12/03/1981'

<ENROLLMENTNO TOPIC 2
>
Assignment 1

5) List all managers


Ans: select * from emp where job='MANAGER'

6) List all job title


Ans: select job from emp group by job

7) list employees who receive commission


Ans: select * from emp where comm>0

<ENROLLMENTNO TOPIC 3
>
Assignment 1

8) list all clerk works under the blake


Ans: select * from emp where MGR='7698'

9) list all employees work under president


Ans: select * from emp where mgr='7839'

10) list employee name and their job works in deptno 10


Ans: select * from emp where DEPTNO='10'

<ENROLLMENTNO TOPIC 4
>
Assignment 1

11) list all clerk working in dept no 10


Ans: select * from emp where DEPTNO='10' and job='CLERK'

12) list employees who hired after 26 Jun 1981


Ans: select * from emp where hiredate > '06/26/1981'

13) list employees whose salary greater than 1500 and receive
commission
Ans: select * from emp where SAL > 1500 and Comm > 0

<ENROLLMENTNO TOPIC 5
>
Assignment 1

14) list all employee who are clerk and getting salary above 1000
Ans: select * from emp where job = 'CLERK' and sal > 1000

15) list managers whose salary greater then 2700


Ans: select * from emp where job = 'MANAGER' and sal > 2700

16) list all employees whose commision is more than their salary
Ans: select * from emp where Sal<comm

17) retrieve employee list who works in deptno 10 and having salary
less 2200
Ans: select * from emp where deptno = '10' and sal<2200

<ENROLLMENTNO TOPIC 6
>
Assignment 1

18) How much salary paid to all employees?


Ans: select sum(sal) from emp

19) Total Salary paid to deptno 10


Ans: select sum(sal) from emp where deptno=10

20) Total Salary paid to managers


Ans: select sum(sal) from emp where job='MANAGER'

21) what is the min salary paid to employee


Ans: select min(sal) from emp

<ENROLLMENTNO TOPIC 7
>
Assignment 1

22) what is the max salary paid to employee


Ans: select max(sal) from emp

23) count employee per department


Ans: select deptno,count(empno) from emp group by deptno

24) total salary paid department wise


Ans: select deptno,sum(sal) from emp group by deptno

<ENROLLMENTNO TOPIC 8
>
Assignment 1

25) list all jobs departmentwise


Ans: select distinct JOB,DEPTNO from emp order by DEPTNO

26) create record as per below screen


Ans: INSERT INTO emp
(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) Values
(8911,’Ravi’,’Clerk’,8910,’03/29/1981’,1500,0,40);
(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) Values
(8912,’Subbu’,’Analyst’,8910,’02/12/1988’,3200,0,40);

<ENROLLMENTNO TOPIC 9
>
Assignment 1

<ENROLLMENTNO TOPIC 10
>

You might also like