Practical File Informatics Practices (2024-2025)
Practical File Informatics Practices (2024-2025)
SESSION-[2024-25]
CLASS XII
PRACTICAL FILE
SUBMITTED TO SUBMITTED BY
Class:
STUDENT’S NAME: -
XII A
CBSE ROLL NO: -
CERTIFICATE
_________________________ _________________________
__________________ ___________
INDEX
SL TOPIC PAGE DATE TEACHE
R SIGN
N NO
O
10 Create a Pandas Series to access data from it, with position (Slicing
& Indexing).
13 Create a Series and print all the elements that are above the 75th
percentile.
15 Create a Data Frame for Employee Details and Access the elements
using Head () and Tail () Functions.
18 8 Create a Data Frame for Accessing data using loc & iloc (Indexing
using Labels).
22 Create a Data Frame for examination results and display row labels,
column labels data types of each column and the dimensions.
1 Create a student table with the student id, name and marks as
attributes where the student’s id is the primary key.
4 Use the select command to get the details of the students with
marks more than 80 in the above table (Student).
5 Find the Min, Max, Sum and Average of the Marks in the Student
Mark Table.
6 Find the total number of customers from each country in the table
(customer_ID, customer_name, country) using group by.
10 Write a SQL Query to Find the “LENGTH, INSTR” of Book Name and
Convert the Book Name using “LCASE, UCASE”, in the Table (Book
Details).
11 Write a SQL Query to Select the Book Name, using “MID, LEFT,
RIGHT, LTRIM, RTRIM” in the Table (Book No, Book Name, Book
Price).
a) Create a table LIBRARY with the fields given in above table and
assuming data
type of your own.
b) Consider the table LIBRARY. Write the SQL commands for queries
given below:
(i) To decrease the price of “INSPIRED TALKS” by 50.
(ii) To display the BOOKID, BOOKNAME and AUTHOR name of all
records in
descending order of their price.
(iii) Display all the details of the books where name starts with ‘G’ and
ends with ‘I’
in the name.
(iv) Display the book name in lower case along with price rounded off to
nearest
integer.
(v) Display sum of QTY for each type gender wise.
15 Based on the table given below, write SQL queries for the following:
WATCH WATCH_NAM PRICE TYPE QTY
ID E
W001 GOLDENTIME 25000. GENTS NULL
00
W002 LIFETIME 8500.50 LADIE 225
S
W003 HIGHFASHION NULL UNISE 550
X
W004 HIGHTIME 10000.0 UNISE 100
0 X
W005 LIFETIME 15000.7 LADIE NULL
5 S
a) Create a table Watches with the fields given in above table and
assuming data type
of your own.
b) i. Display number of minimum and maximum price.
ii. Display minimum price.
iii. Display total price for each type.
c) i. select count (*) from watches.
ii. select count(price), count(type), avg(qty) from watches.
16
Mod_No System Company
38IC Convection IFB
30IG Grill IFB
25LC Convection LG
Consider the table OVEN and CUSTOMER given below:
a) Create the above tables with the concept of foreign key. (OVEN: -
PARENT
TABLE & CUSTOMER: - CHILD TABLE)
b) With reference to these tables, write commands in SQL for (i) and (ii)
and output
for (iii) given below
(i) Display the Model No,Customer and corresponding system for each
customer.
(ii) Display the customer name and city who uses the Grill system.
(iii) Select customer.Mod_No, System from oven,customer
where customer.Mod_No = Oven.Mod_No and city =’Sonepat’;
(iv) Write a query of your choice to show equi- join.
Informatics Practices- Practical Experiments
Pandas Series
Output:
Output:
Program:
import pandas as pd
s1=pd.Series(range(6))
s2=pd.Series(range(1,8,3))
print(s1)
print(s2)
Output:
Output:
Exp:5 Create a Pandas Series for missing values using NaN (Not a Number)
Program:
import pandas as pd
import numpy as np
s=pd.Series(['abc',11.7,57,np.NaN,-34.5])
print(s)
Output:
Program:
import pandas as pd
import numpy as np
ss=np.arange(1,6)
print(ss)
s=pd.Series(index=ss,data=ss*5)
s1=pd.Series(index=ss,data=ss+5)
s2=pd.Series(index=ss,data=ss**3)
s.index.name='SGS'
print(s)
print(s1)
print(s2)
Output:
Exp:7 Write a Pandas Series Program to Perform Some of the Object Attribute
Functions.
Program:
import pandas as pd
data=pd.Series(range(1,14,2),index=[x for x in 'shaurya'])
print(data)
print('Has NaNs: ',data.hasnans)
print('Shape : ',data.shape)
print('Data Type : ',data.dtype)
print('Dimension : ',data.ndim)
print('Index Value : ',data.index)
print('No.of Bytes: ',data.nbytes)
print('Values in Series: ',data.values)
print('Size : ',data.size)
print('SeriesEmpty: ',data.empty)
print('Axis: ',data.axes)
Output:
Exp:8 Create a Pandas Series to perform the Mathematical and Vector Operations
on Series Elements.
Program:
import pandas as pd
s1=pd.Series([172,752,135,174,185])
s2=pd.Series([250,140,258,586,285])
s3=pd.Series([225,856,167,378,242], index=([1,2,3,4,5]))
print('Addition :',s1+s2)
print('Subtraction :',s2-s1)
print('Multiplication :',s1*s2)
print('Division :',s2/s1)
print('Floor Division :',s2//s1)
print('Modules :',s2%s1)
print('Addition :',s1+s3)
print('Vector Multiply:',s1*3)
print('Vector Multiply:',s2+10)
print('Vector Power:',s1**2)
Output:
Exp:9 Create a Pandas Series using Head () and Tail () Functions.
Program:
import pandas as pd
HT=pd.Series([80,100,170,180,190,250,260,300], index=['m','r','s','v','e','r','m','a'])
D=pd.Series({111:1.1,222:22,333:33.,114:44,235:5.5,566:66,877:7.7})
print(HT)
print(HT.head())
print(HT.tail())
print(HT.head(3))
print(HT.tail(2))
print(D)
print(D.head(3))
print(D.tail(2))
Output:
Exp:10 Create a Pandas Series to access data from it, with position (Slicing &
Indexing).
Program:
import pandas as pd
s=pd.Series([101,142,613,684,235],index=['a','b','c','d','e'])
print(s)
print(s[0])
print(s['c'])
print(s[:3])
print(s[-3:])
print(s[1:5])
print(s[2:-2])
Output:
Exp:11 Create a Pandas Series to access elements of series using ‘loc’ and ‘iloc’.
Program:
import pandas as pd
s=pd.Series([101,142,613,684,235],index=['a','b','c','d','e'])
ss=pd.Series(['a1','b2','c3','d4','e5'],index=[1,2,3,4,5])
print(s.iloc[1:4])
print(s.loc['b':'e'])
print(ss.iloc[2:5])
print(ss.iloc[2:-2])
Output:
Exp:12 Create a Pandas Series & Retrieve the Data using Some Conditions.
Program:
import pandas as pd
s=pd.Series([1123,322,3221,4434,4335],index=['a','b','c','d','e'])
ss=pd.Series([10,20,30,40,50],index=[123,232,133,454,564])
print(s<10)
print(ss[ss<30])
print(ss[ss==10])
print(ss[ss>=30])
print(ss[ss!=30])
Output:
Exp :13 Create a Series and print all the elements that are above the 75th
percentile.
Program:
import pandas as pd
import numpy as np
s=pd.Series(np.array([777,170,277,178,979,177,888,333,373,779]))
print(s)
res=s.quantile(q=0.75)
print("\n")
print('75th Percentile of the Series is : ')
print(res)
print("\n")
print('The Elements that are above the 75th Percentile: ')
print(s[s>res])
Output:
Exp:14 Create a Data Frame from Dictionary, Dictionary of Series, ndarray and
also create an Empty Data Frame.
Program:
import pandas as pd
dict1 ={'m':111, 'n':24356, 'o':6553, 'p':'Python'}
dict2 ={'m':55564, 'n':6546, 'o':56457, 'p':55658, 'q':9564.9}
Data = {'first':dict1, 'second':dict2}
df= pd.DataFrame(Data)
print(df)
Dic2 = {'One':pd.Series([1, 3],index=['a','b']), 'Two':pd.Series([3, 4],index=['a','b'])}
dfseries = pd.DataFrame(Dic2)
print(dfseries)
d1 =[[267, 763, 467], [576, 677,7677],[8676,747,55410]]
d2 =[[2546, 564, 46458], [461, 3645, 9356],[1461,1645,1538]]
Data ={'First': d1, 'Second': d2}
df2d = pd.DataFrame(Data)
print(df2d)
dff = pd.DataFrame()
print(dff)
Output:
Exp:15 Create a Data Frame for Employee Details and Access the elements using
Head () and Tail () Functions.
Program:
import pandas as pd
dict1={101:'Kuldeep',102:'virat',103:'mahi',104:'S
Gill',105:'Shriyansh',106:'Shubh',107:"Shaurya",108:'Subhashish'}
dict2 ={101:26, 102:31,103:39,104:38,105:45,106:44,107:34,108:44}
dict3={101:'manager',102:'leader',103:'ProjectHead',104:'Developer',105:'Manager',106:'Tester',107:"
Designer",108:'COE'}
dict4 ={101:17500, 102:27500,103:48500,104:18500,105:45000,106:35000, 107:20500,108:75500}
Data = {'Name':dict1, 'Age':dict2, 'Role':dict3,'Salary':dict4}
df = pd.DataFrame(Data)
print(df,'\n')
df.index.name='Roll_No'
print(df.head(),'\n')
print(df.tail(),'\n')
print(df.head(2),'\n')
print(df.tail(1),'\n')
Output:
Exp:16 Create a Data Frame and Update the Elements using Iteration Function.
Program:
import pandas as pd
names = pd.Series(['Lakshmi', 'Madhu', 'Pranee', 'Manju'])
m1 = pd.Series([96.0, 75.5, 91.0, 65.0])
m2 = pd.Series([96.0, 85.5, 65.0, 85.0])
m3 = pd.Series([96.0, 65.5, 63.0, 65.0])
stud = {'Name': names, 'M1': m1, 'M2': m2, 'M3': m3}
df1 = pd.DataFrame(stud, columns=['Name', 'M1', 'M2', 'M3', 'Total', 'Percentage', 'Grade'])
lstTotal = []
per = []
lstgrade = []
print("\n")
print(df1)
for (row, rowseries) in df1.iterrows():
total = rowseries['M1'] + rowseries['M2'] + rowseries['M3']
lstTotal.append(total)
per.append(total // 3)
df1['Total'] = lstTotal
df1['Percentage'] = per
print("\n")
for (col, colseries) in df1.items():
length = len(colseries)
if col == 'Percentage':
lstgrade = []
for row in range(length):
mrks = colseries[row]
if mrks >= 90:
lstgrade.append('A+')
elif mrks >= 70:
lstgrade.append('A')
elif mrks >= 60:
lstgrade.append('B')
elif mrks >= 50:
lstgrade.append('C')
elif mrks >= 40:
lstgrade.append('D')
else:
lstgrade.append('F')
df1['Grade'] = lstgrade
print('Data Framewith grade added given below')
print(df1)
df1.describe()
Output:
Exp:17 Write a Python Program to Perform following Operations like Add, Select,
Delete & Rename Data in Rows & Columns of Data Frame.
Program:
import pandas as pd
dic = {'A': [120, 111, 122], 'B': [2341, 4422, 2553], 'C':[3451, 3652, 3783]}
df = pd.DataFrame(dic, index=['one', 'two', 'three'])
dc = {'AA': [18670, 1167], 'BB': [27761, 22766], 'CC':[36871, 36882]}
df2 = pd.DataFrame(dc)
print("Dictionary1:\n", df)
print("Dictionary2:\n", df2)
dfir = df2.rename(index={0: 7})
print("Rename the Dictionary 2 Row:\n", dfir)
dfcr = df.rename(columns={'B': 5})
print("Rename the Dictionary 1 Column:\n", dfcr)
df['D'] = [41, 42, 43]
print("Add a Column to Dictionary 1 :\n", df)
df.insert(2, 'E', [51, 52, 53], True)
print("Add a Column to Dictionary1 at Position:\n",df)
newrow = pd.Series(data={'AA': 15, 'BB': 25})
ar = df2._append(newrow, ignore_index=True)
print("Add Row to Dictionary1:\n", ar)
dic = {'A': [10, 11, 12], 'B': [21, 22, 23], 'C': [31, 32, 33]}
df = pd.DataFrame(dic, index=['one', 'two', 'three'])
dc = {'AA': [10, 11], 'BB': [21, 22], 'CC': [31, 32]}
df2 = pd.DataFrame(dc)
de = df.drop(columns=['C'])
print("Delete Column C from Dictionary1:\n", de)
de2 = df2.drop([0])
print("Delete Row [0] from Dictionary2:\n", de2)
print("Select Columns [AA] from Dictionary2:\n", df2['AA'])
print("Select Row [0] from Dictionary1:\n",df.iloc[0])
Output:
Exp:18 Create a Data Frame for Accessing data using loc & iloc (Indexing
using Labels).
Program:
import pandas as pd
cols = ['Red','aqua','black','Yellow','pink']
cont = [183,152,202,226,122]
price = [1220,1120,1235,1520,2290]
datas={'Colors':cols,'Count':cont,'Price':price}
df1 = pd.DataFrame(datas,index=['Apple','Grapes','Banana','Mango','Orange'])
print(df1)
print("Indexing usingSlicing")
print(df1.loc['Apple',:])
print(df1[df1['Count']>25])
print((df1['Price']>100).all())
print(df1.loc[['Banana'],['Colors','Price']])
print(df1.loc['Grapes':'Mango',['Count']])
print(df1.iloc[0:3])
print(df1.iloc[[1,3]])
print(df1.iloc[2:3,0:1])
Output:
Exp:19 Create Data Frames to perform Concatenation, Merge & Join Indexing.
Program:
import pandas as pd
print("Concatenation Indexing")
print("="*30)
adf1 = pd.DataFrame({'Name':['Shaurya Verma','Shriyansh Dev'],'Age':[35,26]},index=[11,2])
adf2 = pd.DataFrame({'Name':['Priyanka','Rakesh'],'Age':[30,32]},index=[13,14])
act=adf1._append(adf2)
print(act,"\n")
dfc= pd.DataFrame({'Name':['Shaurya Verma','Shriyansh Dev'],'Age':[35,26]})
dfc2 = pd.DataFrame({'Name':['Priyanka','Rakesh'],'Age':[30,32],10:[55,99]})
cdf=pd.concat([dfc,dfc2])
print(cdf)
print("Merge Indexing")
dd = pd.DataFrame({'Name':['VKL','MHSD','SUR'],'Age':[21,47,66],'ID':[27,33,24]})
ee = pd.DataFrame({'Name':['VKL','MHSD','SUR'],'Age':[21,47,66],'Salary':[27000,33000,24000]})
f=pd.merge(dd,ee)
print(f,"\n")
ba = pd.DataFrame({'Name':['Cat','LION'],'Dno':[12,10],'UID':[16,18]})
dc=pd.DataFrame({'Name':['Cat','goat'],'Age':[58,96],'MSalary':[700450,3004540]})
ee=pd.merge(ba,dc,how='right',on='Name')
print(ee,"\n")
print("Join Indexing")
xx=pd.DataFrame({'Name': ["Ramlak","abhyanshu","yuvraj","Raja"],'Degree':
["B.E","BCA","B.Tech","MBBS"]})
yy=pd.DataFrame({'Degree2':["M.E","MCA","M.Tech","P.hD"],'Score':[80,85,82,78]})
zz=xx.join(yy)
print(zz,"\n")
xix=pd.DataFrame({'Name': ["Sammy","Ravi","Raop","Samyra"],'Degree':
["B.E","BCA","B.Tech","MBBS"],'Key':[11,22,88,99]})
yiy=pd.DataFrame({'Degree2':["M.E","MCA","M.Tech","P.hD"],'Score':[80,85,82,78]}
,index=[11,55,66,77])
ziz=xix.join(yiy,on='Key')
print(ziz,"\n")
x=pd.DataFrame({'Name': ["Priyanka","Rakesh","Rahul","Samyra"],'Degree':["B.E","BCA",
"B.Tech","MBBS"]},index=[11,22,33,44])
y=pd.DataFrame({'Degree2': ["M.E","MCA","M.Tech","P.hD"],'Score':[80,85,82,78]},
index=[11,55,66,77])
z=x.join(y,how='outer')
print(z,"\n")
xi=pd.DataFrame({'Name':["Priyanka","Rakesh","Rahul","Samyra"],'Degree':["B.E",
"BCA","B.Tech","MBBS"]},index=[11,22,33,44])
yi=pd.DataFrame({'Degree2':["M.E","MCA","M.Tech","P.hD"],'Score':[80,85,82,78]},
index=[11,55,66,77])
zi=xi.join(yi,how='inner')
print(zi,"\n")
Output:
Exp:20 Create a program for Importing and Exporting Data between Pandas and
CSV File.
Program:
import pandas as pd
print("\n")
Name=['Mahi','Yuvi','Kohli','Rohit','ABD']
Degree=['B.E','MBA','M.Tech','MBBS','M.E']
Score = [490, 488, 492, 496, 482]
dict={'Name':Name,'Degree':Degree,'Score':Score}
df=pd.DataFrame(dict)
print(" TheFile 'Exp.CSV‘is Created(Imported)")
df.to_csv('Exp.csv')
print("\n")
df2=pd.read_csv('Exp2.csv')
print("\n")
print(" TheFileContent of 'Exp2.csv' is Received(Readed)", '\n')
df2.index.name='Index_No'
print(df2)
Output:
Exp:21 Create a Data Frame Quarterly Sales where each row contains the item
category, item name, and expenditure. Group the rows by the category and
print the total expenditure per category.
Program:
import pandas as pd
d={'ItemCategory':['phone', 'tablet', 'DSLR Camera', 'Earbuds', 'Smart Watch', 'DSLRCamera',
'phone', 'tablet', 'Mobile'],'ItemName':['micromax', 'HP', 'Cannon', 'Sony','Apple', 'Nikon',
'iPhone', 'Dell', 'Oppo'], 'Expenditure': [5000,1000,750,1200,1800,6600,6500,9000,4000]}
df=pd.DataFrame(d)
print(df)
QS=df.groupby('ItemCategory')
print('DataFrameAfter Grouping \n')
print(QS['Expenditure'].sum())
print("\n")
Output:
Exp:22 Create a Data Frame for examination results and display row labels,
column labels data types of each column and the dimensions.
Program:
import pandas as pd
import numpy as np
TNS=np.array([20000,18000,17500,18800,19600,18000,18100,19100,17800,18000,20000,20000])
TNSP=np.array([2000,1800,1740,1860,1960,1800,1800,1910,1780,1800,1990,2000])
PP=TNSP/TNS
d={'Class':
['I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII'],'Total_No.of_Stud_Appear':
[20000,18000,17500,18800,19600,18000,18100,19100,17800,18000,20000, 20000], 'Total_No.of_Stud_Pass':
[2000,1800,1740,1860,1960,1800,1800,1910,1780,1800,1990,2000], 'Pass_%':PP*100}
Result=pd.DataFrame(d)
print(Result)
print(Result.dtypes)
print('Shapes oftheDataFrame is: ')
print(Result.shape)
Output:
Exp:23 Filter Out the Rows Based on different Criteria such as Duplicate Rows.
Program:
import pandas as pd
d={'Name':['Abhyanshu','Subhashish','Sehwag','Subhman','Shriyansh','Tendulkar',
'Kohli','Gambhir','Shaurya', 'Dravid'],'Highest_Score_ODI':
[264,183,209,183,150,209,224,183,200,183],'ODI Total_ Score':
[9115,10773,9115,11363,8701,9115,10773,11867,18426,11867]}
Result=pd.DataFrame(d)
DR=Result[Result.duplicated(keep=False)]
print(Result)
print('\n')
print(DR)
Output:
Data Visualization
Exp:24 Write a Python Program to plot Line Chart for Salary Hike of an Employee.
Program:
import matplotlib.pyplot as pl
Year = [2000,2004,2005,2006,2008,2010,2012,2014,2015,2016,2018,2020]
Salary= [10000,14000,18000,20000,24000,28000,30000,34000,38000,40000,44000,48000]
pl.plot(Year,Salary,label= 'Salary',)
pl.xlabel('Years')
pl.ylabel ('Salary')
pl.title('Salary Hike of an Employee', fontsize=20)
pl.legend(loc='lower right')
pl.show()
Output:
Exp:25 Write a Python Program to plot the Pass Percentage of the Year 2019 &
2020, Classes 6th to 12th using Line Chart.
Program:
import matplotlib.pyplot as pl
Class2019=[6,7,8,9,10,11,12]
PP2019=[98,98,98,90,98,86,98]
pl.plot(Class2019,PP2019,label= 'Year 2019',)
Class2020=[6,7,8,9,10,11,12]
PP2020=[100,100,100,96,100,92,100]
pl.plot(Class2020, PP2020, label= 'Year 2020')
pl.xlabel ('Class Name in Number',fontsize=16)
pl.ylabel ('Pass Percentage %',fontsize=16)
pl.title('Pass Percentage of the Years 2019 & 2020',fontsize=20)
pl.legend(title='Pass% IN')
pl.show()
Output:
Exp:26 Write a Python Program to plot Line Chart using some Random
Value.
Program:
import matplotlib.pyplot as pl
import numpy as np
RV=np.arange(1,20,1)
LV=np.log(RV)
SV=np.sin(RV)
CV=np.cos(RV)
pl.plot(LV,label='Logarithm Value')
pl.plot(SV,label='Sine Value')
pl.plot(CV,label='Cosine Value')
pl.xlabel("Random Values")
pl.ylabel("Logarithm, Sine & Cosine Values")
pl.title('LineChart usingRandom Values')
pl.legend(loc='best')
pl.show()
Output:
Exp:27 Write a Python Program to display a Histogram Graph for BloodSugar
Values based on No. of Patients.
Program:
import matplotlib.pyplot as pl
BloodSugar=[115,86,90,150,147,88,93,115,135,80,77,82,129]
pl.title("BloodSugar Value & No.of.Patients")
pl.xlabel("BloodSugar Value ")
pl.ylabel("No.Of.Patients")
pl.hist(BloodSugar,bins=[75,100,125,150])
pl.legend(['Men'],title="Histogram",loc='upper right')
pl.show()
Output:
Exp:28 Given the school result data, analyses the performance of the students on
different parameters, e.g. subject wise or class wise.
Program:
import matplotlib.pyplot as pl
Subject=['Maths','Phy.','Chem.','Bio.','C.Sc.','English','Tamil','Hindi']
Class=['XI','XII']
Sub_Percentage=[86,84,78,86,94,87,90,88]
Class_Percentage=[90,100]
pl.bar(Subject,Sub_Percentage,align='center')
pl.bar(Class,Class_Percentage)
pl.xlabel('Subject & Class Names', fontsize=18)
pl.ylabel('Pass Percentage', fontsize=18)
pl.title('Student Result Analysis',fontsize=22)
pl.show()
Output:
Exp:29 For the Data Frames created above, analyse and plot appropriate charts
with title and legend.
Program:
import matplotlib.pyplot as pl
import numpy as np
Subject=['Maths','Sci.','Social','English','T/H']
UT1_Percentage=[56,54,40,50,55]
UT2_Percentage=[62,60,42,55,60]
UT3_Percentage=[50,60,40,54,65]
MT1_Percentage=[66,63,41,55,50]
l=np.arange(len(Subject))
pl.bar(l,UT1_Percentage,width=.25,label='UT1')
pl.bar(l+.25,UT2_Percentage,width=.25,label='UT2')
pl.bar(l+.50,UT3_Percentage,width=.25,label='UT3')
pl.bar(l+.75,MT1_Percentage,width=.20,label='MT1')
pl.xticks(l,Subject)
pl.xlabel('Test Names', fontsize=18)
pl.ylabel('Test Pass Percentage', fontsize=18)
pl.title('StudentResult Analysis',fontsize=22)
pl.legend(title="TestNames",loc='best')
pl.show()
Output:
Exp:30 Take Data of your interest from an open source (e.g. data.gov.in),
aggregate and summarize it. Then plot it using different plotting functions of the
Matplotlib Library.
Program:
Import pandas as pd
import matplotlib.pyplot as pl
cf=pd.read_csv("Cricket.csv")
print(cf,'\n')
s=(cf['Team'].head(12))
s2=(cf['Salary'].head(12))
pl.bar(s,s2)
pl.xlabel('Name of theTeam', fontsize=18)
pl.ylabel('Salary Range', fontsize=18)
pl.title('Aggregated and Summarized Data',fontsize=22)
pl.legend('Salary', loc='best')
pl.show()
Output:
Database Management
Exp:1 Create a student table with the student id, name and marks as attributes
where the student’s id is the primary key.
Program:
Output:
Exp:2 Insert the details of a new student in the above table (Student).
Program:
Output:
Exp:.3 Delete the details of a student in the above table (Student).
Program:
Output:
Exp:4. Use the select command to get the details of the students with marks
more than 80 in the above table (Student).
Program:
Output:
Exp:5 Find the Min, Max, Sum and Average of the Marks in the Student Mark
Table.
Program:
Output:
Exp:6 Find the total number of customers from each country in the table
(customer_ID, customer_name, country) using group by.
Program:
Output:
Exp:7 Write a SQL command to Order the (Student ID, Marks) table of marks in
descending order.
Program:
Output:
Exp:8 Find the Record which having the Customer Name ‘bravo’, from each
country in the table (customer id, customer name, country) using group by &
having function.
Program:
Output:
Exp:9 Write a SQL Query to Find the “POWER, MOD” of Marks and “ROUND” of
the Percentage in the Table (Name, Marks, Percentage).
Program:
Output:
Exp:10 Write a SQL Query to Find the “LENGTH, INSTR” of Book Name and
Convert the Book Name using “LCASE, UCASE”, in the Table (Book
Details).
Program:
Output:
Exp:11 Write a SQL Query to Select the Book Name, using “MID, LEFT, RIGHT,
LTRIM, RTRIM” in the Table (Book No, Book Name, Book Price).
Program:
Output:
Program:
Output:
Exp:13 Write a SQL Query to Return the “NOW, DAYNAME,
MONTHNAME” of Start Date in the Table (Use the table Loan_Account)
Program:
Output:
Exp.14
1. Create a table LIBRARY with the fields given in above table and assuming
data type of your own.
Program:
Output:
2. Consider the table LIBRARY. Write the SQL commands for queries given
below:
i. To decrease the price of “INSPIRED TALKS” by 50.
Program:
Output:
ii. To display the BOOKID, BOOKNAME and AUTHOR name of all records in
descending order of their price.
Program:
Output:
iii. Display all the details of the books where name starts with ‘G’ and ends
with ‘I’ in the name.
Program:
Output:
iv. Display the book name in lower case along with price rounded off to
nearest integer.
Program:
Output:
v. Display sum of QTY for each type gender wise.
Program:
Output:
Program:
Output:
2. Consider the table WATCHES. Write the SQL commands for queries given
below:
i. Display number of minimum and maximum price.
Program:
Output:
Program:
Output:
Program:
Output:
OVEN
CUSTOMER
Program:
Output:
2. With reference to these tables, write commands in SQL for (i) and (ii) and
output for (iii) given below
i. Display the Model No, Customer and corresponding system for each
customer.
Program:
Output:
ii. Display the customer name and city who uses the Grill system.
Program:
Output:
Output:
Program:
Output: