[go: up one dir, main page]

0% found this document useful (0 votes)
122 views4 pages

SEP

1. The questions query the EMP and DEPT tables in the database to return various employee and department details based on different criteria specified in the WHERE clauses. Some examples include returning salaries greater than 1500, employee details for those with the job of 'MANAGER', and department details located in 'NEW YORK'. 2. SQL queries are used to return requested fields like salary, name, department number etc and perform calculations on fields like annual salary based on the salary field. 3. Filters are applied in the WHERE clause to restrict the results to relevant records like employees hired after 1995, department number equal to 20, and so on.

Uploaded by

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

SEP

1. The questions query the EMP and DEPT tables in the database to return various employee and department details based on different criteria specified in the WHERE clauses. Some examples include returning salaries greater than 1500, employee details for those with the job of 'MANAGER', and department details located in 'NEW YORK'. 2. SQL queries are used to return requested fields like salary, name, department number etc and perform calculations on fields like annual salary based on the salary field. 3. Filters are applied in the WHERE clause to restrict the results to relevant records like employees hired after 1995, department number equal to 20, and so on.

Uploaded by

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

Q 1) WAQTD all the salary of employee if the salary is greater than 1500.

SQL> select sal


2 from emp
3 where sal >1500;

SAL
----------
1600
2975
2850
2450
3000
5000
3000

7 rows selected.

===================================================================================
========================================================
Q 2)WAQTD all the details of the employee if designation is Manager.
SQL> select *
2 from emp
3 where JOB = 'MANAGER';

EMPNO ENAME JOB MGR HIREDATE SAL


COMM DEPTNO
---------- ---------- --------- ---------- --------- ----------
---------- ----------
7566 JONES MANAGER 7839 02-APR-81 2975
20
7698 BLAKE MANAGER 7839 01-MAY-81 2850
30
7782 CLARK MANAGER 7839 09-JUN-81 2450
10

===================================================================================
========================================================
Q 3) WAQTD Employee name, Department no., Date of joining if the date of joining is
“01-JAN-1995”.

SQL> SELECT ENAME EMPLOYEE_NAME, DEPTNO DEPARTMENT_NO, HIREDATE


DATE_OF_JOINING
2 FROM EMP
3 WHERE HIREDATE > '01-JAN-1995';

no rows selected

===================================================================================
========================================================

Q 4) WAQTD all the details of employee only if they were hired after the year 1995.
SQL> SELECT *
2 FROM EMP
3 WHERE HIREDATE > '31-DEC-1995';

no rows selected
===================================================================================
========================================================
Q 5) WAQTD department name, department number for all the department which is
located in NEW YORK.

SQL> SELECT DNAME, DEPTNO


2 FROM DEPT
3 WHERE LOC = 'NEW YORK';

DNAME DEPTNO
-------------- ----------
ACCOUNTING 10

===================================================================================
========================================================
Q 6) WAQTD Department number along with location whose Department is Research.
SQL> SELECT DEPTNO DEPT_NO, LOC LOCATION
2 FROM DEPT
3 WHERE DNAME = 'RESEARCH';

DEPT_NO LOCATION
---------- -------------
20 DALLAS
===================================================================================
========================================================

Q 7) WAQTD Salary ,Annual salary , Quarter salary of all the employees if salary is
greater than commission.

SQL> SELECT SAL SALARY, SAL*12 ANNUAL_SALARY, SAL*3 QUARTERLY_SALARY


2 FROM EMP
3 WHERE SAL > COMM;

SALARY ANNUAL_SALARY QUARTERLY_SALARY


---------- ------------- ----------------
1600 19200 4800
1250 15000 3750
1500 18000 4500

===================================================================================
========================================================

Q 8) WAQTD Employee name , Monthly salary , Job of all the employees who’s monthly
salary is greater than 2000.

SQL> SELECT ENAME EMP_NAME, SAL MONTHLY_SAL, JOB JOB_OF_EMPLOYEE


2 FROM EMP
3 WHERE SAL>2000;

EMP_NAME MONTHLY_SAL JOB_OF_EM


---------- ----------- ---------
JONES 2975 MANAGER
BLAKE 2850 MANAGER
CLARK 2450 MANAGER
SCOTT 3000 ANALYST
KING 5000 PRESIDENT
FORD 3000 ANALYST
===================================================================================
========================================================
Q 9) WAQTD all the details of employees if the department number is 20.

SQL> SELECT *
2 FROM EMP
3 WHERE DEPTNO=20;

EMPNO ENAME JOB MGR HIREDATE SAL COMM


DEPTNO
---------- ---------- --------- ---------- --------- ---------- ----------
----------
7369 SMITH CLERK 7902 17-DEC-80 800
20
7566 JONES MANAGER 7839 02-APR-81 2975
20
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7876 ADAMS CLERK 7788 23-MAY-87 1100
20
7902 FORD ANALYST 7566 03-DEC-81 3000
20

===================================================================================
========================================================
Q 10) WAQTD Salary , Annual salary, 10% Hike in Quarter salary if and only if
designation is Clerk.

SQL> select sal, sal*12, sal*3*1.1


2 from EMP
3 WHERE JOB = 'CLERK';

SAL SAL*12 SAL*3*1.1


---------- ---------- ----------
800 9600 2640
1100 13200 3630
950 11400 3135
1300 15600 4290

===================================================================================
========================================================
Q 11) WAQTD details of the employee who’s name is Ford.

SQL> SELECT *
2 FROM EMP
3 WHERE ENAME = 'FORD';

EMPNO ENAME JOB MGR HIREDATE SAL COMM


DEPTNO
---------- ---------- --------- ---------- --------- ---------- ----------
----------
7902 FORD ANALYST 7566 03-DEC-81 3000
20

===================================================================================
========================================================

Q 12) WAQTD Annual salary , 1000 rs bonus in annual salary along with monthly
salary if department number is 30.
SQL> SELECT SAL*12, (SAL*12)+1000, SAL
2 FROM EMP
3 WHERE DEPTNO = '30';

SAL*12 (SAL*12)+1000 SAL


---------- ------------- ----------
19200 20200 1600
15000 16000 1250
15000 16000 1250
34200 35200 2850
18000 19000 1500
11400 12400 950

===================================================================================
========================================================
Q 13) WAQTD all the details of department if location is BOSTON.

SQL> SELECT *
2 FROM DEPT
3 WHERE LOC = 'BOSTON';

DEPTNO DNAME LOC


---------- -------------- -------------
40 OPERATIONS BOSTON

===================================================================================
========================================================

Q 14) WAQTD Salary , Quarter salary , 5% decrement in monthly salary if the job is
Manager.

SQL> SELECT SAL, SAL*3, SAL*0.95


2 FROM EMP
3 WHERE JOB = 'MANAGER';

SAL SAL*3 SAL*0.95


---------- ---------- ----------
2975 8925 2826.25
2850 8550 2707.5
2450 7350 2327.5
===================================================================================
========================================================

You might also like