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

KPS - LIst of Programs For Practical File Term 2

The document provides a practical list of 48 questions involving SQL commands to create, populate, query, and modify databases and tables containing employee and department records. It includes questions demonstrating simple and conditional queries, joins, aggregation, updating records, and altering and dropping tables. The goal is to practice a variety of SQL skills like selection, filtering, sorting, grouping, updating, and modifying database and table structures.

Uploaded by

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

KPS - LIst of Programs For Practical File Term 2

The document provides a practical list of 48 questions involving SQL commands to create, populate, query, and modify databases and tables containing employee and department records. It includes questions demonstrating simple and conditional queries, joins, aggregation, updating records, and altering and dropping tables. The goal is to practice a variety of SQL skills like selection, filtering, sorting, grouping, updating, and modifying database and table structures.

Uploaded by

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

Practical List – 2021-22

Subject: Computer Sc. (083)


Class: XII
Term 2:

Q1. Write a program to implement a stack for these book – details (book no, book name). That is, now
each item node of the stack contains two types of information – a bookno and its name. Implement
Push, Pop and display operation.

Q2. Write a python program all records in ascending order of their age from the given table student.

Q3. Write a program to delete the student record whoes name is read from the keyboard at execution
time.

Q4. Consider the tables given below and answer the questions that follow:

Table: Department
Dept DName MinSal MaxSal HOD
10 Sales 25000 32000 1
20 Finance 30000 50000 5
30 Admin 25000 40000 7

Table: Employee
No Name Salary Zone Age Grade Dept
1 Mukul 30000 West 28 A 10
2 Kritika 35000 Centre 30 A 10
3 Naveen 32000 West 40 20
4 Uday 38000 North 38 C 30
5 Nupur 32000 East 26 20
6 Moksh 37000 South 28 B 10
7 Shelly 36000 North 26 A 30
Write SQL commands to:

CREATE DATABASE, USE, DROP DATABASE, DESC, SHOW TABLES, SHOW


DATABASES, CREATE TABLE, INSERT INTO
1. Create a database Records
2. Get inside the database Records
3. Create tables Employee and Department
4. Insert tuples as shown above
5. Display the databases that are already created.
6. Display the database Records
7. Display the tables that exists in the current database.
8. Display the structure of the table Employee
9. Display the structure of the table Department
Simple Select
10. Display the details of all the employees.
11. Display the Salary, Zone, and Grade of all the employees.
12. Display the records of all the employees along with their annual salaries. The Salary column
of the table contains monthly salaries of the employees.
13. Display the records of all the employees along with their annual salaries. The Salary column
of the table contains monthly salaries of the employees. The new column should be given the
name “Annual Salary”.

Conditional Select using Where Clause


14. Display the details of all the employees who are below 30 years of age.
15. Display the names of all the employees working in North zone.
16. Display the salaries of all the employees of department 10.
Using NULL
17. Display the details of all the employees whose Grade is NULL.
18. Display the details of all the employees whose Grade is not NULL.
Using DISTINCT Clause
19. Display the names of various zones from the table Employee. A zone name should appear only
once.
20. Display the various department numbers from the table Employee. A department number
should be displayed only once.
Using Logical Operators (NOT, AND, OR)
21. Display the details of all the employees of department 10 who are above 30 years of age.
22. Display the details of all the employees who are getting a salary of more than 35000 in the
department 30.
23. Display the names and salaries of all the employees who are working neither in West zone nor
in Centre zone.
24. Display the names of all the employees who are working in department 20 or 30.
25. Display the details of all the employees whose salary is between 32000 and 38000.
26. Display the details of all the employees whose grade is between „A‟ and „C‟.
Using IN Operator
27. Display the names of all the employees who are working in department 20 or 30. (Using IN
operator)
28. Display the names and salaries of all the employees who are working neither in West zone nor
in Centre zone. (Using IN operator)
Using BETWEEN Operator
29. Display the details of all the employees whose salary is between 32000 and 38000. (Using
BETWEEN operator)
30. Display the details of all the employees whose grade is between „A‟ and „C‟. (Using
BETWEEN operator)
Using LIKE Operator
31. Display the name, salary, and age of all the employees whose names start with „M‟.
32. Display the name, salary, and age of all the employees whose names end with „a‟.
33. Display the details of all the employees whose names contain „a‟ as the second character.
Using ORDER BY clause
34. Display the details of all the employees in the ascending order of their salaries.
35. Display the details of all the employees in the descending order of their names.
36. Display the details of all the employees in the ascending order of their grades and within
grades in the descending order of their salaries.

Using GROUP BY clause


37. Display the total number of employees in each department.
38. Display the highest salary, lowest salary, and average salary of each zone.
39. Display the average age of employees in each department only for those departments in which
average age is more than 30.
Joining of two table
40 Display department name, minsal and name of employee whoes department no is 20.
41 Display zone and department name, employee name and age whoes depatment no is 10 and
age is less than 30.
Using UPDATE, DELETE, ALTER TABLE
42. Put the grade B for all those whose grade is NULL.
43. Increase the salary of all the employees above 30 years of age by 10%.
44. Delete the records of all the employees whose grade is C and salary is below 30000.
DROP TABLE, ALTER TABLE
45 Add another column HireDate of type Date in the Employee table.
46 Modify the column age to Empage with datatype date
47 Remove the column HireDate
48 Drop the tables Employee and Department.

You might also like