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

Practical

The document outlines multiple programming tasks, including creating menu-driven programs in Python for managing binary files and CSV files, as well as writing SQL queries for given database tables. It covers operations such as adding, displaying, and searching records, along with specific SQL commands for manipulating data in tables related to customers, orders, books, employees, weather, and population statistics. Each task is structured to enhance skills in file handling and database management.

Uploaded by

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

Practical

The document outlines multiple programming tasks, including creating menu-driven programs in Python for managing binary files and CSV files, as well as writing SQL queries for given database tables. It covers operations such as adding, displaying, and searching records, along with specific SQL commands for manipulating data in tables related to customers, orders, books, employees, weather, and population statistics. Each task is structured to enhance skills in file handling and database management.

Uploaded by

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

Q – 1 a) Write a menu drive program to perform the following operations into

a binary file shoes.dat.


1. Add record
2. Display records
3. Search record
4. Exit
The structure of file content is: [s_id, name, brand, type, price]

b) Observe the following tables customers and orders and write queries
given below:

Table – Customer
CustomerID CustomerName City MobileNo
C111 Abhishek Ahmedabad 9999999999
C132 Bhavik Anand 7799779977
C135 Chandani Baroda 8856895485
C145 Dhara Ahmedabad 7456879652
C121 Divya Anand 9015123569

Table - Order
OrderID OrderDate OrderAmt CustomerID
O111 2022-04-15 1500 C111
O112 2022-05-20 1800 C121
O113 2022-05-31 1000 C199
O131 2022-06-12 1400 C135

(i) Display CustomerID, CustomerName and order amount for customers belongs to
Ahmedabad.
(ii) Display the order details in descending order of amount.
(iii) Display OrderId, Orderdate , customername and mobileno of customers whose
name ends with ‘k’ and name contains letter ‘h’.
(iv) Display the sum of order amount for each city.

Q – 1 a) Write a menu drive program to python to implement stack using a list


and perform following functions:
1. Push
2. Pop
3. Display
4. Exit
b) Consider the tables books and issue write SQL command for given
statements:

(i) Write command to add primary key and foreign key in tables using alter.
(ii) Increase the price of all computer books by 70.
(iii) Display the book id, book name and quantity issued for all books which have
been issued.
(iv) Display the book id, book name, author name, quantity issued for all books
which price are 200 to 400.

Q – 1 a) WAP a menu-driven program in python to implement following on binary file of


the given structure:
[Doctor_Id, Doctor_Name, Hospital_Id,Joining_Date,Speciality,Salary]
1. Write a record to the file
2. Read all the records to the file
3. Update Record
4. Exit
b) Consider the above table as "emp" and first column is 'empno' as primary key.
Answer the following sql queries.
empno ename job salary dojoin department
1001 Scott Manager 90000 2010-10-01 Accounts
1002 Tom Clerk 34000 2010-01-04 Admin
1003 Joy Clerk 32000 2009-03-01 Admin
1004 Sam Salesman 40000 2009-04-01 Sales
1005 Martin Manager 85000 2008-08-05 Sales
1006 Michel Salesman 43000 2008-08-06 Sales
1007 Francis Clerk 30000 2009-10-10 Accounts

a) Add a row with empno 1008 as Robin,Analyst,60000,2011-04-01,Admin.


b) Display the detail of all employees whose are either Clerk or Manager.
c) Display average salary and no. of employees of each job type.
d) Display detail of employees in Ascending order of their Date of join.
Q – 1 a) Write a menu drive program to perform following operations into telephone.csv.
1. Add record
2. Display records
3. Search record
4. Exit
The structure of file content is: [s_id, name, brand, type, price]

b) Create the table "weather" as given below, take data type and size yourself and
insert all records.
Answer the following sql queries.
Cid City MaxTemp MinTemp Rainfall
C01 Delhi 40.0 32.0 24.1
C02 Bengaluru 31.0 25.0 36.2
C03 Chennai 35.0 27.0 40.8
C04 Mumbai 29.0 21.0 35.2
C05 Kolkata 39.0 23.0 41.8
C06 Allahabad 41.0 30.0 32.4

a) Add a column Zone


b) Display Average of MaxTemp, MinTemp and Rainfall of each Zone.
c) Display detail for Delhi and Mumbai.
d) Display City and Rainfall whose rainfall is in the range 30 and 40.

Q – 1 a) Write a program to create CSV file and store empno, name and salary of employee.
Display the records whose salary in range of 5000 to 15000.

b) Consider the above table as "POP" and first column is 'COUNTRY' as primary key.
Answer the following sql queries.

Country Population BirthRate UpdateDate


China 1379750000 12.00 2016-08-11
India 1330780000 21.76 2016-08-11
United 324882000 13.21 2016-08-11
States
Indonesia 260581000 18.84 2016-01-07
Brazil 206918000 18.43 2016-08-11
Pakistan 194754000 27.62 2016-08-11
a) Display those records whose population lies in the range 1300000000 and 140000000.
b) Display maximum and minimum BirthRate for each UpdateDate.
c) Display number of countries updated on each update date.
d) Increase the birthrate of India by 2.0

You might also like