0% found this document useful (0 votes)
57 views2 pages

Lab Assignment-2

This document contains the details of a lab assignment involving SQL queries on an EMP table with columns for employee number, name, job, salary, commission, and department number. It includes 16 questions involving queries to retrieve employee names and details based on various criteria like department number, job type, salary range, and more. The questions cover basic SQL commands like SELECT, WHERE, BETWEEN, ORDER BY, LIKE, and aggregate functions.

Uploaded by

agarwalvanshika
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)
57 views2 pages

Lab Assignment-2

This document contains the details of a lab assignment involving SQL queries on an EMP table with columns for employee number, name, job, salary, commission, and department number. It includes 16 questions involving queries to retrieve employee names and details based on various criteria like department number, job type, salary range, and more. The questions cover basic SQL commands like SELECT, WHERE, BETWEEN, ORDER BY, LIKE, and aggregate functions.

Uploaded by

agarwalvanshika
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/ 2

Lab Assignment2

Based on Emp table


Columns are EmpNo, Ename, Job, Salary, Commission, DeptNO
Insert 5 records by stroring Null value in some records for commission column.
Q1)Getemployeenoandemployeenamewhoworksindeptno10?
SELECTempno,enameFROMemp
WHEREdeptno=10;
Q2)Displaytheemployeenamesofthoseclerkswhosesalary>2000?
SELECTenameFROMemp
WHEREjob='Clerk'ANDsal>2000;
Q3)DisplaynameandjobofSalesperson&Clerks?
SELECTename,jobFROMemp
WHEREjob='Clerk'ORjob='salesperson';
Q4)Displayalldetailsofemployeeswhosesalarybetween2000and3000?
SELECT*FROMemp
WHEREsalBETWEEN2000AND3000;
Q5)Displayalldetailsofemployeeswhosedeptnois10,20or30?
SELECT*FROMemp
WHEREdeptno=10ORdeptno=20ORdeptno=30;
Q6)DisplaynameofthoseemployeeswhosecommissionisNULL?
SELECTenameFROMemp
WHEREcommISNULL;
Q7)Displaydeptno&salaryinascendingorderofdeptnoandwithin
eachdeptnosalaryshouldbeindescendingorder?
SELECTdeptno,salFROMemp
ORDERBYdeptno,salDESC;
Q8)DisplaynameofemployeeshavingtwoaorAcharsinthename?
SELECTenameFROMemp
WHEREenameLIKE%a%a%ORenameLIKE%A%A%;
Q9)DisplaythenameoftheemployeeswhosesecondcharisborB?
SELECTenameFROMemp
WHEREenameLIKE'_b%'ORenameLIKE'_B%';
Q10)Displaythenameoftheemployeeswhosefirstorlastcharisa
orA?
SELECTenameFROMemp
WHEREenameLIKE'a%'ORenameLIKE'A%'ORenameLIKE'%a'ORename
LIKE'%A';
Q11)Displaymaximum,minimum,averagesalaryofdeptno10employees.
SELECTMAX(sal),MIN(sal),AVG(sal)FROMemp
WHEREdeptno=302;
Q12)Displaytotalnumberofemployeesworkingindeptno20.
SELECTCOUNT(*)FROMemp
WHEREdeptno=20;
Q13)Displaytotalsalarypaidtoclerks
SELECTSUM(sal)FROMemp
WHEREjob='Clerk';
Q14)Displaysystemdate
SELECTDISTINCTSYSDATEFROMemp;
Q15)Displaytheresultof(12*12)/13
SELECT(12*12)/13FROMdual;
Q16)Displayinfoofrajirrespectivetothecaseinwhichthedatais
stored.
SELECT*FROMemp

WHERELOWER(ename)='raj';

You might also like