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

Practical File

Uploaded by

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

Practical File

Uploaded by

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

DELHI PUBLIC SCHOOL, ELECTRONIC CITY

29-05-2023

ASSIGNMENT 1:

To create Teacher table as instructed-

(Don’t Write in the nb, it’s for your reference) Draw the table given on pg 574, Q17 on the blank
space on page 1.

a. Create a database school.

CREATE DATABASE school;

b. Create the table ‘Teacher’ by using the database school.

USE school;

CREATE TABLE Teacher (


No INTEGER PRIMARY KEY,
Name CHAR(25),
Age INTEGER,
Department VARCHAR(25),
DateOfJoin DATE,
Salary INTEGER,
Sex CHAR(1)

);
c. Show the description of the table.
DESC Teacher;

d. Insert the values into the table:

INSERT INTO Teacher VALUES

(1,"Jugal",34,"Computer","1997-01-10",12000,"M"),

(2,"Sharmila",31,"History","1998-03-24",20000,"F"),

(3,"Sandeep",32,"Maths",”1996-12-12”,30000,"M"),

(4,"Sangeeta",35,"History",”1999-01-07”,40000,”F”),

(5,"Rakesh",42,"Maths",”1997-05-09”,25000,"M"),

(6,"Shyam",50,"History",”1998-06-27”,30000,"M"),

(7,"Shiv Om", 44, "Computer",”1997-02-25”,21000,"M"),

(8,"Shalakha",33,"Maths",”1997-07-31”,20000,"F");
SCREENSHOT OF INSERT QUERY(OPTIONAL)
E .Show all information about the teachers from history department:

SELECT * FROM Teacher WHERE Department = "History";

F. List all the names of female teachers who are in Hindi Department:

SELECT Name FROM Teacher WHERE Department = "Hindi" and Sex = "F";

G. To list names of all teachers with their date of joining in ascending order:

SELECT Name FROM Teacher ORDER BY DateOfJoin ASC;


H. Display name, age and salary of those teachers having salary between 11,000 and 26,000.

SELECT Name, Age, Salary FROM Teacher WHERE Salary BETWEEN 11000 AND 26000;

I. Display name of those teachers whose name starts with s and belong to history department.

SELECT Name FROM Teacher WHERE Department = "History" AND Name like "S%";

5/06/2023

ASSIGNMENT 2-
A. Create Students table in any existing database.
B. Insert values into the table.
C. Insert a new field remark, if the total is above 450 write Excellent, if it’s between 400 and less than
450 Very Good, Between 350 and less than 400 Good, otherwise Work Hard.
D. Display the games taken up by students, whose name starts with “R” or ends with ‘I’.
E. Update the name Dhriti as Dhriti R where remark is Very Good.
F. Count total no. of records
G. Update chem as 97 for 1004.
H. Print the records in ascending order using name and descending order using CS
I. Print the name of that child who has got minimum marks in CS.
J. Print the max marks in Maths and name of the child. Find out the average and percentage of the
child.

Assignment 3: Sumita Arora – pg no 622- Q13.

Assignment 4:
Together With - Page no 160 Q no 24

Assignment 5:
Together with Q 21- pg no 158.

Product and Client table.

a) Create Product and Client tables.


b) Insert the records in the tables.

Rest questions from the book.

Assignment 6

WAP to connect Python with MySQL and create a medicine table in Hospital database.
Medicine table contains the details as medicine id, manufacturer name, manufacturing date,
expiry date, quantity, salary.

Create Doctors table- Dr Id, Dr name, Dr specialization, years of experience.

Enter the data from the user using old parameterised style.

(Note: Enter minimum 5 records in each table)

Assignment 7

WAP to connect with Hospital database and search in Doctors table for doctor’s details who are
specialised in treating cancer patients. (new style)

Assignment 8

WAP to connect with Hospital database and delete all the expired medicines from medicine
table. Print the updated table. (new style)

Assignment 9

WAP to connect with Hospital database and increase the salary by 5000 for those doctors who
have completed 10 years. Print the updated table. (old style)
Assignment 10

Write a function create () to enter the details of 5 employees in a csv file, emp.csv . Details like empid, ename, salary
and address. Write a function find() to find the details of employees where name is given by the user.

Assignment 11

Create a binary file with roll number, name, percentage and cash_prize . Keep the prize money as 0 initially and
search for those students who have got 90% and above. Award cash_prize as 1000/-. Print the complete details of
the students got prize amount.

Assignment 12

Read a text file and display the number of vowels/consonants/uppercase/lowercase characters in the file.

Assignment 13

Read a text file data.txt and count the number of times ‘as’ occurs in the file. Replace ‘as’ with ‘because’ ; print the
updated file with the count of the updated sentences.

Input: I am not going to the school as I am not well. I will go tomorrow.

Output: I am not going to the school because I am not well. I will go tomorrow.
1 sentence is updated.

Assignment 14:

Write a function to read the content from ‘qoutes.txt’ and transfer the content to the file
‘duplicate.txt’. While transferring convert all the uppercase characters to lowercase character and
vice-versa.

Assignment 15:

Write a function to read the content from the file ‘collection.bat’ and store the frequency of each
word in dictionary and display the dictionary on the screen.

Assignment 16:

Write a method in Python to read lines from a text file mynotes.txt and display those lines which
are starting with the alphabet A or T.

You might also like