12-Practical File - Ip PDF
12-Practical File - Ip PDF
PRACTICAL FILE
c)Write a query to create the table named STUDENT with the following structure:
d)Write a query to display the roll number, name, and class from the student table.
g) Write a query to change the fees of students to 170 whose roll number is 1.
i) Write a query to delete the details of students where the name starts withA.
2. Towritequeriesbasedonthebelow tablesstockanddealer:-
Create the table and insert the data as specified below:
3. Consider the given table and write the following queries in SQL:
Table: Sports
c)To display the last two characters of all sports names whose fees is less
than 1800.
d)To display the highest and lowest fees from the Sports table.
e)To display the sports name and fees in descending order of fees.
4. a)Write a query to display a cube of 5. b) Write a query to display the number
563.854741 rounded off to one decimal place. c) Write a query to display "put" from the
word "Computer". d) Write a query to display today's date. (yyyy-mm-dd format) e)
Write a query to display 'DIA' from the word "MEDIA". f)Write a query to display the first
two and last two characters from the string “India”. g)Write a query to display the
position of “NAME” in the string field “FACULTYNAME”.
5 . Create the given TEACHER table and write SQL queries for the following :
EMPNO FNAM LNAME SUBJECT QUALIFI Salary POST
E CATION
101 Sande Verma SST B.ed 35000 TGT
e
102 p Kumari Computer BCA 42000 TGT
103 Sonia Sharma Hindi M.ed 45000 PGT
104 Nirmal Shastri English B.ed 35000 TGT
Sanjee
105 v Sharma Mathemat M.ed 48000 PGT
Rakesh
i
cs of the teachers with some space in between.
a)To join the First name and Last name
b)To display the contents of the “Qualification” field in small letters. c)To display the
first 3 characters of the “Subject” field. d)To display the total length of the
Qualification column. e) To display the name of teachers along with their salary sorted
by salary in
descending order.
f) To display the count of teachers post-wise.
g) To display the count of teachers qualification-wise.
h)To display the total number of teachers.
i)To display the highest and the lowest salary offered to teachers.
6. Create the series object ob1,ob2 and ob3 given below:
a) Writecodetoaddtheseriesob1withob2. b)
Writecodetosubtracttheseriesob1fromob3.
7. Write a program to create a Series object using a dictionary that stores the
number of students in each section of class 12 in your school.
8. Write a program to create a Series named stu with index as Name and Marks as
values from the given data set “student”:
Name Shruti Rinku Nidhi Tinku Vidushi Rohit
Marks 80 89 90 79 82 99
a)Display the records of those students who have scored marks greater than 85.
b)Display the records of those students who have scored marks less than and
equal to 80.
12 Consider above dataframe created in question 11, and write code to do the
. following:
a.) Display the last two rows of
Sales.
b.) Display the last two columns of sales
13 Consider above data frame created in question 11, and write code do the following:
. a)Change the dataframe sales such that it becomes its transpose.
b) Display the sales made by all sales persons in the year 2018.
a)
b)
14 Consider the following Class 12.csv file containing the data as given below:
.
a) Read the csv file into a dataframe df . b) Write the code to find the total
marks(Total_marks) for each student and add it to the newly-created
dataframe. c) Also calculate the percentage obtained by each student
under a new column “Average”in the dataframe
15 Create the dataframe df(using dictionary of lists) as shown below:
.
Write a program to read from a csv file employee.csv and create a dataframe
from it but dataframe should not use file’s column header rather should use own
column numbers as 0,1 2 and so on.
17 Consider the dataframe dtf5 given below:
.
Write a program to create the above dataframe (using a dictionary of lists) and
print the population and schools column for all rows.
18 Create the given dataframe aid (using 2D lists) that stores the aid by NGO’s for
. different states:
b)Add a new row for a new zone zone. Add dummy values in this row.
20. Create the given DataFrame password (using Dictionary of Lists):
Codename Category Frequency
0 aaaaaa alpha 6.91 18.52
1 dragon animal 1.29 11.11
2 basketball sport
3 football Sport
a)Write a Python code to add a new row with the following data:
Codename-“abc123” Category:alphanumeric Frequency-12.8