Class Xii Practical Copy Programs Term2!24!25
Class Xii Practical Copy Programs Term2!24!25
1. Write SQL commands for (a) to ( j) on the basis of Teacher relation given below.
Q2)
(a) Display names of employees whose names include either of the substring “TH” or “LL”.
(b) Display data of all employees sorted by their deptno, hiredate and salary.
(c) Find all the employees who are not manager.
(d) To display all employees who were hired during 1995.
(e) Show the average salary for all departments with more than 3 people for a job.
(f) Find out number of employees having ‘MANAGER’ as job.
(g) Display department no. and number of employees in each department.
Page 1 of 4
Q3) Consider the following WORKERS and DESIG. Write SQL commands for the statements (i) to
(iv) and give outputs for SQL queries (v) to (viii)
WORKERS
(i) To display W_ID, FIRSTNAME, ADDRESS and CITY of all employees living in NEW
YORK from the table WORKERS.
(ii) To display the content of workers table in ascending order of LASTNAME.
(iii) To display the FIRSTNAME, LASTNAME and total salary of all clerks from the
tables WORKERS and DESIGN, where total salary is calculated as SALARY +
BENEFITS.
(iv) To display the minimum salary among Managers and Clerks from the table DESIG.
(v)To display firstname,lastname,designation for Manager and clerks suing tables workers and desig.
Page 2 of 4
Q4)Write SQL commands for the statements (i) to (vi) on the basis of the table EMPLOYEE:
(i) To list the ITEMNAME which are priced at more than 1000 from the INTERIORS
table
(ii) To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before
22/01/02 from the INTERIORS table in descending order of ITEMNAME
(iii) To show all information about the sofas from the INTERIORS table
(iv) To display ITEMNAME and DATEOF STOCK of those items in which the discount
percentage is more than 15 from INTERIORS table
(v) To count the number of items, whose type is “Double Bed” from INTERIORS table
(vi) To insert a new row in the NEWONES table with the following data
14,”True Indian”, “Office Table”, 28/03/03,15000,20
Page 3 of 4
Q6) Create Python MySQL interface to perform the following through menu driven program using
functions:
Employee Data management
1.Create Table
2. Data Entry
3. Show All records
4 . Show specific No of records
5 . Show records one by one
6. Exit
Databse name: Employee
Table : EMP
Structure of EMP Table
(eno int, ename varchar(20), age int , dept( varchar(20) , doj date , sal float , gen char(1))
Q7)Create Python MySQL interface to perform the following through menu driven program using
functions:
Student Data management
1.Create Table
2. Data Entry
3. Show All records
4 . Fees >2000
5 . Marks between 60-80
6. Exit
Databse name: Student
Table : stud
Structure of stud Table
(rn int, name varchar(10), age int , dept( varchar(10) ), dob date , fees float , marks float , gen char(1))
Q8) Julie has created a dictionary containing names and marks as key value pairs of 6 students.
Write a program, with separate user defined functions to perform the following operations:
● Push the keys (name of the student) of the dictionary into a stack, where the corresponding
value (marks) is greater than 75.
● Pop and display the content of the stack.
For example:
If the sample content of the dictionary is as follows:
R={"OM":76, "JAI":45, "BOB":89, "ALI":65, "ANU":90, "TOM":82}
The output from the program should be:
TOM ANU BOB OM
Q9) Alam has a list containing 10 integers. You need to help him create a program with separate user
defined functions to perform the following operations based on this list.
● Traverse the content of the list and push the even numbers into a stack.
● Pop and display the content of the stack.
For Example:
If the sample Content of the list is as follows:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
38 22 98 56 34 12
==================================xxxx================================
Page 4 of 4