0% found this document useful (0 votes)
43 views

Practical Report File Programs+Mysql Queries-Term2!21!22

This document contains a practical report file for a Python programming class. It includes 5 Python programs to be written involving defining functions to add and remove packages from a list, pushing numbers divisible by 5 onto a stack, popping values off a stack, reading and displaying records from an employee table in a database, and modifying employee information in the database. It also provides SQL queries to be written involving creating and using a database called STUDENTS, creating a table to insert student data, using selection queries with WHERE and logical clauses, updating records with operators like IN, BETWEEN, LIKE and ORDER BY, and modifying the table structure with ALTER. Finally, it lists some SQL commands to predict the output involving functions like LENGTH,

Uploaded by

Jschlatt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Practical Report File Programs+Mysql Queries-Term2!21!22

This document contains a practical report file for a Python programming class. It includes 5 Python programs to be written involving defining functions to add and remove packages from a list, pushing numbers divisible by 5 onto a stack, popping values off a stack, reading and displaying records from an employee table in a database, and modifying employee information in the database. It also provides SQL queries to be written involving creating and using a database called STUDENTS, creating a table to insert student data, using selection queries with WHERE and logical clauses, updating records with operators like IN, BETWEEN, LIKE and ORDER BY, and modifying the table structure with ALTER. Finally, it lists some SQL commands to predict the output involving functions like LENGTH,

Uploaded by

Jschlatt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Delhi Public School, Bilaspur

Computer Science-XII-2021-22

Practical Report File

Python Program

Submission Date: 15-02-2022

1. Write a program in Python to define a function, MakePush(Package) and


MakePop(Package) to add a new Package and delete a Package from a List of Package
Description, considering them to act as push and pop operations of the Stack data structure.
2. Write a program to define a function in Python PUSH(Arr), where Arr is a list of numbers.
From this list push all numbers divisible by 5 into a stack implemented by using a list.
Display the stack if it has at least one element, otherwise display appropriate error message.
3. Write a program to define a function in Python POP(Arr), where Arr is a stack
implemented by a list of numbers. The function returns the value deleted from the stack
4. Write a program in Python to read and display all records from Table Employee. (Based
on MySQL query)
5. Write a program to modify an employee’s information stored in Employee Table.
(Database Connectivity)

MYSQL

Consider a database STUDENTS with following table:

Table: Students_Details

SID SNAME CLASS STREAM DOA DOB FEES GENDER

S001 AMIT SINGH 12A MATHS 12-03- 12-10- 50000.75 M


2007 2001
S002 SHREEJA 11C COMMERCE 30-04- 10-01- NULL F
2008 2004
S003 MOHIT 12C COMMERCE 07-07- 25-02- 50000.40 M
SHARMA 2007 2004
S004 MRINAL 12A MATHS 21-11- 30-05- 50000.40 M
KUMAR 2007 2004
S005 ANYA 11A MATHS 13-12- 19-02- 46000.98 F
AGRAWAL 2009 2003
S006 AMRITA PAL 11B BIO 11-06- 17-08- 45000.25 F
2009 2004
S007 EDRIC S. 12B BIO 06-09- 22-04- 43000.55 M
2010 2001
Write SQL Commands for the questions 1 to 26 and predict the output for the SQL commands 27
to 34.
Create Database and use it.
1. Create database STUDENTS
2. Use database STUDENTS.
Create table/Insert into
3. Create table Students_Details and insert tuples in it.
Select query
4. Display details of all students
5. Display SID, SNAME and FEES of all students.
Select with where clause
6. Display details of all the students with fees more than 45000.
7. Display SID, CLASS and FEES of all MATHS students.
8. Display SNAME and STREAM of all female students.
9. Display details of all students who have joined school before 01-01-2009.
10. Display details of students whose FEES is NULL.
Using DISTINCT clause
11. Display different STREAM.
12. Display different CLASS.
Using Logical Operators(NOT,AND,OR)
13. Display details of all the students whose fees is more than 45000 and stream is MATHS.
14. Display SNAME of all students who are in MATHS or BIO stream.
Using IN Operator
15. Display SNAME and DOB of all students whose classes are 12A,12B,12C(Using IN operator).
Using Between Operator
16. Display SNAME, DOA, Gender of all students whose DOB is in the range '01-01-2002' to
'31=12-2003'.
Using LIKE operator
17. Display SID, SNAME and Fees of all students whose name ends with 'Singh'.
18. Display details of all students whose name does not contains 'r'.
19. Display SNAME and CLASS of all students whose name has 'A' as second last character.
Using ORDER BY Clause
20. Display details of all student in the descending order of their DOB.
21. Display details of students in ascending order of class and in descending order of their DOB.
Using UPDATE,DELETE,ALTER TABLE
22. Increase Fees of all students by 500.
23. Change Stream to Maths of all students who are Female.
24. Set Fees to 6000 for all students whose Fees is NULL.
25. Delete all students whose fees is less than 45000.
26. Add a new column Category varchar(20) in table Students_Details.
Find output of the following queries
27. Select SNAME,Length(Stream) from Students_Details where Fees>=45000;
28. Select Right(Sname,5),Substr(Stream,4) from Students_Details where Sname like ‘%L’;
29. Select round(Fees,2) from Students_Details where Class like ‘12%’;
Write output of following SQL Commands
30. SELECT POW(2,4) “POWER”;
31. SELECT ROUND(325.8598,2),ROUND(325.8598,0),ROUND(325.8598,-2);
32. SELECT TRUNCATE(325.8598,2),TRUNCATE(325.8598,-2);
33. SELECT LENGTH(“DELHI PUBLIC SCHOOL,BILASPUR”);
34. SELECT CONCAT(“QNO.25”,”Y COLONY”) “ADDRESS”;
*************

You might also like