Class 12 CBSE MySQL Computer Science Worksheet

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

Consider a table EMPLOYEE with the following data and answer the

SQL queries:

ENO Ename Salary Area code Bonus Date of joining


1 Raj sinha 300000 36 12.00 19-07-2009
2 Udit Thakur 500000 48 10.00 22-03-2007
3 R.K.Sharma 300000 36 NULL 08-03-2007
4 Neha Yadav 800000 60 10.00 06-12-2008
5 Ajay Garg 200000 36 12.50 03-01-2010
6 Ravi Rajan 700000 60 12.50 05-06-2008
7 Mohit Dua 500000 48 NULL 05-03-2008

Create database and use it

1.Create a database OFFICE

2.Use the database OFFICE

Create table / insert into

3. Create a table EMPLOYEE and insert tuples into it

Simple Select

4. Display the details of all the employees.

5. Display the employee number, name and salary of all the employees

Conditional Select using Where Clause

6. Display the details of all the employees salary less than 300000.

7. Display the employee number and salary of all the employees who joined
after 01- 04- 2009.

8. Display the employee number employee name of all the employees joined
before 01- 04- 2009

Using NULL
9. Display the details of all the employees whose bonus is NULL.
10. Display the details of all the employees whose bonus is not NULL.
Using DISTINCT class
11. Display the salary of employees from the table removing duplicate values.
12. Display the area code of employees from the table employees. An area code
should only once.
Using logical operators( NOT, AND,OR)
13. Display the details of all the employees joined after 31-12-2008 for which
the area code is more than 36.
14. Display the name and salary all the employees who don't have the area code
36.
15. Display the name and salary for all the employees for which the salary is
less than 500000 or bonus is more than 12.
16. Display the details of all the employees who joined in the year 2009.
17. display the details of all the employees whose bonus is in the range 11% to
12%.
18. display the details of all employees whose salary is in the range 400000 to
500000.
Using IN operator
19. display the name salary of all the employees for whom the bonus is 24, 36
or 48.
Using between operator
20. display the details of all the employees whose salary is in the range 400000
to 500000.
21. display the details of all the employees bonus is in the range 11% to 12%.
Using like operator
22. display the employee number name and salary for all the employees home
the name ends with 'Sharma'.
23. display the employee number name and salary of all the employees for
whom the name ends with 'a'.
24. display the employee number and salary for all the employees for whom the
name contains 'a'.
25.display the employee number salary of all employees for whom the name
does not contain 'p'.
26. display the employee number name and salary of all the employees for
whom the name contains a as the second last character 'P'.
Using order by clause
27.display the details of all the employees in the ascending order of their salary.
28. display the details of all the employees in the descending order of their join
date.
29. display the details of all employees in the ascending order of their salary and
within the salary in descending order of the joining date.
Using update,delete,alter table
30. assigned the bonus 15.50% for all the employees for which the bonus is
null.
31. increase the bonus by 0.5% for all the employees for which salary is more
than 400000.
32. for every employees bonus with (salary* bonus)/12*100.
33. delete the records of employee N.P.jain
34. add another column category of type char(5 )in the employee's table

You might also like