0% found this document useful (0 votes)
97 views3 pages

No Name Salary Zone Age Grade Dept

The document outlines 9 programming assignments involving Python, SQL, and database concepts. The assignments include implementing stacks using lists in Python, querying and manipulating SQL database tables to retrieve and update employee, book, and flight data, adding and modifying columns in SQL tables, and creating and populating a database table using Python and MySQL.

Uploaded by

Sonali Das
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)
97 views3 pages

No Name Salary Zone Age Grade Dept

The document outlines 9 programming assignments involving Python, SQL, and database concepts. The assignments include implementing stacks using lists in Python, querying and manipulating SQL database tables to retrieve and update employee, book, and flight data, adding and modifying columns in SQL tables, and creating and populating a database table using Python and MySQL.

Uploaded by

Sonali Das
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/ 3

Practical Term 2(computer science)

1. Write a Python program to implement a stack of words using list. Implement


operation push, pop, display.
2. Write a program to implement a stack for these book details
(bookno,bookname). That is , each item of the stack contain two types of
information a bookno and its name. Implement push pop and display
operation for this stack.
3. Read a string from user and reverse it using stack.
4. Execute following queries and write the output.
i) Create following table .
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 NULL 20

4 Uday 38000 North 38 C 30

5 Nupur 32000 East 26 NULL 20

ii) Insert data in table as shown.


iii) Display the Salary, Zone, and Grade of all the employees.
iv) Display the details of all the employees who are below 30 years of age
v) Display the names and salaries of all the employees who are working
neither in West zone nor in Centre zone.

5. consider the following table and write sql queries and their output.
Books
Book_ID Book_Name AuthorName Publisher Price Type Qty
F0001 The Tears William First Pub 750 Fiction 10
Hopkins
F0002 Thunderbolts Anna First Pub 700 Fiction 5
Roberts
T0001 My First Brain and Br EPD 250 Text 10
C++

i) To display the names and price of the books in descending order of their price
ii) To display average price of all books of text type.
iii) display the record of all books in descending order of their quantify.
iv) To delete all entry of fiction type.
v) Remove the column price from the table.

6.
i) create the below two table .Tables should have appropriate constraint like
primary key, foreign key, not null .
Flights
FL_no Starting Ending NO_Flights NO_Stops
IC301 Mumbai Delhi 8 0
IC799 Banglore Delhi 2 1
MC101 Indore Mumbai 3 0
IC302 Delhi Mumbai 8 0
AM812 Kanpur Banglore 3 1
IC899 Mumbai Kochi 1 4
Fares
Fl_No Airlie Fare Pertax
IC701 Indian Airlines 6500 10
MU499 Sahara 9400 5
AM501 Jet Airways 13450 8
IC899 Indian Airlines 8300 4
IC302 Indian Airlines 4300 10

IC799 Indian Airlines 10500 10

MC101 Deccan Airlines 3500 4


ii) insert records in both the tables
iii) Display Details of all flights from the table Flight in ascending order of flight
number
iv) Display the flight number and fare to be paid for the flights from Delhi to
Mumbai using the tables flights and Fares where the fare to be paid =fare+
fare*Pertax/100
v)Display the names of Airline having “ian” somewhere in there name.

7. consider the table


WORKE FIRST_N LAST_N SALARY JOINING_D DEPAR
R_I D A ME AM E ATE TM
ENT
001 Monika Arora 100000 2014-02-20 HR
002 Niharika Diwan 80000 2014-06-11 Admin
003 Vishal Singhal 300000 2014-02-20 HR
004 Amitabh Singh 500000 2014-02-20 Admin
005 Vivek Bhati 500000 2014-06-11 Admin
006 Vipul Diwan 200000 2014-06-11 Account
007 Satish Kumar 75000 2014-02-20 Account
008 Monika Chauhan 80000 2014-04-11 Admin
i) write query to add one more column in above table DOB
ii) Write query to sum total of salary department wise
iii) Karan wants to increase the size of the FIRST_NAME column from
1 10 to 20 characters. Write an appropriate query to change the size.
iv) Write a query to display the Structure of the table WORKER, i.e. name
of the attribute and their respective data types
v) Write query to average of salary of those department where average
salary is greater than 22000.

8. Consider the table garment write query from (i) to (v)


Gcode Gname Size Colour Price
111 Tshirt XL White 1500.00
112 ladies jeans L Blue 2500.00
251 Skirts M Pink 1000.00
155 Trouser L Black 2500.00
116 Kurti S White 500.00
i) To display names of those garments that are available in ‘XL’ size.
ii) To display codes and names of those garments that have their names starting
with ‘Ladies’.
(iii) To display garment names, codes and prices of those garments that have
price in the range 1000.00 to 1500.00 (both 1000.00 and 1500.00 included).
(iv) To change the colour of garment with code as 116 to “Orange”.
v) Display details of all items in ascending order of price

9. Create a database TestDB and create a table employee with fields


First_name,age,Sex and income in testDB. using Python-mysql interface.

You might also like