PracticalFile_PythonSql
PracticalFile_PythonSql
PRACTICAL FILE
Prepared By:
NAME- Lakshay Kapoor
CLASS- XII-A
ROLL NO-
INDEX
S.No. Description Of The Practical Signature
1 Create a Series object from a dictionary of values and
ndarray.
2 Create a Series object using NumPy library functions
containing 6 multiples of 12.
3 Create a series object S1. Sort the values in descending order
and store it in S2, sort in ascending order and store the
output in S3. Store the square of S1 and store it in S4. Display
the values which are greater than 20 & then store in S5. Print
all the series object.
4 Create two Series objects and add them.
5 Create a Series object that prints all the elements above the
75th percentile.
6 Create a Series object using NumPy library that contains
four numbers between 8 and 9 and print all its attributes.
7 Create a DataFrame containing Product details using list of
dictionaries method. Print its size and shape.
8 Create a DataFrame for examination result and display row
labels, column labels, data types of each column and the
dimensions of the DataFrame.
9 Create a DataFrame containing Airline details from
dictionary of Series method having 8 rows and 4 columns.
Write the command to print the first five and last five rows.
10 . Create a DataFrame having Employee details with columns
as EmpID, EmpName and Salary with 4 values each and
print the DataFrame. Write the statement to add a new
column ‘Department’ and two more rows. Print the final
DataFrame.
11 Write a program to create a line graph between two tuples X
and Y where – X= (16,12,23,8,39) Y= (17,89,38,46,12) Set the
linecolor as yellow, linewidth as 6, linestyle as dashdot. Show
the grid and set the figuresize as (10,6)
12 For the below given data, create a cumulative histogram with
6 bins. Give appropriate axis labels and graph title – X = [18,
18, 21,22, 23, 24, 28,29,29,36,38,39,39,41,52,52,55,61,63,63]
13 . Write a program to create the below given DataFrame –
Also, write the statement to plot a bar graph between Name
and Score. Set bar width as 0.6 uniformly with different bar
colors. Give appropriate axis labels and graph title for the
plot.
14 . Consider the school result data, analyze the performance of
the students on different parameters, example – subject-wise,
class-wise etc. Create appropriate DataFrames and plot
appropriate charts with title and legend.
15 Take data of your interest from an open source
(www.data.gov.in), aggregate and summarize it. Plot the data
using different plotting functions of the matplotlib library.
16 A company has given the details of its sales in South and
North region for 1st quarter of financial year. Create the
DataFrame for the same and present the data in a bar graph.
17 Create a Student table with the StudentId, Name, and marks
as attributes where the StudentId is the primary key.
18 Insert 10 rows in the above made Student table.
19 Delete the details of a student in the above table for those who
have scored less than 50 marks using appropriate SQL
commands.
20 Write the SQL command to display the details of the students
with marks more than 80.
21 Write the SQL command to update the marks of the students
by adding 5 to all the marks.
22 Write the SQL command to display the names of the students
whose names are starting with ‘R’.
23 Write the SQL command to find the min, max, sum, and
average of the marks in a student marks table.
24 Write a SQL query to order the (student ID, marks) table in
descending order of the marks
25 Write the SQL query to create a table Customer with
CustomerID, CustomerName and Country as the fields and
insert 8 rows.
26 Write the SQL query to find the total number of customers
from each country in the table (customer ID, customer Name,
country) using group by.
27 Write the SQL query to create two tables SName – with fields
StudentId and Name and SDOB with fields SID and DOB.
Insert 5 records in both the table
28 Alter the table SDOB by setting SID as foreign key.
29 Write the SQL functions and the corresponding queries
which will perform the following operations:
(a) To display the string “information technology” in capital
letters.
(b) To remove spaces from the beginning and end of a string,
“ Informatics ”.
(c) To display the name of the day, e.g., Friday or Sunday
from your date of birth, dob.
(d) To round off 67.583 upto 2 decimal places.
1
Create a Series object from a dictionary of values and ndarray.
PROGRAM
OUTPUT
2
Create a Series object using NumPy library functions containing 6 multiples of 12.
PROGRAM
OUTPUT
3
Create a series object S1. Sort the values in descending order and store it in S2, sort
in ascending order and store the output in S3. Store the square of S1 and store it in
S4. Display the values which are greater than 20 & then store in S5. Print all the
series object.
PROGRAM
OUTPUT
4
Create two Series objects and add them.
PROGRAM
OUTPUT
5
Create a Series object that prints all the elements above the 75th percentile.
PROGRAM
OUTPUT
6
Create a Series object using NumPy library that contains four numbers between 8
and 9 and print all its attributes.
PROGRAM
OUTPUT
7
Create a DataFrame containing Product details using list of dictionaries method.
Print its size and shape.
PROGRAM
OUTPUT
8
Create a DataFrame for examination result and display row labels, column labels,
data types of each column and the dimensions of the DataFrame.
PROGRAM
OUTPUT
9
Create a DataFrame containing Airline details from dictionary of Series method
having 8 rows and 4 columns. Write the command to print the first five and last five
rows.
PROGRAM
OUTPUT
10
Create a DataFrame having Employee details with columns as EmpID, EmpName
and Salary with 4 values each and print the DataFrame. Write the statement to add
a new column ‘Department’ and two more rows. Print the final DataFrame.
PROGRAM
OUTPUT
11
Write a program to create a line graph between two tuples X and Y where – X=
(16,12,23,8,39) Y= (17,89,38,46,12) Set the linecolor as yellow, linewidth as 6,
linestyle as dashdot. Show the grid and set the figuresize as (10,6)
PROGRAM
OUTPUT
12
For the below given data, create a cumulative histogram with 6 bins. Give
appropriate axis labels and graph title – X = [18, 18, 21,22, 23, 24,
28,29,29,36,38,39,39,41,52,52,55,61,63,63]
PROGRAM
OUTPUT
13
Write a program to create the below given DataFrame – Also, write the statement to
plot a bar graph between Name and Score. Set bar width as 0.6 uniformly with
different bar colors. Give appropriate axis labels and graph title for the plot.
PROGRAM
OUTPUT
14
Consider the school result data, analyze the performance of the students on different
parameters, example – subject-wise, class-wise etc. Create appropriate DataFrames
and plot appropriate charts with title and legend.
PROGRAM
OUTPUT
15
Take data of your interest from an open source (www.data.gov.in), aggregate and
summarize it. Plot the data using different plotting functions of the matplotlib
library.
PROGRAM
OUTPUT
16
A company has given the details of its sales in South and North region for 1st
quarter of financial year. Create the DataFrame for the same and present the data in
a bar graph
PROGRAM
OUTPUT
17
Create a Student table with the StudentId, Name, and marks as attributes where the
StudentId is the primary key.
PROGRAM
18
Insert 10 rows in the above made Student table.
PROGRAM
19
Delete the details of a student in the above table for those who have scored less than
50 marks using appropriate SQL commands.
20
Write the SQL command to display the details of the students with marks more than
80.
PROGRAM
21
Write the SQL command to update the marks of the students by adding 5 to all the
marks.
PROGRAM
22
Write the SQL command to display the names of the students whose names are
starting with ‘R’.
PROGRAM
23
Write the SQL command to find the min, max, sum, and average of the marks in a
student marks table.
PROGRAM
24
Write a SQL query to order the (student ID, marks) table in descending order of the
marks.
PROGRAM
25
Write the SQL query to create a table Customer with CustomerID, CustomerName
and Country as the fields and insert 8 rows.
PROGRAM
26
Write the SQL query to find the total number of customers from each country in the
table (customer ID, customer Name, country) using group by.
PROGRAM
27
Q27. Write the SQL query to create two tables SName – with fields StudentId and
Name and SDOB with fields SID and DOB. Insert 5 records in both the table.
PROGRAM
28
Alter the table SDOB by setting SID as foreign key.
PROGRAM
29
Write the SQL functions and the corresponding queries which will perform the
following operations:
PROGRAM
(a) To display the string “information technology” in capital letters.
(b) To remove spaces from the beginning and end of a string, “ Informatics ”.
(c) To display the name of the day, e.g., Friday or Sunday from your date of birth,
dob.