0% found this document useful (0 votes)
29 views27 pages

12-Practical File - Ip PDF

The document contains a practical file for Informatics Practices, detailing SQL queries for creating databases, tables, and manipulating data. It includes tasks related to creating series and dataframes using Python, as well as generating visualizations with matplotlib. The file is structured in sections, each focusing on different aspects of database management and data analysis.

Uploaded by

yaksh.rathee
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)
29 views27 pages

12-Practical File - Ip PDF

The document contains a practical file for Informatics Practices, detailing SQL queries for creating databases, tables, and manipulating data. It includes tasks related to creating series and dataframes using Python, as well as generating visualizations with matplotlib. The file is structured in sections, each focusing on different aspects of database management and data analysis.

Uploaded by

yaksh.rathee
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/ 27

INFORMATICS PRACTICES

PRACTICAL FILE

Name: Aditya kumar


CLASS:-XII-Caring

1 Write the queries for the following:-


.
a)Write a query to create a new database in the name of SCHOOL.

b)Write a query to open the database SCHOOL.

c)Write a query to create the table named STUDENT with the following structure:

Field Datatype/size Constraint


Rollno Int Primary key
Name Varchar(25)
Class Char(5)
Section Char(1)
Gender Char(1) Int
Fees

c)Write a query to insert all records in the given table.

d)Write a query to display the roll number, name, and class from the student table.

e)Write a query to display the names of Female students.

g) Write a query to change the fees of students to 170 whose roll number is 1.

h) Write a query to add a new column DOB of datatype date.

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

Sid Sname Fees DateofPlay CoachId


1 2 Karate 1200 2024-08-24 S1 S2 S3
3 4 Football 1800 2024-09-13 S4 S5
5 Cricket 1500 2024-06-14
Lawn 2500 2024-09-25
Tennis 1800 2024-10-20
Badminton
a)To display Sid and the names of those sports that are to be played in the
month of September.

b)To display all Sports in lowercase.

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.

9. Write a program to generate a series of 10 numbers with a scalar value of


44.
10 Write a program to create a Series named items which contains the index as
. Stationary and Quantity as values of the Series:
Stationa Pencil Noteboo Scale Eraser Pen Shapner
ry k
Quantity 20 33 52 10 15 3
1
a)Display the first 3 records of the Series.
b)Display the last 3 records of the Series.
c)Display the first five records of the Series.
d)Display the last five records of the Series.
11 Create the following DataFrame Sales(using list of dictionary) containing year
. wise sales figures for five salespersons in INR. Use the years as column labels,
and salesperson names as row labels.

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 statements to do the following :


a) Display rows 2 to 4 (both inclusive)
b)Fromrows2to4 (bothinclusive),displaycolumns“Itemtype”and“Total
profit”. C) From rows
2 to 4 (both inclusive), display the first four columns.
16. Consider the csv file given 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:

Write a program to display the aid for:

a)Books and uniform


only
b)Shoes only
19 Create the following dataframe saledf(using series):
.

Write a program to do the following:

a)Add a column namely orders having values 6000,6700,6200,6000 respectively


for the zones A,B,C and D.

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

b)To delete the row with the row label 2.

c)To delete the column having column label as Frequency.


21 Write a Python code to plot a line graph of the past pass percentage of four
. years of two different schools.
School_X=[89,75.5,84,91]
School_Y=[73,79,84,81] Year=
[2019,2020,2021,2022]
22. Write a Python code to draw the double bar graph for data given below using
matplotlib [1,3,6,7,9],[5,2,7,8,2] & [2,4,6,8,10],[8,6,2,5,6]. The graph should
have appropriate titles, labels and legends.
23. Write a python code to display a bar chart of the popularity of programming
languages. Sample data: Languages:[“Python”,”Java”,”PHP”,”Javascript”]
Popularity:[8.6,8,7.8,6.4] The width of the bars should be 0.5 and the bar
colour should be black.
24. Write a Python code to display a horizontal bar chart of the popularity of
programming languages. Sample data: Languages:
[“Python”,”Java”,”PHP”,”Javascript”] Popularity:[8.6,8,7.8,6.4] The width of the
bars should be [0.5,0.7,0.4,0.7] and the bar colour should be
[“blue”,”black”,”yellow”,”orange”].
25. The following are the runs scored by a team in the first 10 overs : Overs=
[1,2,3,4,5,6,7,8,9,10] Runs=[6,0,25,10,20,15,6,18,12] Draw the line graph for the
above data using matplotlib giving the linestyle as dashed and the line color as
green.

You might also like