SlideShare a Scribd company logo
1
Case Study for Practical file:
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPT
7369 Sunita Sharma CLERK 7902 1980-12-17 2800 NULL 20
7499 Ashok Singhal SALESMAN 7698 1981-02-20 3600 300 30
7521 Rohit Rana SALESMAN 7698 1981-02-22 5250 500 30
7566 Jyoti Lamba MANAGER 7839 1981-04-02 4975 NULL 20
7654 Martin S. SALESMAN 7698 1981-09-28 6250 1400 30
7698 Binod Goel MANAGER 7839 1981-05-01 5850 NULL 30
7782 Chetan Gupta MANAGER 7839 1981-06-09 2450 NULL 10
7788 Sudhir Rawat ANALYST 7566 1987-04-19 5000 NULL 20
7839 Kavita Sharma PRESIDENT NULL 1981-11-17 5000 NULL 10
7844 Tushar Tiwari SALESMAN 7698 1981-09-08 4500 0 30
7876 Anand Rathi CLERK 7788 1987-05-23 6100 NULL 20
7900 Jagdeep Rana CLERK 7698 1981-12-03 4950 NULL 30
7902 Sumit Vats ANALYST 7566 1981-12-03 3500 3600 20
7934 Manoj Kaushik CLERK 7782 1982-01-23 5300 NULL 10
2
 Create an EMPLOYEE table with the above mentioned
attributes where the EMPNO is the primary key
Output:
 Insert the details of a employees in the above table
Output:
3
 To select all the columns of the above table.
Output:
 To list the name and employee number from the above table.
Output:
4
 To list all the names, hiredate and salary of all employees.
Output:
 To display the employee name and the incremented value of
SAL as SAL + 300.
Output:
5
 To list the employee name and his annual salary (annual
salary=12*sal +100).
Output:
 To convert and display the designation into lower case.
Output:
6
 To list the name and the employee number by converting the
name into uppercase.
Output:
 To list position of character ‘a’ in the name of employee.
Output:
7
 Display the first three characters of the field JOB.
Output:
 To list the salary where salary is less than the commission.
Output:
8
 To list all the columns where salary is greater than 4100.
Output:
 To list name and hiredate of all the employees who are hired in
1981.
Output:
9
 Display the ename and sal where the comm is NULL.
Output:
 To list all the employees who do not have manager.
Output:
10
 To list name and salary of all employees who earn commission.
Output:
 To list the distinct department number from the table.
Output:
 To list the unique jobs from the table.
11
Output:
 To list the name and salary of all the employees who earn more
than 1200 and are in department 10 or 40.
Output:
12
 To list the names and job of all the employees who work in 20
and their manager is 7788.
Output:
 To list the MGR which are IN 7902, 7566, 7788.
Output:
 To list the details of employees having salary between 3000 and
4000.
Output:
13
 To display the employee name and job of employees hired
between Feb 20, 1981 and May 1, 1981.
Output:
 To list the ename starting with ‘S’.
Output:
14
 To list the names of all employees where the second letter of
their name is an ‘a’.
Output:
 To list all the columns in the ascending order of hiredate.
Output:
15
 To list all the columns in the ascending order of deptno and
descending order of salary.
Output:
 Display the ename and deptno of all employees in department
20 and 30 in alphabetical order of name.
Output:
16
 Find the min, max, sum, and average of the salary in each
department.
Output:
 Find the total number of employees from each job title.
Output:
17
 Display the total salary paid to the analysts in the company.
Output:
 Display average of salary for various jobs but only for those jobs
where average salary is above 4500.
Output:

More Related Content

PDF
Sql assignment 4
DOC
Sql queries with answers
DOCX
DATABASE MANAGEMENT SYSTEM PRACTICAL LAB ASSIGNMENT 1
PDF
Simran kaur,BCA Final Year 2015
PDF
Vishwajeet Sikhwal ,BCA,Final Year 2015
PDF
Vijay Kumar
PDF
Pooja Bijawat,Bachelor Degree in Computer Application
PDF
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Sql assignment 4
Sql queries with answers
DATABASE MANAGEMENT SYSTEM PRACTICAL LAB ASSIGNMENT 1
Simran kaur,BCA Final Year 2015
Vishwajeet Sikhwal ,BCA,Final Year 2015
Vijay Kumar
Pooja Bijawat,Bachelor Degree in Computer Application
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College

Similar to sql qn.docx (20)

PDF
Priyanka Bhatia.BCA Final year 2015
DOC
Sql queires
DOC
21390228-SQL-Queries.doc
PDF
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
DOCX
Hands on Assignment for retrieving data using the SQL SELECT statement.docx
PDF
DBMS Lab
PDF
Nikhil Khandelwal BCA 3rd Year
DOC
SQL practice questions - set 3
PDF
Pooja Jain
PDF
Sql queries
PDF
SQL practice questions set
PDF
Orcl sql queries
DOCX
All questions
PDF
Introduction to Databases - Assignment_1
DOCX
Ravi querys 425
DOCX
Sql file (1)
DOC
Sql task answers
DOC
Sql task
DOCX
Assignment 2 (16-08-2013)
Priyanka Bhatia.BCA Final year 2015
Sql queires
21390228-SQL-Queries.doc
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
Hands on Assignment for retrieving data using the SQL SELECT statement.docx
DBMS Lab
Nikhil Khandelwal BCA 3rd Year
SQL practice questions - set 3
Pooja Jain
Sql queries
SQL practice questions set
Orcl sql queries
All questions
Introduction to Databases - Assignment_1
Ravi querys 425
Sql file (1)
Sql task answers
Sql task
Assignment 2 (16-08-2013)
Ad

Recently uploaded (20)

PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Cell Structure & Organelles in detailed.
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
Lesson notes of climatology university.
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Computing-Curriculum for Schools in Ghana
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
Orientation - ARALprogram of Deped to the Parents.pptx
Final Presentation General Medicine 03-08-2024.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
RMMM.pdf make it easy to upload and study
Weekly quiz Compilation Jan -July 25.pdf
Final Presentation General Medicine 03-08-2024.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Cell Structure & Organelles in detailed.
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Supply Chain Operations Speaking Notes -ICLT Program
Chinmaya Tiranga quiz Grand Finale.pdf
History, Philosophy and sociology of education (1).pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Lesson notes of climatology university.
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Computing-Curriculum for Schools in Ghana
LDMMIA Reiki Yoga Finals Review Spring Summer
Paper A Mock Exam 9_ Attempt review.pdf.
2.FourierTransform-ShortQuestionswithAnswers.pdf
Ad

sql qn.docx

  • 1. 1 Case Study for Practical file: EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPT 7369 Sunita Sharma CLERK 7902 1980-12-17 2800 NULL 20 7499 Ashok Singhal SALESMAN 7698 1981-02-20 3600 300 30 7521 Rohit Rana SALESMAN 7698 1981-02-22 5250 500 30 7566 Jyoti Lamba MANAGER 7839 1981-04-02 4975 NULL 20 7654 Martin S. SALESMAN 7698 1981-09-28 6250 1400 30 7698 Binod Goel MANAGER 7839 1981-05-01 5850 NULL 30 7782 Chetan Gupta MANAGER 7839 1981-06-09 2450 NULL 10 7788 Sudhir Rawat ANALYST 7566 1987-04-19 5000 NULL 20 7839 Kavita Sharma PRESIDENT NULL 1981-11-17 5000 NULL 10 7844 Tushar Tiwari SALESMAN 7698 1981-09-08 4500 0 30 7876 Anand Rathi CLERK 7788 1987-05-23 6100 NULL 20 7900 Jagdeep Rana CLERK 7698 1981-12-03 4950 NULL 30 7902 Sumit Vats ANALYST 7566 1981-12-03 3500 3600 20 7934 Manoj Kaushik CLERK 7782 1982-01-23 5300 NULL 10
  • 2. 2  Create an EMPLOYEE table with the above mentioned attributes where the EMPNO is the primary key Output:  Insert the details of a employees in the above table Output:
  • 3. 3  To select all the columns of the above table. Output:  To list the name and employee number from the above table. Output:
  • 4. 4  To list all the names, hiredate and salary of all employees. Output:  To display the employee name and the incremented value of SAL as SAL + 300. Output:
  • 5. 5  To list the employee name and his annual salary (annual salary=12*sal +100). Output:  To convert and display the designation into lower case. Output:
  • 6. 6  To list the name and the employee number by converting the name into uppercase. Output:  To list position of character ‘a’ in the name of employee. Output:
  • 7. 7  Display the first three characters of the field JOB. Output:  To list the salary where salary is less than the commission. Output:
  • 8. 8  To list all the columns where salary is greater than 4100. Output:  To list name and hiredate of all the employees who are hired in 1981. Output:
  • 9. 9  Display the ename and sal where the comm is NULL. Output:  To list all the employees who do not have manager. Output:
  • 10. 10  To list name and salary of all employees who earn commission. Output:  To list the distinct department number from the table. Output:  To list the unique jobs from the table.
  • 11. 11 Output:  To list the name and salary of all the employees who earn more than 1200 and are in department 10 or 40. Output:
  • 12. 12  To list the names and job of all the employees who work in 20 and their manager is 7788. Output:  To list the MGR which are IN 7902, 7566, 7788. Output:  To list the details of employees having salary between 3000 and 4000. Output:
  • 13. 13  To display the employee name and job of employees hired between Feb 20, 1981 and May 1, 1981. Output:  To list the ename starting with ‘S’. Output:
  • 14. 14  To list the names of all employees where the second letter of their name is an ‘a’. Output:  To list all the columns in the ascending order of hiredate. Output:
  • 15. 15  To list all the columns in the ascending order of deptno and descending order of salary. Output:  Display the ename and deptno of all employees in department 20 and 30 in alphabetical order of name. Output:
  • 16. 16  Find the min, max, sum, and average of the salary in each department. Output:  Find the total number of employees from each job title. Output:
  • 17. 17  Display the total salary paid to the analysts in the company. Output:  Display average of salary for various jobs but only for those jobs where average salary is above 4500. Output: