Societal situations, Series/DataFrame code, SQL queries with functions, output of SQL functions
D
Q33, Q34
4
8
Matplotlib program, SQL with GROUP BY, HAVING and two tables
E
Q35 to Q37
5
15
Network case study, DataFrame program, SQL commands in five parts
Unit-wise marks in the theory paper
25Pandas + Charts
25SQL
10Networks
10Societal
Blueprint of the paper
One common blueprint, as per the CBSE Sample Question Paper 2026-27. All twenty practice papers of this kit follow it. Each cell shows the number of questions, with their marks in brackets.
Unit and topic
Sec A1 mark each1 m
Sec B2 marks each2 m
Sec C3 marks each3 m
Sec D4 marks each4 m
Sec E5 marks each5 m
Totalmarks
Unit 1Pandas: Series, DataFrame, CSV
6 (6)
2 (4)
1 (3)
-
1 (5)
18
Unit 1Data Visualization (Matplotlib)
1 (1)
1 (2)
-
1 (4)
-
7
Unit 2SQL: functions, GROUP BY, join, commands
8 (8)
1 (2)
2 (6)
1 (4)
1 (5)
25
Unit 3Computer Networks
3 (3)
1 (2)
-
-
1 (5)
10
Unit 4Societal Impacts
3 (3)
2 (4)
1 (3)
-
-
10
Total
21 (21)
7 (14)
4 (12)
2 (8)
3 (15)
70
A to E are the sections; 1 m means 1 mark each. Unit 1 = 18 + 7 = 25 marks. The downloaded blueprint also has the question-wise plan from Q1 to Q37.
The fixed slots: 35 marks you can predict
In the CBSE Sample Paper 2026-27, these question numbers carry these topics. Prepare one model answer for each slot.
Q29Societal: 3 situations3 marks
Q30Series or DataFrame code3 marks
Q31SQL queries with functions3 marks
Q32Output of SQL functions3 marks
Q33Matplotlib chart program4 marks
Q34GROUP BY, HAVING, join4 marks
Q35Network case study5 marks
Q36DataFrame program5 marks
Q37SQL commands, 5 parts5 marks
Internal choice (OR) is given in seven questions: Q22, Q25, Q28, Q30, Q32, Q34 and Q37.
Practical: 30 marks
8Pandas + charts
7SQL queries
5File
5Project
5Viva
2
Pass plan in three steps
Where the 70 marks come from, easiest first
Marks come fastest from the questions that follow a fixed model. Climb the ladder one step at a time.
Step 1 · 23 marksSocietal Impacts (10) + Networks (10) + data visualization short answer and one-markers (3). Mostly definitions, differences and the case study. Learn the tables in sections 8 and 9.
Step 2 · 20 marks moreSQL functions and queries: the three function families, GROUP BY and HAVING, equi-join, and the five commands INSERT, UPDATE, DELETE, ALTER, DROP.
Step 3 · 17 marks morePandas programs: create a Series and a DataFrame, add or remove rows and columns, head and tail, CSV, and one Matplotlib program.
Marks milne wali baat
Write import pandas as pd and import matplotlib.pyplot as plt at the top of every program.
In SQL output questions, write the column heading also.
In the case study, give the reason with every answer.
Common mistake
axis=0 is row, axis=1 is column. Do not mix them.
loc includes the end label; iloc leaves the stop out.
HAVING is for groups; WHERE is for rows.
In SQL functions, counting of characters starts from 1, not 0.
3
Pandas Series
Unit 1 · one-dimensional labelled data
Pandas is a Python library for working with data in rows and columns. It gives two data structures: the Series (one column of data) and the DataFrame (a full table).
import pandas as pd
Picture: a Series is one column with labels
A Series has two parts: the index (labels) and the values. If you do not give labels, Pandas gives 0, 1, 2 ...
S = pd.Series([50, 20, 40, 10], index=['a', 'b', 'c', 'd'])
a500
b201
c402
d103
Top: labels. Middle: values. Bottom: positions.
In daily life: A marks list: the names of the students are the labels and the marks are the values.
Four ways to create a Series
From
Statement
What you get
a list
pd.Series([10, 20, 30])
index 0, 1, 2
a list with labels
pd.Series([10, 20], index=['a', 'b'])
index 'a', 'b'
a dictionary
pd.Series({'Jan': 31, 'Feb': 28})
keys become the index
one value
pd.Series(5, index=[0, 1, 2])
the value is repeated for every label
a NumPy array
pd.Series(np.array([1, 2, 3]))
index 0, 1, 2
Picture: slicing by position and slicing by label
S[1:3] takes positions 1 and 2. Position 3 is left out.
a500
b201
c402
d103
S['b':'d'] takes the labels b, c and d. The end label is included.
a500
b201
c402
d103
In daily life: Positions work like house numbers on one side of a lane: stop before the last number. Labels work like names: from Bela to Devi means Devi also.
Pandas first matches the labels. A label that is in only one Series gets NaN (missing value).
S1
a10
b20
c30
d
S2
a
b5
c5
d5
S1 + S2
aNaN
b25.0
c35.0
dNaN
In daily life: Two shopkeepers add their stock lists. An item kept by only one of them cannot be added, so its total is left blank.
Series functions with examples
Every card has three examples. The line after >>> is what you type; the green lines are what Python shows. All the examples start from these two Series:
S = pd.Series([50, 20, 40, 10], index=['a', 'b', 'c', 'd'])
T = pd.Series([1, 2, 3], index=['b', 'c', 'e'])
Series: create, select, slice and calculate12 functions · 3 examples each
pd.Series(data, index)makes a Series from a list, a dictionary or one value
>>> pd.Series([5, 10, 15])
0 5
1 10
2 15
dtype: int64>>> pd.Series({'Jan': 31, 'Feb': 28})
Jan 31
Feb 28
dtype: int64>>> pd.Series(7, index=['x', 'y', 'z'])
x 7
y 7
z 7
dtype: int64
S.head(n)first n elements (5 if n is not given)
>>> S.head(2)
a 50
b 20
dtype: int64>>> S.head(1)
a 50
dtype: int64>>> S.head()
a 50
b 20
c 40
d 10
dtype: int64
S.tail(n)last n elements (5 if n is not given)
>>> S.tail(2)
c 40
d 10
dtype: int64>>> S.tail(1)
d 10
dtype: int64>>> S.tail(3)
b 20
c 40
d 10
dtype: int64
S.size, len(S), S.count()number of elements; count() leaves out NaN
>>> S.size
4>>> len(S)
4>>> (S + T).count()
2
S[label], S.loc[], S.iloc[]one element by its label or by its position
>>> S['c']
40>>> S.loc['a']
50>>> S.iloc[3]
10
S[start:stop]slice: positions leave out the stop, labels include the end
>>> S[1:3]
b 20
c 40
dtype: int64>>> S['b':'d']
b 20
c 40
d 10
dtype: int64>>> S[:2]
a 50
b 20
dtype: int64
S[condition]Boolean indexing: keeps the elements where the condition is True
>>> S > 20
a True
b False
c True
d False
dtype: bool>>> S[S > 20]
a 50
c 40
dtype: int64>>> S[S == 10]
d 10
dtype: int64
S + n, S * narithmetic on every element
>>> S + 5
a 55
b 25
c 45
d 15
dtype: int64>>> S * 2
a 100
b 40
c 80
d 20
dtype: int64>>> S // 10
a 5
b 2
c 4
d 1
dtype: int64
S + Ttwo Series are matched label by label
>>> S + T
a NaN
b 21.0
c 42.0
d NaN
e NaN
dtype: float64>>> S * T
a NaN
b 20.0
c 80.0
d NaN
e NaN
dtype: float64>>> S.add(T, fill_value=0)
a 50.0
b 21.0
c 42.0
d 10.0
e 3.0
dtype: float64
S.max(), S.min(), S.sum()largest, smallest and total
>>> S.max()
50>>> S.min()
10>>> S.sum()
120
Changing a Seriesvalues and labels can be changed; the size cannot
>>> S['a'] = 99
>>> S
a 99
b 20
c 40
d 10
dtype: int64>>> S.index = ['w', 'x', 'y', 'z']
>>> S
w 50
x 20
y 40
z 10
dtype: int64>>> S[1:3] = 0
>>> S
a 50
b 0
c 0
d 10
dtype: int64
Remember
head() and tail() give 5 elements when no number is written.
A condition such as S > 20 gives True/False for every element. Put it inside S[ ] to pick the elements.
When NaN comes in the answer, the data type becomes float: 25 is shown as 25.0.
Common mistake
S.size is written without brackets. S.count() has brackets.
S[1:3] gives two elements, not three.
Writing S1 + S2 does not join the two Series one after the other. It adds the values label by label.
4
Pandas DataFrame
Unit 1 · two-dimensional labelled data
A DataFrame is a table: it has rows and columns, and both have labels. Each column is a Series, and different columns can hold different types of data.
Picture: the parts of a DataFrame
A DataFrame has row labels (index), column labels (columns) and values. Each column is a Series.
In daily life: A class register: the roll numbers are the row labels, the subject names are the column labels.
Ways to create a DataFrame
import pandas as pd
# 1. from a dictionary of lists: keys become the column labels
df = pd.DataFrame({'Name': ['Asha', 'Ravi', 'Tina'],
'Eng': [78, 65, 91],
'Maths': [88, 72, 95]},
index=['R1', 'R2', 'R3'])
# 2. from a list of dictionaries: each dictionary is one row
df2 = pd.DataFrame([{'Name': 'Asha', 'Eng': 78}, {'Name': 'Ravi'}]) # Eng of Ravi becomes NaN
# 3. from a dictionary of Series
df3 = pd.DataFrame({'Eng': pd.Series([78, 65], index=['R1', 'R2']),
'Maths': pd.Series([88, 72], index=['R1', 'R2'])})
# 4. from a CSV file
df4 = pd.read_csv('marks.csv')
Rows and columns: add, select, delete
Work
On a column
On a row
Select
df['Eng']
df.loc['R2'] or df.iloc[1]
Add
df['Total'] = df['Eng'] + df['Maths']
df.loc['R4'] = ['Om', 54, 61]
Delete
df = df.drop('Eng', axis=1) or del df['Eng']
df = df.drop('R2', axis=0)
Rename
df = df.rename(columns={'Eng': 'English'})
df = df.rename(index={'R1': 'A1'})
loc: by labels
df.loc['R1':'R2', 'Eng']
Row labels R1 to R2 (both included), column Eng.
iloc: by positions
df.iloc[0:2, 1]
Row positions 0 and 1 (2 is left out), column position 1.
DataFrame: create, look at, select and change13 functions · 3 examples each
pd.DataFrame(data)makes a DataFrame from a dictionary of lists, a list of dictionaries or a dictionary of Series
>>> pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
A B
0 1 3
1 2 4>>> pd.DataFrame([{'A': 1, 'B': 3}, {'A': 2}])
A B
0 1 3.0
1 2 NaN>>> pd.DataFrame({'A': pd.Series([1, 2], index=['x', 'y'])})
A
x 1
y 2
df.shape, df.size, df.ndimrows and columns, number of values, number of dimensions
>>> df.shape
(3, 3)>>> df.size
9>>> df.ndim
2
df.columns, df.index, df.dtypescolumn labels, row labels and data types
>>> list(df.columns)
['Name', 'Eng', 'Maths']>>> list(df.index)
['R1', 'R2', 'R3']>>> df.dtypes
Name object
Eng int64
Maths int64
dtype: object
df.head(n), df.tail(n)first or last n rows
>>> df.head(2)
Name Eng Maths
R1 Asha 78 88
R2 Ravi 65 72>>> df.tail(1)
Name Eng Maths
R3 Tina 91 95>>> df.head(1)
Name Eng Maths
R1 Asha 78 88
df['col']one column (a Series) or a list of columns (a DataFrame)
>>> df['Eng']
R1 78
R2 65
R3 91
Name: Eng, dtype: int64>>> df[['Name', 'Maths']]
Name Maths
R1 Asha 88
R2 Ravi 72
R3 Tina 95>>> df['Eng'].max()
91
df.loc[row, col]selects by labels; the end label is included
>>> df.loc['R2']
Name Ravi
Eng 65
Maths 72
Name: R2, dtype: object>>> df.loc['R1':'R2', 'Eng']
R1 78
R2 65
Name: Eng, dtype: int64>>> df.loc['R3', 'Name']
'Tina'
df.iloc[row, col]selects by positions; the stop is left out
>>> df.iloc[0]
Name Asha
Eng 78
Maths 88
Name: R1, dtype: object>>> df.iloc[0:2, 1:3]
Eng Maths
R1 78 88
R2 65 72>>> df.iloc[2, 0]
'Tina'
df[condition]Boolean indexing: the rows where the condition is True
>>> df[df['Eng'] > 70]
Name Eng Maths
R1 Asha 78 88
R3 Tina 91 95>>> df[df['Name'] == 'Ravi']
Name Eng Maths
R2 Ravi 65 72>>> df[df['Maths'] >= 90]['Name']
R3 Tina
Name: Name, dtype: object
df['new'] = ...adds a column (or changes it, if it is already there)
>>> df['Total'] = df['Eng'] + df['Maths']
>>> df
Name Eng Maths Total
R1 Asha 78 88 166
R2 Ravi 65 72 137
R3 Tina 91 95 186>>> df['Sec'] = 'A'
>>> df
Name Eng Maths Sec
R1 Asha 78 88 A
R2 Ravi 65 72 A
R3 Tina 91 95 A>>> df['Sci'] = [80, 60, 99]
>>> df
Name Eng Maths Sci
R1 Asha 78 88 80
R2 Ravi 65 72 60
R3 Tina 91 95 99
df.loc['label'] = [...]adds a row (or changes it, if the label is already there)
>>> df.loc['R4'] = ['Om', 54, 61]
>>> df
Name Eng Maths
R1 Asha 78 88
R2 Ravi 65 72
R3 Tina 91 95
R4 Om 54 61>>> df.loc['R2'] = ['Ravi', 70, 75]
>>> df
Name Eng Maths
R1 Asha 78 88
R2 Ravi 70 75
R3 Tina 91 95>>> df.loc['R4'] = ['Om', 54, 61]
>>> df.shape
(4, 3)
df.drop(label, axis)returns a copy without the row (axis=0) or the column (axis=1)
>>> df.drop('Eng', axis=1)
Name Maths
R1 Asha 88
R2 Ravi 72
R3 Tina 95>>> df.drop('R2', axis=0)
Name Eng Maths
R1 Asha 78 88
R3 Tina 91 95>>> df.drop(['R1', 'R3'])
Name Eng Maths
R2 Ravi 65 72
df.rename()returns a copy with new column labels or row labels
>>> df.rename(columns={'Eng': 'English'})
Name English Maths
R1 Asha 78 88
R2 Ravi 65 72
R3 Tina 91 95>>> df.rename(index={'R1': 'A1'})
Name Eng Maths
A1 Asha 78 88
R2 Ravi 65 72
R3 Tina 91 95>>> df.rename(columns={'Name': 'Student', 'Maths': 'M'})
Student Eng M
R1 Asha 78 88
R2 Ravi 65 72
R3 Tina 91 95
df.T, len(df)transpose, and the number of rows
>>> df.T
R1 R2 R3
Name Asha Ravi Tina
Eng 78 65 91
Maths 88 72 95>>> len(df)
3>>> len(df.columns)
3
Going through the rows one by one
import pandas as pd
df = pd.DataFrame({'Name': ['Asha', 'Ravi', 'Tina'], 'Eng': [78, 65, 91], 'Maths': [88, 72, 95]}, index=['R1', 'R2', 'R3'])
for i, row in df.iterrows():
print(i, row['Name'], row['Eng'] + row['Maths'])
Output:
R1 Asha 166
R2 Ravi 137
R3 Tina 186
Remember
df.shape is (rows, columns). df.size is rows x columns. len(df) is the number of rows.
A new column needs one value for every row. A new row needs one value for every column.
drop() and rename() give a new DataFrame. Store it back: df = df.drop(...).
Common mistake
df.drop('Eng') without axis=1 looks for a row named Eng and gives an error.
df['R1'] looks for a column named R1. For a row write df.loc['R1'].
df.head without brackets does not show the first five rows.
5
Importing and exporting data: CSV files
Unit 1 · between a CSV file and a DataFrame
A CSV (Comma Separated Values) file is a plain text file. Each line is one row, and the values are separated by commas. It opens in a spreadsheet, in Notepad and in Pandas, so it is the easiest way to move data from one software to another.
Picture: file to DataFrame and back
read_csv() brings the data of a file into a DataFrame. to_csv() writes a DataFrame to a file.
In daily life: Copying the marks from the register (file) to the blackboard (DataFrame), working on them, and writing the result back in the register.
import pandas as pd
df = pd.read_csv('marks2.csv')
print(df)
Output:
Name Eng Maths
0 Asha 78 88
1 Ravi 65 72
2 Tina 91 95
Pandas gives the default row labels 0, 1, 2.
Parameters asked in the paper
Function
Parameter
Use
read_csv()
sep
the separator used in the file, for example sep=';'. The default is a comma.
read_csv()
header=None
the file has no heading line; the first line is data
read_csv()
names=[...]
your own column names
to_csv()
index=False
do not write the row labels
to_csv()
header=False
do not write the column names
to_csv()
sep
write with another separator
6
Data visualization with Matplotlib
Unit 1 · line plot, bar graph and histogram
Data visualization means showing data as a picture: a chart or a graph. A picture shows the highest value, the lowest value and the trend at one look. In Python we use the pyplot module of the Matplotlib library.
import matplotlib.pyplot as plt
Picture: the parts of a chart
In daily life: A chart without a title and axis labels is like a map without place names.
Which chart for which data
Chart
Function
Use it when
Example
Line chart
plt.plot(x, y)
you want to show a change or trend over time
sales of 12 months
Bar chart
plt.bar(x, height) plt.barh(y, width)
you want to compare separate categories
students in four houses
Histogram
plt.hist(data, bins)
you want to see how numeric values are spread over ranges
import matplotlib.pyplot as plt
marks = [35, 42, 48, 55, 58, 61, 64, 66, 70, 72, 75, 78, 81, 85, 92]
plt.hist(marks, bins=[30, 40, 50, 60, 70, 80, 90, 100], edgecolor='black')
plt.title('Marks of 15 Students')
plt.xlabel('Marks')
plt.ylabel('Number of Students')
plt.show()
Two lines with a legend
import matplotlib.pyplot as plt
test = ['UT1', 'UT2', 'UT3', 'UT4']
asha = [32, 35, 30, 38]
ravi = [25, 31, 34, 36]
plt.plot(test, asha, label='Asha')
plt.plot(test, ravi, label='Ravi', linestyle='--')
plt.title('Marks in Unit Tests')
plt.xlabel('Test')
plt.ylabel('Marks')
plt.legend()
plt.savefig('marks.png')
plt.show()
Functions and parameters to remember
Function or parameter
Work
plt.title("...")
heading of the chart
plt.xlabel("..."), plt.ylabel("...")
labels of the X-axis and Y-axis
plt.legend()
shows the key; give label= in every plot()
plt.grid(True)
grid lines
plt.savefig("a.png")
saves the chart as a picture; write it before show()
plt.show()
displays the chart
color
colour: 'r', 'g', 'b', 'k' (black) or a name such as 'orange'
linestyle
'-' solid, '--' dashed, ':' dotted, '-.' dash-dot
linewidth
thickness of the line
marker, markersize
symbol on each point: 'o' circle, '*' star, 's' square, 'D' diamond
width (in bar)
thickness of the bars; default 0.8
bins (in hist)
number of intervals, or the list of interval edges; default 10
edgecolor
colour of the border of bars
Bar chart and histogram: the difference
A bar chart is for categories (names); a histogram is for numbers in ranges.
Bars of a bar chart have gaps; bars of a histogram touch.
In a bar chart you give the heights; in a histogram Python counts the values in each range.
Common mistake
Writing plt.savefig() after plt.show() saves a blank picture.
plt.legend() shows nothing if label is not given in plot().
The two lists given to plot() or bar() must have the same number of values.
7
Database query using SQL
Unit 2 · functions, grouping and two tables
Unit 2 is about asking questions from a table with SQL. Three things are new in Class XII: functions (math, text, date), aggregate functions with GROUP BY, and two tables with equi-join.
Picture: two kinds of functions
A single-row function gives one answer for every row. An aggregate function gives one answer for the whole group.
In daily life: Changing every name on a list to capital letters is single-row work. Finding the topper of the list is aggregate work.
All the examples below use these two tables. Every example starts again from the same data.
Table: student
RNo
Name
City
Marks
Fee
DOB
1
Asha
Delhi
91
5000.50
2009-03-15
2
Ravi
Agra
55
4500.75
2008-11-02
3
Tina
Delhi
78
NULL
2009-07-21
4
Om
Agra
82
5000.50
2008-01-30
5
Zoya
Pune
67
4000.25
2009-12-09
Table: city
City
State
Delhi
Delhi
Agra
Uttar Pradesh
Pune
Maharashtra
Math, text and date functions with examples
Math functions3 functions · 3 examples each
POWER(a, b)a raised to the power b. POW() is the same
SELECT POWER(2, 5);
POWER(2, 5)
32
SELECT POWER(9, 2);
POWER(9, 2)
81
SELECT Name, POWER(Marks, 2) FROM student WHERE RNo = 2;
Name
POWER(Marks, 2)
Ravi
3025
ROUND(x, d)rounds x to d decimal places; no d means a whole number
SELECT ROUND(45.678, 1);
ROUND(45.678, 1)
45.7
SELECT ROUND(45.678);
ROUND(45.678)
46
SELECT ROUND(1256.78, -2);
ROUND(1256.78, -2)
1300
MOD(a, b)the remainder when a is divided by b
SELECT MOD(17, 5);
MOD(17, 5)
2
SELECT MOD(20, 4);
MOD(20, 4)
0
SELECT Name, MOD(Marks, 10) FROM student WHERE City = 'Agra';
Name
MOD(Marks, 10)
Ravi
5
Om
2
Picture: counting characters for MID, LEFT, RIGHT and INSTR
In SQL the first character is at position 1. A space is also a character.
MID('Informatics', 3, 4) starts at position 3 and takes 4 characters: form
1I
2n
3f
4o
5r
6m
7a
8t
9i
10c
11s
LEFT('Informatics', 4) gives Info and RIGHT('Informatics', 3) gives ics
1I
2n
3f
4o
5r
6m
7a
8t
9i
10c
11s
INSTR('Informatics', 'ma') gives 6, the position where ma starts
1I
2n
3f
4o
5r
6m
7a
8t
9i
10c
11s
Text functions10 functions · 3 examples each
UCASE(text) / UPPER(text)changes to capital letters
SELECT UCASE('kvs');
UCASE("kvs")
KVS
SELECT UPPER('New Delhi');
UPPER("New Delhi")
NEW DELHI
SELECT UCASE(Name) FROM student WHERE City = 'Delhi';
UCASE(Name)
ASHA
TINA
LCASE(text) / LOWER(text)changes to small letters
SELECT LCASE('CBSE');
LCASE("CBSE")
cbse
SELECT LOWER('New Delhi');
LOWER("New Delhi")
new delhi
SELECT LCASE(City) FROM student WHERE RNo < 3;
LCASE(City)
delhi
agra
MID(text, start, n) / SUBSTRING() / SUBSTR()n characters from the position start; counting starts at 1
SELECT MID('Informatics', 3, 4);
MID("Informatics", 3, 4)
form
SELECT SUBSTRING('Practices', 1, 5);
SUBSTRING("Practices", 1, 5)
Pract
SELECT SUBSTR(Name, 2, 2) FROM student WHERE City = 'Delhi';
SUBSTR(Name, 2, 2)
sh
in
LENGTH(text)the number of characters, spaces included
SELECT LENGTH('Pandas');
LENGTH("Pandas")
6
SELECT LENGTH('New Delhi');
LENGTH("New Delhi")
9
SELECT Name, LENGTH(Name) FROM student WHERE Marks > 80;
Name
LENGTH(Name)
Asha
4
Om
2
LEFT(text, n)the first n characters
SELECT LEFT('Informatics', 4);
LEFT("Informatics", 4)
Info
SELECT LEFT('Delhi', 1);
LEFT("Delhi", 1)
D
SELECT LEFT(City, 3) FROM student WHERE RNo <= 2;
LEFT(City, 3)
Del
Agr
RIGHT(text, n)the last n characters
SELECT RIGHT('Informatics', 3);
RIGHT("Informatics", 3)
ics
SELECT RIGHT('2026-27', 2);
RIGHT("2026-27", 2)
27
SELECT RIGHT(Name, 2) FROM student WHERE City = 'Agra';
RIGHT(Name, 2)
vi
Om
INSTR(text, part)the position of the first match; 0 if not found
SELECT INSTR('Informatics', 'ma');
INSTR("Informatics", "ma")
6
SELECT INSTR('Pandas', 'a');
INSTR("Pandas", "a")
2
SELECT INSTR('Pandas', 'x');
INSTR("Pandas", "x")
0
LTRIM(text)removes the spaces on the left
SELECT LTRIM(' KV');
LTRIM(" KV")
KV
SELECT LENGTH(LTRIM(' KV '));
LENGTH(LTRIM(" KV "))
4
SELECT LENGTH(' KV ');
LENGTH(" KV ")
6
RTRIM(text)removes the spaces on the right
SELECT RTRIM('KV ');
RTRIM("KV ")
KV
SELECT LENGTH(RTRIM(' KV '));
LENGTH(RTRIM(" KV "))
4
SELECT LENGTH(RTRIM('KV '));
LENGTH(RTRIM("KV "))
2
TRIM(text)removes the spaces on both sides; spaces inside stay
SELECT TRIM(' KV ');
TRIM(" KV ")
KV
SELECT LENGTH(TRIM(' KV '));
LENGTH(TRIM(" KV "))
2
SELECT LENGTH(TRIM(' New Delhi '));
LENGTH(TRIM(" New Delhi "))
9
Date functions7 functions · 3 examples each
NOW()the current date and time of the computer
SELECT NOW();
Shows the date and time of that moment, for example 2026-11-13 10:30:45.
SELECT DATE(NOW());
Shows only today's date, for example 2026-11-13.
SELECT YEAR(NOW());
Shows the current year, for example 2026.
DATE(datetime)takes out the date part
SELECT DATE('2026-11-13 10:30:45');
DATE("2026-11-13 10:30:45")
2026-11-13
SELECT DATE('2027-03-01 08:00:00');
DATE("2027-03-01 08:00:00")
2027-03-01
SELECT Name, DATE(DOB) FROM student WHERE RNo = 1;
Name
DATE(DOB)
Asha
2009-03-15
MONTH(date)the month number, 1 to 12
SELECT MONTH('2026-11-13');
MONTH("2026-11-13")
11
SELECT MONTH('2027-03-01');
MONTH("2027-03-01")
3
SELECT Name, MONTH(DOB) FROM student WHERE City = 'Delhi';
Name
MONTH(DOB)
Asha
3
Tina
7
MONTHNAME(date)the name of the month
SELECT MONTHNAME('2026-11-13');
MONTHNAME("2026-11-13")
November
SELECT MONTHNAME('2027-03-01');
MONTHNAME("2027-03-01")
March
SELECT Name, MONTHNAME(DOB) FROM student WHERE City = 'Agra';
Name
MONTHNAME(DOB)
Ravi
November
Om
January
YEAR(date)the year
SELECT YEAR('2026-11-13');
YEAR("2026-11-13")
2026
SELECT Name FROM student WHERE YEAR(DOB) = 2008;
Name
Ravi
Om
SELECT Name, YEAR(DOB) FROM student WHERE Marks > 80;
Name
YEAR(DOB)
Asha
2009
Om
2008
DAY(date)the day of the month, 1 to 31
SELECT DAY('2026-11-13');
DAY("2026-11-13")
13
SELECT DAY('2027-03-01');
DAY("2027-03-01")
1
SELECT Name, DAY(DOB) FROM student WHERE City = 'Pune';
Name
DAY(DOB)
Zoya
9
DAYNAME(date)the name of the week day
SELECT DAYNAME('2026-11-13');
DAYNAME("2026-11-13")
Friday
SELECT DAYNAME('2027-01-26');
DAYNAME("2027-01-26")
Tuesday
SELECT Name, DAYNAME(DOB) FROM student WHERE RNo <= 2;
Name
DAYNAME(DOB)
Asha
Sunday
Ravi
Sunday
Try it SQL function tester
Aggregate functions, GROUP BY, HAVING, ORDER BY and equi-join
Picture: how GROUP BY makes groups
GROUP BY City puts the rows of the same city together. The aggregate function then works on each group, and HAVING can drop some groups.
In daily life: Counting the students of each house: first make the children stand house-wise, then count each line.
Aggregate functions5 functions · 3 examples each
MAX(column)the largest value
SELECT MAX(Marks) FROM student;
MAX(Marks)
91
SELECT MAX(Name) FROM student;
MAX(Name)
Zoya
SELECT MAX(DOB) FROM student;
MAX(DOB)
2009-12-09
MIN(column)the smallest value
SELECT MIN(Marks) FROM student;
MIN(Marks)
55
SELECT MIN(Fee) FROM student;
MIN(Fee)
4000.25
SELECT MIN(Marks) FROM student WHERE City = 'Delhi';
MIN(Marks)
78
AVG(column)the average; NULL is left out
SELECT AVG(Marks) FROM student;
AVG(Marks)
74.6000
SELECT AVG(Marks) FROM student WHERE City = 'Agra';
AVG(Marks)
68.5000
SELECT ROUND(AVG(Marks), 1) FROM student;
ROUND(AVG(Marks), 1)
74.6
SUM(column)the total; NULL is left out
SELECT SUM(Marks) FROM student;
SUM(Marks)
373
SELECT SUM(Fee) FROM student;
SUM(Fee)
18502.00
SELECT SUM(Marks) FROM student WHERE City = 'Delhi';
SUM(Marks)
169
COUNT()COUNT(*) counts rows; COUNT(column) leaves out NULL
SELECT COUNT(*) FROM student;
COUNT(*)
5
SELECT COUNT(Fee) FROM student;
COUNT(Fee)
4
SELECT COUNT(DISTINCT City) FROM student;
COUNT(DISTINCT City)
3
Grouping, ordering and joining4 functions · 3 examples each
GROUP BYmakes one group for each different value; one output row per group
SELECT City, COUNT(*)
FROM student GROUP BY City;
City
COUNT(*)
Agra
2
Delhi
2
Pune
1
SELECT City, MAX(Marks)
FROM student GROUP BY City;
City
MAX(Marks)
Agra
82
Delhi
91
Pune
67
SELECT City, SUM(Marks)
FROM student GROUP BY City;
City
SUM(Marks)
Agra
137
Delhi
169
Pune
67
HAVINGkeeps only the groups that pass the condition
SELECT City, COUNT(*)
FROM student
GROUP BY City HAVING COUNT(*) > 1;
City
COUNT(*)
Agra
2
Delhi
2
SELECT City, SUM(Marks)
FROM student
GROUP BY City HAVING SUM(Marks) > 100;
City
SUM(Marks)
Agra
137
Delhi
169
SELECT City, MAX(Marks)
FROM student
GROUP BY City HAVING MAX(Marks) < 90;
City
MAX(Marks)
Agra
82
Pune
67
ORDER BYsorts the output; ascending unless DESC is written
SELECT Name, Marks FROM student ORDER BY Marks;
Name
Marks
Ravi
55
Zoya
67
Tina
78
Om
82
Asha
91
SELECT Name, Marks FROM student ORDER BY Marks DESC;
Name
Marks
Asha
91
Om
82
Tina
78
Zoya
67
Ravi
55
SELECT City, Name FROM student ORDER BY City, Name;
City
Name
Agra
Om
Agra
Ravi
Delhi
Asha
Delhi
Tina
Pune
Zoya
Equi-join of two tablesjoins the rows that have the same value in the common column
SELECT Name, State
FROM student, city
WHERE student.City = city.City;
Name
State
Asha
Delhi
Ravi
Uttar Pradesh
Tina
Delhi
Om
Uttar Pradesh
Zoya
Maharashtra
SELECT Name, Marks, State
FROM student, city
WHERE student.City = city.City AND Marks > 80;
Name
Marks
State
Asha
91
Delhi
Om
82
Uttar Pradesh
SELECT State, COUNT(*)
FROM student, city
WHERE student.City = city.City GROUP BY State;
State
COUNT(*)
Delhi
2
Maharashtra
1
Uttar Pradesh
2
Try it LIKE pattern tester
% stands for any number of characters, _ stands for exactly one character. MySQL ignores capital and small letters while matching.
The order of clauses in a query
SELECT>FROM>WHERE>GROUP BY>HAVING>ORDER BY
Picture: how one SELECT query works, step by step
SELECT city, COUNT(*) FROM student
WHERE marks > 60
GROUP BY city
HAVING COUNT(*) > 1;
1
FROM student
Take the whole table.
name
city
marks
Asha
Delhi
91
Ravi
Agra
55
Tina
Delhi
78
Om
Agra
82
Zoya
Pune
67
2
WHERE marks > 60
Keep only the rows that pass the condition. Ravi (55) goes out.
name
city
marks
Asha
Delhi
91
Tina
Delhi
78
Om
Agra
82
Zoya
Pune
67
3
GROUP BY city
Put the rows of the same city together.
city
rows in the group
Delhi
Asha, Tina
Agra
Om
Pune
Zoya
4
HAVING COUNT(*) > 1
Keep only the groups that pass the condition.
city
rows in the group
Delhi
Asha, Tina
5
SELECT city, COUNT(*)
Show the asked columns. This is the output.
city
COUNT(*)
Delhi
2
In daily life: Sorting answer sheets: take all sheets, remove the absent ones (WHERE), make bundles class-wise (GROUP BY), keep only the big bundles (HAVING), and write the count of each bundle.
Differences asked again and again
First
Second
WHERE / HAVING
WHERE puts a condition on rows, before grouping. No aggregate function in it.
HAVING puts a condition on groups, after GROUP BY. Aggregate functions are allowed.
Single-row / aggregate
Works on one row at a time and gives one result per row: ROUND(), UCASE(), MONTH().
Works on many rows and gives one result: SUM(), AVG(), MAX(), MIN(), COUNT().
COUNT(*) / COUNT(col)
Counts all the rows.
Counts only the rows where the column is not NULL.
ORDER BY / GROUP BY
Sorts the output rows.
Makes one output row for each group.
DELETE / DROP
DML: removes rows; the table stays.
DDL: removes the whole table with its structure.
UPDATE / ALTER
DML: changes the data in rows.
DDL: changes the structure, for example adds a column.
LTRIM / RTRIM / TRIM
LTRIM removes spaces on the left; RTRIM on the right.
TRIM removes them on both sides.
DAY / DAYNAME
DAY() gives the date number, 1 to 31.
DAYNAME() gives the name of the week day.
The five commands of the 5-mark question
INSERT INTO student VALUES (6, 'Kabir', 'Pune', 74, 4200.00, '2009-05-05'); -- add a row
UPDATE student SET Marks = Marks + 5 WHERE City = 'Agra'; -- change values
DELETE FROM student WHERE Marks < 60; -- remove rows
ALTER TABLE student ADD Email VARCHAR(40); -- add a column
DROP TABLE student; -- remove the table
Remember
Text and dates are written in quotes; numbers are not.
Every column written in SELECT with an aggregate function should also be in GROUP BY.
In an equi-join, write the common column with the table name: student.City = city.City.
Common mistake
WHERE SUM(Marks) > 100 is wrong. Use HAVING.
= NULL is wrong. Use IS NULL.
Forgetting the join condition gives every row of one table with every row of the other (Cartesian product).
UPDATE or DELETE without WHERE changes all the rows.
8
Introduction to computer networks
Unit 3 · 10 marks: 3 one-markers, one 2-mark question and the case study
A computer network is a group of computers and devices connected to each other to share data and resources such as printers and the Internet.
Picture: networks by the area they cover
Type
Full form
Area
Example
PAN
Personal Area Network
around one person, about 10 m
phone and Bluetooth earbuds
LAN
Local Area Network
a room, building or campus
the computer lab of a school
MAN
Metropolitan Area Network
a city
cable TV network, branches of a bank in one city
WAN
Wide Area Network
countries and continents
the Internet
Network devices
Device
Work
Remember it as
Modem
changes digital signals to analog and back, to connect to the Internet line
MOdulator-DEModulator
Hub
connects the computers of a LAN; sends the data to all of them
the loudspeaker
Switch
connects the computers of a LAN; sends the data only to the right computer
the postman
Repeater
makes a weak signal strong again; used when the cable is longer than about 100 m
the booster
Router
connects different networks and chooses the best path for the data
the traffic police
Gateway
connects two networks that use different protocols
the translator at the gate
Picture: where each device sits
From the Internet to your PC: modem, then router, then switch.
Picture: hub and switch
A hub repeats the data to every PC. A switch sends it only to the PC it is meant for.
In daily life: A hub is like announcing a message on the school speaker: everybody hears it. A switch is like handing a letter to one student.
Network topologies
Topology is the way in which the computers of a network are connected.
StarEvery computer has its own cable to a central switch or hub.
BusAll the computers share one main cable.
TreeStar groups are joined to a main device, like branches.
MeshEvery computer is joined to every other computer.
Topology
Good point
Weak point
Star
One computer or cable fails, the others keep working. A fault is easy to find.
If the central device fails, the whole network stops. Needs more cable.
Bus
Least cable, cheapest, easy to set up.
If the main cable breaks, the whole network stops. Slow when traffic is heavy.
Tree
Easy to add a new group of computers.
If the main cable or main hub fails, the groups are cut off.
Mesh
Very reliable: data has many paths.
Needs the most cable, so it is the costliest.
Internet, Web and its applications
Internet
The worldwide network of networks: the cables, devices and connections.
World Wide Web (WWW)
A service on the Internet: linked web pages that we open in a browser.
URL
Uniform Resource Locator: the unique address of a page.
https://www.cbse.gov.in/index.html
protocol · domain name · file name
Applications
Web: opening websites
E-mail: letters and files to a mail address
Chat: live typed messages
VoIP: voice calls over the Internet (Voice over Internet Protocol)
Picture: what happens when you open a website
The domain name is changed into the IP address of the web server, and the server sends the page.
Websites
Term
Meaning
Web page
one document on the Web, with its own URL
Website
a collection of related web pages under one domain name; its first page is the home page
Static web page
same content for every visitor; made with HTML; changes only when the developer edits it. Example: the "About us" page of a school
Dynamic web page
content changes with the user, time or data; uses scripts and a database. Example: a result page, a shopping cart
Web server
the computer that stores a website and sends its pages to browsers
Web hosting
the service of keeping a website on a web server so that anyone can open it on the Internet
Web browsers
Term
Meaning
Web browser
the program that asks for web pages and shows them: Google Chrome, Mozilla Firefox, Microsoft Edge, Safari
Browser settings
home page, default search engine, clear history and cookies, block pop-ups, saved passwords, private (incognito) window
Add-on (extension)
a small program that adds a feature to the browser, such as an ad blocker
Plug-in
a program that helps the browser show content it cannot handle on its own, such as some video or document formats
Cookies
small text files that a website saves on the user's computer to remember login, language or cart items. They are not viruses, but they can affect privacy.
The case study: five answers, five rules
Rules
Server: in the block with the most computers.
Cable layout: star, from the server block to the other blocks.
Switch or hub: one in every block.
Repeater: on a cable longer than about 100 m.
Type of network: inside one campus it is a LAN; between cities it is a WAN.
Website that shows different data to each user: dynamic.
Remember
Write the reason with every answer. "Block D, because it has the maximum number of computers (150)" gets the full mark; "Block D" alone may not.
Try it Case-study solver
Type the block names, number of computers and distances from any question.
9
Societal impacts
Unit 4 · 10 marks from definitions, differences and situations
Unit 4 is about using technology safely, legally and politely. Most answers are short definitions and differences, so this is the easiest 10 marks of the paper.
Digital footprint
The trail of data we leave behind when we use the Internet. It stays for a very long time, even after we delete a post.
Active digital footprint
Data we share on purpose.
Posts, comments, e-mails, filled forms
Passive digital footprint
Data collected without our action.
Sites visited, location, search history, cookies
Net etiquettes (netiquette)
Be ethical
No piracy, no plagiarism
Share only true and useful knowledge
Be respectful
Respect privacy
Respect different views; be polite
Be responsible
No cyber bullying
Do not feed the troll
Think before you post
Be secure and credible
Strong passwords; know who you befriend
Check a message before forwarding it
Data protection and Intellectual Property Rights (IPR)
Data protection means keeping personal data (name, Aadhaar number, bank details, photos) safe from misuse. IPR are the legal rights of a person over the creations of the mind.
Right
Protects
Example
Remember
Copyright
original creative work
book, song, film, software, photograph
given automatically to the creator
Patent
an invention
a new machine or medicine
must be applied for; valid for 20 years
Trademark
name, logo or symbol of a brand
logo of a shoe company
can be renewed again and again
Plagiarism
Using the work or idea of another person as your own, without giving credit.
Avoid it: write in your own words, name the source, use quotation marks for copied lines.
Licensing
A licence is the legal permission that tells how a work or software may be used.
Public licences: GNU GPL, Creative Commons (CC), Apache.
Free and open source software (FOSS)
Free and open source software
Proprietary software
Source code
given to everyone
kept secret by the company
Cost
free to use
a licence must be bought
Changing and sharing
allowed
not allowed
Examples
Linux, LibreOffice, Python, Mozilla Firefox, MySQL
Microsoft Windows, Microsoft Office, Adobe Photoshop
Cyber crime and cyber laws
Hacking
Getting into a computer or account without permission.
Ethical hackers do it with permission, to find weak points.
Phishing
A fake e-mail, message or website that looks real and asks for passwords or bank details.
Never share OTP, PIN or password.
Cyber bullying
Troubling, insulting or threatening someone online again and again.
Do not reply; keep proof; block; tell an elder.
Cyber law: IT Act, 2000
The Information Technology Act, 2000 (amended in 2008) gives legal recognition to electronic records and digital signatures, and fixes the punishment for cyber crimes.
E-waste: hazards and management
E-waste is discarded electrical and electronic equipment: old phones, computers, batteries, chargers. It has lead, mercury and cadmium, which poison the soil, water and air.
Reduce: buy only when needed>Reuse or refurbish: repair, donate>Recycle: give to an authorised recycler
Health concerns of using technology
Problem
Cause
Prevention
Eye strain, headache
looking at a screen for long hours
look away at regular intervals; keep the screen at arm's length; blink often
Back and neck pain
wrong posture
sit straight; screen at eye level; feet flat on the floor
Pain in wrists and fingers (repetitive strain injury)
typing or gaming for long hours
keep the wrists straight; take short breaks
Poor sleep, stress, addiction
too much screen time, mostly at night
fix a time limit; play outdoor games; no screen before sleeping
Remember
In a situation-based question, first name the act (phishing, plagiarism ...), then write one line of reason.
Patent is for an invention, copyright is for a creation, trademark is for a brand.
Common mistake
Free software does not mean "no rules". It also has a licence.
Freeware is free of cost, but its source code is not given. It is not open source.
Recycling and refurbishing are different: recycling breaks the item into materials; refurbishing repairs the same item.
10
Question bank: every type, with answers
1121 questions in 20 types, arranged in the order of the CBSE Sample Paper 2026-27
SQP 2026-27 32 questions follow the CBSE sample paper (shortened and reworded) Practice 1089 written on the same pattern
Tap a type to open it. In Section A, tap an option to check yourself. Every Pandas output, chart and SQL output shown in the answers was produced by running the code.
A1Pandas: MCQ and True/False1 mark · 144 questions
A1.1SQP 2026-271 mark
State True or False: A Series S1 has the index 'a', 'b', 'c', 'd', 'e'. S1['b':'d'] and S1[1:3] give the same elements.
Answer
(b) False Slicing with labels includes the end label, so S1['b':'d'] gives b, c, d. Slicing with positions leaves the stop out, so S1[1:3] gives only b, c.
A1.2SQP 2026-271 mark
What does pd.Series(5, index=[0, 1, 2]) create?
Answer
(a) A Series of three elements, each equal to 5 A single (scalar) value is repeated for every index label.
A1.3SQP 2026-271 mark
Two Series are added. A label is present in only one of them. What is stored against that label in the result?
Answer
(a) NaN Pandas matches labels first. Where a label has no partner, the result is NaN.
A1.4SQP 2026-271 mark
Which parameter of to_csv() stops the row labels (index) from being written to the file?
Answer
(a) index=False df.to_csv('f.csv', index=False) writes only the columns, without the row labels.
A1.5SQP 2026-271 mark
A DataFrame is made from a list of dictionaries. The keys of the dictionaries become the
Answer
(c) column labels Each dictionary is one row; its keys are the column names.
A1.6Practice1 mark
State True or False: The columns of a DataFrame can have different data types.
Answer
(a) True Each column has its own dtype, e.g. Name (object) and Marks (int64) in one DataFrame.
A1.7Practice1 mark
What is the output of this code?
import pandas as pd
S = pd.Series([17, 38, 8, 23, 5], index=['A', 'B', 'C', 'D', 'E'])
print((S * 2)['B'])
Answer
(a) 76 Every element is doubled.
A1.8Practice1 mark
What is the output of this code?
import pandas as pd
S = pd.Series([80, 115, 170, 75, 140], index=['P1', 'P2', 'P3', 'P4', 'P5'])
print(S[1:3].sum())
Answer
(a) 285 Positions 1 and 2 are taken; position 3 is left out.
A1.9Practice1 mark
What is the output of this code?
import pandas as pd
S = pd.Series([84, 118, 34, 79, 55], index=['Rohit', 'Virat', 'Gill', 'Rahul', 'Pant'])
print(S[1:3].sum())
Answer
(b) 152 Positions 1 and 2 are taken; position 3 is left out.
Which statement changes the column name 'Name' to 'Student' in df?
Answer
(a) df = df.rename(columns={'Name': 'Student'}) rename(columns={old: new}) returns a DataFrame with the new name; assign it back (or use inplace=True).
A1.56Practice1 mark
What is the output of this code?
import pandas as pd
S = pd.Series([26, 24, 38, 44, 12], index=['Red', 'Blue', 'Green', 'Gold', 'Pink'])
print(S.size)
Answer
(b) 5 Working: S.size = 5 (number of elements).
A1.57Practice1 mark
The name Pandas comes from the term
Answer
(c) Panel Data pandas comes from Panel Data (also 'Python Data Analysis').
A1.58Practice1 mark
What is the output of this code?
import pandas as pd
S = pd.Series([600, 750, 450, 900, 650], index=['Anil', 'Bela', 'Chand', 'Devi', 'Esha'])
print(S.tail(2).max())
Answer
(b) 900tail(2) takes the last two elements.
A1.59Practice1 mark
What is the output of this code?
import pandas as pd
S = pd.Series([275, 200, 125, 450, 175], index=['Mon', 'Tue', 'Wed', 'Thu', 'Fri'])
print(S['Tue':'Thu'].sum())
Answer
(b) 775 With labels, the end label is included.
A1.60Practice1 mark
State True or False: All the values of one Series can be changed, but its size cannot be changed.
Answer
(a) True A Series is value-mutable and size-immutable.
A1.61Practice1 mark
Which statement removes the column 'Fee' from the DataFrame df and returns the result?
Answer
(b) df.drop('Fee', axis=1) axis=1 means column; axis=0 means row.
(d) 20 years A patent is generally valid for 20 years.
A5.50Practice1 mark
Using a paid software without buying its licence is called
Answer
(a) software piracy That is software piracy.
A5.51Practice1 mark
Which of these helps to keep your account safe?
Answer
(d) Two-step verification (OTP) Two-step verification adds an OTP check after the password.
A5.52Practice1 mark
The data about us that remains online even after we delete a post shows that a digital footprint is
Answer
(c) permanent in nature Copies may remain on servers and with others, so footprints are permanent.
A5.53Practice1 mark
Which of these is a responsible use of social media?
Answer
(b) Checking a news item before sharing it Check facts before sharing to stop fake news.
A5.54Practice1 mark
Software that is free to use but whose source code is not given is called
Answer
(c) freeware Freeware is free but closed source.
A5.55Practice1 mark
Which body part is most affected by listening to loud music on earphones for long hours?
Answer
(b) Ears (hearing loss) Loud sound for long periods damages hearing.
A5.56Practice1 mark
State True or False: A digital footprint can affect a person's admission or job in future.
Answer
(a) True Colleges and employers may check a person's online record.
A5.57Practice1 mark
State True or False: Throwing e-waste with household garbage is safe for the soil and water.
Answer
(b) False Lead, mercury and cadmium from e-waste poison the soil and ground water.
A5.58Practice1 mark
State True or False: Free and open source software can be changed and shared by its users.
Answer
(a) True FOSS gives the freedom to change and share.
A5.59Practice1 mark
State True or False: Copying a friend's project and submitting it with your name is plagiarism.
Answer
(a) True Presenting another's work as yours is plagiarism.
A5.60Practice1 mark
State True or False: It is safe to click a link in an e-mail from an unknown sender.
Answer
(b) False It may be a phishing link.
A5.61Practice1 mark
State True or False: The IT Act, 2000 gives legal recognition to electronic records and digital signatures.
Answer
(a) True The IT Act makes electronic records and digital signatures legally valid.
A5.62Practice1 mark
State True or False: Passive digital footprints are made only when we post something ourselves.
Answer
(b) False Passive footprints are collected without our action, such as the sites we visit.
A6Assertion and Reason1 mark · 48 questions
A6.1SQP 2026-271 mark
Assertion (A):df.drop('Science', axis=0) removes the column 'Science' from the DataFrame df.
Reason (R): In drop(), axis=0 stands for rows and axis=1 stands for columns.
Answer
(d) A is false but R is true. With axis=0 Pandas looks for a row labelled 'Science'. To remove a column, axis=1 is needed.
A6.2SQP 2026-271 mark
Assertion (A):SELECT and select are treated as the same keyword by MySQL.
Reason (R): SQL keywords are case-sensitive.
Answer
(c) A is true but R is false. SQL keywords are not case-sensitive, so the reason is false.
A6.3Practice1 mark
Assertion (A): A Series can hold the marks of five students with their names as labels.
Reason (R): A Series is a one-dimensional labelled array.
Answer
(a) Both A and R are true and R is the correct explanation of A. A Series is a 1-D array with labels (R), so names can be the index (A).
A6.4Practice1 mark
Assertion (A):S1 + S2 gives NaN for a label that is present only in S1.
Reason (R): Pandas adds two Series by matching their index labels.
Answer
(a) Both A and R are true and R is the correct explanation of A. Labels are matched (R); a label missing in S2 has nothing to add to, so the result is NaN (A).
A6.5Practice1 mark
Assertion (A):df.head() shows the first five rows of df.
Reason (R): The default value of n in head() is 5.
Answer
(a) Both A and R are true and R is the correct explanation of A. The default n of head() is 5 (R), so five rows are shown (A).
A6.6Practice1 mark
Assertion (A): The size of a Series cannot be changed after it is created.
Reason (R): The values of a Series can be changed.
Answer
(b) Both A and R are true but R is not the correct explanation of A. Both are true, but one does not explain the other.
A6.7Practice1 mark
Assertion (A): A DataFrame df has the row labels R1, R2, R3, R4 and R5. df.loc['R1':'R3'] returns three rows.
Reason (R): With loc, the end label of a slice is included.
Answer
(a) Both A and R are true and R is the correct explanation of A. With loc the end label is included (R), so R1, R2, R3 are returned (A).
A6.8Practice1 mark
Assertion (A):df.iloc[1:3] returns three rows.
Reason (R): With iloc, the stop position of a slice is not included.
Answer
(d) A is false but R is true. Rows at positions 1 and 2 are returned, so the assertion is false.
A6.9Practice1 mark
Assertion (A):df['Total'] = df['A'] + df['B'] adds a new column to df.
Reason (R): Assigning to a column label that does not exist creates that column.
Answer
(a) Both A and R are true and R is the correct explanation of A. Assigning to a new column label creates it (R), so Total is added (A).
A6.10Practice1 mark
Assertion (A):df.to_csv('m.csv', index=False) writes the row labels to the file.
Reason (R):index=False tells Pandas not to write the row labels.
Answer
(d) A is false but R is true. A is false: index=False means the row labels are NOT written (R is true).
A6.11Practice1 mark
Assertion (A):pd.read_csv('m.csv') returns a DataFrame.
Reason (R): A CSV file stores data in rows, with the values separated by commas.
Answer
(b) Both A and R are true but R is not the correct explanation of A. Both are true, but R only describes a CSV file; it does not explain why read_csv() returns a DataFrame.
A6.12Practice1 mark
Assertion (A): A DataFrame can have a column of names and a column of marks.
Reason (R): All the columns of a DataFrame must have the same data type.
Answer
(c) A is true but R is false. Different columns can have different data types.
A6.13Practice1 mark
Assertion (A):S[S > 40] returns only the elements greater than 40.
Reason (R): A condition on a Series gives a Series of True and False values, which is used to pick the elements.
Answer
(a) Both A and R are true and R is the correct explanation of A. The condition gives True/False for each element (R), and only True ones are kept (A).
A6.14Practice1 mark
Assertion (A):df.shape of a DataFrame with 4 rows and 3 columns is (3, 4).
Reason (R):shape gives the number of rows first and then the number of columns.
Answer
(d) A is false but R is true. The shape is (4, 3).
A6.15Practice1 mark
Assertion (A):del df['Fee'] removes the column 'Fee' from df.
Reason (R):del deletes the column from the DataFrame itself.
Answer
(a) Both A and R are true and R is the correct explanation of A. del deletes the column from df itself (R), so it is removed (A).
A6.16Practice1 mark
Assertion (A):df.rename(columns={'A': 'X'}) changes the row labels.
Reason (R): The columns parameter of rename() is used for column labels.
Answer
(d) A is false but R is true. A is false: columns= renames column labels (R is true); index= would change row labels.
A6.17Practice1 mark
Assertion (A): A Series created from a dictionary has the keys as its index.
Reason (R): A dictionary has key and value pairs.
Answer
(b) Both A and R are true but R is not the correct explanation of A. Both are true, but R only says a dictionary has key-value pairs; it does not explain why keys become the index.
A6.18Practice1 mark
Assertion (A):S.tail(2) returns the first two elements of S.
Reason (R):tail() returns elements from the end of a Series.
Answer
(d) A is false but R is true. A is false: tail() gives the last elements (R is true); head(2) gives the first two.
A6.19Practice1 mark
Assertion (A):pd.Series([10, 20, 30]) has the index 0, 1, 2.
Reason (R): When no index is given, Pandas gives a default index that starts from 0.
Answer
(a) Both A and R are true and R is the correct explanation of A. With no index given, pandas uses 0, 1, 2 ... (R), so A is true.
A6.20Practice1 mark
Assertion (A): A DataFrame made from a list of dictionaries may have NaN values.
Reason (R): If a key is missing in one dictionary, that cell gets NaN.
Answer
(a) Both A and R are true and R is the correct explanation of A. A missing key gives NaN in that cell (R), so NaN can appear (A).
A6.21Practice1 mark
Assertion (A):S * 2 gives an error for a Series of numbers.
Reason (R): Arithmetic operations on a Series are done on every element.
Answer
(d) A is false but R is true. A is false: arithmetic works on every element (R is true), so each value is doubled.
A6.22Practice1 mark
Assertion (A):df.size of a DataFrame with 5 rows and 2 columns is 10.
Reason (R):size gives the number of rows multiplied by the number of columns.
Answer
(a) Both A and R are true and R is the correct explanation of A. size = rows × columns (R) = 5 × 2 = 10 (A).
A6.23Practice1 mark
Assertion (A):df.T changes the rows into columns and the columns into rows.
Reason (R): T stands for transpose.
Answer
(a) Both A and R are true and R is the correct explanation of A. T stands for transpose (R), which swaps rows and columns (A).
A6.24Practice1 mark
Assertion (A):df.drop('R2') removes the row 'R2' from df itself.
Reason (R):drop() returns a new DataFrame and leaves the original as it is.
Answer
(d) A is false but R is true. A is false: drop() returns a new DataFrame (R is true); df stays the same unless inplace=True.
A6.25Practice1 mark
Assertion (A):COUNT(*) and COUNT(Fee) can give different answers on the same table.
Reason (R):COUNT(column) does not count the NULL values of that column.
Answer
(a) Both A and R are true and R is the correct explanation of A. COUNT(Fee) skips NULLs (R) while COUNT(*) counts all rows, so they can differ (A).
A6.26Practice1 mark
Assertion (A): HAVING is used to put a condition on groups.
Reason (R): WHERE cannot be used with aggregate functions.
Answer
(a) Both A and R are true and R is the correct explanation of A. WHERE cannot use aggregate functions (R), so HAVING is used for group conditions (A).
A6.27Practice1 mark
Assertion (A):SELECT Name FROM Emp ORDER BY Salary; shows the lowest salary first.
Reason (R): ORDER BY sorts in ascending order when no order is written.
Answer
(a) Both A and R are true and R is the correct explanation of A. Ascending is the default (R), so the lowest salary comes first (A).
A6.28Practice1 mark
Assertion (A):WHERE Marks BETWEEN 40 AND 60 shows a student who has 60 marks.
Reason (R): BETWEEN includes both the limits.
Answer
(a) Both A and R are true and R is the correct explanation of A. BETWEEN includes both limits (R), so 60 is included (A).
A6.29Practice1 mark
Assertion (A):SELECT UCASE('kv'); returns KV.
Reason (R): UCASE() and UPPER() do the same work.
Answer
(b) Both A and R are true but R is not the correct explanation of A. Both are true, but saying UCASE() and UPPER() are the same does not explain why the result is KV.
A6.30Practice1 mark
Assertion (A):SELECT LENGTH('IP 065'); returns 5.
Reason (R): LENGTH() counts spaces also.
Answer
(d) A is false but R is true. The string has 6 characters including the space.
A6.31Practice1 mark
Assertion (A):SELECT MOD(17, 5); returns 2.
Reason (R): MOD() returns the quotient of a division.
Answer
(c) A is true but R is false. MOD() returns the remainder.
(a) Both A and R are true and R is the correct explanation of A. Aggregate functions ignore NULLs (R), so AVG uses only rows with a Fee (A).
A6.34Practice1 mark
Assertion (A):DELETE FROM Emp; removes the table Emp from the database.
Reason (R): DELETE is a DML command that removes rows.
Answer
(d) A is false but R is true. The rows go, but the empty table stays.
A6.35Practice1 mark
Assertion (A): DROP TABLE is a DDL command.
Reason (R): DROP TABLE removes the rows and also the structure of the table.
Answer
(b) Both A and R are true but R is not the correct explanation of A. Both are true, but R tells what DROP TABLE does, not why it is DDL (it changes the structure/definition).
A6.36Practice1 mark
Assertion (A):WHERE Name LIKE 'A%' shows the name Anil.
Reason (R): In a LIKE pattern, % stands for any number of characters.
Answer
(a) Both A and R are true and R is the correct explanation of A. % means any number of characters (R), so 'A' followed by anything matches Anil (A).
A6.37Practice1 mark
Assertion (A):WHERE Name LIKE '_a%' shows the name Aman.
Reason (R): In a LIKE pattern, _ stands for exactly one character.
Answer
(d) A is false but R is true. The second letter of Aman is m, so it is not shown.
A6.38Practice1 mark
Assertion (A): In an equi-join, a common column is needed in the two tables.
Reason (R): The join condition compares the common column of the two tables with the = sign.
Answer
(a) Both A and R are true and R is the correct explanation of A. The join compares the common column with = (R), so the column is needed (A).
A6.39Practice1 mark
Assertion (A):SELECT City, COUNT(*) FROM Emp GROUP BY City; gives one row for every city.
Reason (R): GROUP BY puts the rows with the same value into one group.
Answer
(a) Both A and R are true and R is the correct explanation of A. GROUP BY makes one group per city (R), so one row per city (A).
Reason (R): RIGHT() takes characters from the end of a string.
Answer
(a) Both A and R are true and R is the correct explanation of A. RIGHT() takes characters from the end (R): the last 3 are 'ics' (A).
A6.48Practice1 mark
Assertion (A):WHERE SUM(Fee) > 5000 is a valid condition.
Reason (R): Aggregate functions can be used in the HAVING clause.
Answer
(d) A is false but R is true. A is false: aggregates cannot be used in WHERE; they are used in HAVING (R is true).
Section B · 2 marks each
B1Pandas: explain, differentiate, write code2 marks · 106 questions
B1.1SQP 2026-272 marks
What does the head() function of Pandas do? Write a statement to show the first three rows of a DataFrame df.
Answer
head(n) returns the first n rows of a Series or DataFrame. If n is not given, it returns 5 rows.
print(df.head(3))
B1.2SQP 2026-272 marks
What is Boolean indexing in Pandas? Give one example.
Answer
Boolean indexing means picking the rows for which a condition is True. The condition is written inside the square brackets. The statement below shows the rows of df where Marks are more than 80.
print(df[df['Marks'] > 80])
B1.3SQP 2026-272 marks
Which function loads a CSV file into a DataFrame? What is the use of its sep parameter?
Answer
read_csv() reads a CSV file and returns a DataFrame. sep tells which character separates the values in the file, for example a comma, a semicolon or a tab. The default is a comma.
df = pd.read_csv('marks.csv', sep=';')
B1.4Practice2 marks
Write two differences between a Series and a DataFrame.
Answer
(1) A Series is one-dimensional; a DataFrame is two-dimensional (rows and columns). (2) A Series holds values of one data type; the columns of a DataFrame can have different data types. Also, the size of a Series is fixed, but rows and columns can be added to a DataFrame.
B1.5Practice2 marks
Write two differences between loc and iloc.
Answer
(1) loc selects by labels; iloc selects by integer positions. (2) In a slice, loc includes the end label; iloc leaves out the stop position. Example: df.loc['R1':'R3'] gives 3 rows, df.iloc[0:3] also gives 3 rows (positions 0, 1, 2).
B1.6Practice2 marks
Write the difference between head() and tail() with an example of each.
Answer
head(n) returns the first n rows; tail(n) returns the last n rows. Both return 5 rows when n is not given.
print(df.head(2)) # first two rows
print(df.tail(2)) # last two rows
B1.7Practice2 marks
What is the difference between size and shape of a DataFrame?
Answer
size is the total number of values (rows x columns). shape is a tuple of the number of rows and the number of columns. For a DataFrame of 4 rows and 3 columns, df.size is 12 and df.shape is (4, 3).
B1.8Practice2 marks
What is NaN? Write one situation in which a Series gets NaN values.
Answer
NaN means Not a Number. It marks a missing value. Example: when two Series are added and a label is present in only one of them, the result has NaN against that label.
B1.9Practice2 marks
What is a CSV file? Write one advantage of using it.
Answer
CSV means Comma Separated Values. It is a text file in which each line is one row and the values are separated by commas. It is small in size and can be opened in any spreadsheet, text editor or program, so it is easy to move data from one software to another.
B1.10Practice2 marks
Write the use of the parameters header and names of read_csv().
Answer
header=None tells Pandas that the file has no heading row, so the first line is treated as data. names=[...] gives our own column names to the DataFrame.
What is the difference between the attributes index and columns of a DataFrame?
Answer
df.index gives the row labels and df.columns gives the column labels. New labels can also be given through them, for example df.columns = ['A', 'B'].
B1.16Practice2 marks
What are vector operations on a Series? Give one example.
Answer
An arithmetic operation written on a Series is done on every element at one go. No loop is needed. Example: S + 5 adds 5 to every element of S.
B1.17Practice2 marks
Write two differences between del df['A'] and df.drop('A', axis=1).
Answer
(1) del removes the column from df itself; drop() returns a new DataFrame and df stays the same unless the result is stored. (2) del removes one column at a time; drop() can remove many labels, and rows also (axis=0).
B1.18Practice2 marks
A DataFrame df has the columns Name and Marks. Write statements to:
Show its number of rows and columns
Show its column names.
Answer
shape gives (rows, columns) and columns gives the column labels.
print(df.shape)
print(df.columns)
B1.19Practice2 marks
What is the use of the rename() function? Write a statement to change the column label 'Qty' to 'Quantity' in df.
Answer
rename() changes row labels or column labels. A dictionary of old and new labels is given to index (rows) or columns.
df = df.rename(columns={'Qty': 'Quantity'})
B1.20Practice2 marks
How is a Series different from a Python list? Write two points.
Answer
(1) A Series has labels (index) that we can choose; a list has only positions 0, 1, 2 ... (2) Arithmetic on a Series works on every element (S * 2 doubles every value); L * 2 on a list repeats the list.
B1.21Practice2 marks
Explain iterrows() with an example.
Answer
iterrows() is used in a for loop to go through a DataFrame row by row. In every turn it gives the row label and the row as a Series.
for i, row in df.iterrows():
print(i, row['Name'])
B1.22Practice2 marks
What happens when two Series with different index labels are added? Explain with an example.
Answer
Pandas adds the values that have the same label. A label that is present in only one Series gets NaN. Example: S1 has labels a, b and S2 has labels b, c. S1 + S2 has NaN for a, the sum for b and NaN for c.
B1.23Practice2 marks
Write the difference between df['Marks'] and df[['Marks']].
Answer
df['Marks'] returns the column as a Series. df[['Marks']] (a list inside the brackets) returns a DataFrame with that one column. More columns can be asked in the same way: df[['Name', 'Marks']].
B1.24Practice2 marks
What is the difference between df.loc['R5'] = [...] and df['C5'] = [...]?
Answer
df.loc['R5'] = [...] adds (or changes) a row with the label R5. df['C5'] = [...] adds (or changes) a column with the label C5.
B1.25Practice2 marks
Write statements to:
Import Pandas
Read the file stock.csv into a DataFrame df.
Answer
The file must be in the current folder, or its full path is given.
import pandas as pd
df = pd.read_csv('stock.csv')
B1.26Practice2 marks
Write a statement to save the DataFrame df in the file result.csv without the row labels. Which separator is used by default?
Answer
The default separator is a comma.
df.to_csv('result.csv', index=False)
B1.27Practice2 marks
Write a Python program to create a Series Marks that stores the marks of five students as 49, 69, 89, 51, 85, with the labels Asha, Ravi, Tina, Om, Zoya. Then display the values that are more than 69.
Answer
import pandas as pd
Marks = pd.Series([49, 69, 89, 51, 85], index=['Asha', 'Ravi', 'Tina', 'Om', 'Zoya'])
print(Marks[Marks > 69])
Output:
Tina 89
Zoya 85
dtype: int64
B1.28Practice2 marks
Write the output of the following code.
import pandas as pd
S = pd.Series({'Asha': 49, 'Ravi': 69, 'Tina': 89, 'Om': 51})
print(S.head(2))
print(S.size)
Answer
Output:
Asha 49
Ravi 69
dtype: int64
4
B1.29Practice2 marks
Write a Python program to create a Series Runs that stores the runs scored by five players as 84, 118, 34, 79, 55, with the labels Rohit, Virat, Gill, Rahul, Pant. Then display the values that are more than 79.
import pandas as pd
S = pd.Series([84, 118, 34, 79], index=['Rohit', 'Virat', 'Gill', 'Rahul'])
print(S.tail(2))
print(S['Rohit'])
Answer
Output:
Gill 34
Rahul 79
dtype: int64
84
B1.31Practice2 marks
Write a Python program to create a Series Sales that stores the sales (in thousand rupees) of five months as 40, 70, 65, 45, 30, with the labels Jan, Feb, Mar, Apr, May. Then display the values that are more than 45.
import pandas as pd
S = pd.Series({'Jan': 40, 'Feb': 70, 'Mar': 65, 'Apr': 45})
print(S * 2)
Answer
Output:
Jan 80
Feb 140
Mar 130
Apr 90
dtype: int64
B1.33Practice2 marks
Write a Python program to create a Series Price that stores the price of five items as 300, 140, 50, 390, 80, with the labels Pen, Book, Bag, Box, Ink. Then display the values that are more than 140.
import pandas as pd
S = pd.Series([300, 140, 50, 390], index=['Pen', 'Book', 'Bag', 'Box'])
print(S[1:3])
print(S.max())
Answer
Output:
Book 140
Bag 50
dtype: int64
390
B1.35Practice2 marks
Write a Python program to create a Series Temp that stores the temperature (in Celsius) of five cities as 6, 17, 19, 30, 26, with the labels Delhi, Pune, Agra, Kochi, Leh. Then display the values that are more than 19.
import pandas as pd
S = pd.Series({'Delhi': 6, 'Pune': 17, 'Agra': 19, 'Kochi': 30})
print(S.head(2))
print(S.size)
Answer
Output:
Delhi 6
Pune 17
dtype: int64
4
B1.37Practice2 marks
Write a Python program to create a Series Stock that stores the number of books of five subjects as 70, 60, 75, 20, 15, with the labels Eng, Hin, Maths, Sci, IP. Then display the values that are more than 60.
import pandas as pd
S = pd.Series([70, 60, 75, 20], index=['Eng', 'Hin', 'Maths', 'Sci'])
print(S.tail(2))
print(S['Eng'])
Answer
Output:
Maths 75
Sci 20
dtype: int64
70
B1.39Practice2 marks
Write a Python program to create a Series Rain that stores the rainfall (in mm) of five months as 240, 300, 170, 20, 190, with the labels Jun, Jul, Aug, Sep, Oct. Then display the values that are more than 190.
import pandas as pd
S = pd.Series({'Jun': 240, 'Jul': 300, 'Aug': 170, 'Sep': 20})
print(S * 2)
Answer
Output:
Jun 480
Jul 600
Aug 340
Sep 40
dtype: int64
B1.41Practice2 marks
Write a Python program to create a Series Fee that stores the monthly fee of five hobby classes as 600, 1200, 1400, 900, 1000, with the labels Yoga, Dance, Music, Art, Chess. Then display the values that are more than 1000.
import pandas as pd
S = pd.Series([600, 1200, 1400, 900], index=['Yoga', 'Dance', 'Music', 'Art'])
print(S[1:3])
print(S.max())
Answer
Output:
Dance 1200
Music 1400
dtype: int64
1400
B1.43Practice2 marks
Write a Python program to create a Series Units that stores the electricity units used by five flats as 160, 130, 320, 250, 200, with the labels F1, F2, F3, F4, F5. Then display the values that are more than 200.
Answer
import pandas as pd
Units = pd.Series([160, 130, 320, 250, 200], index=['F1', 'F2', 'F3', 'F4', 'F5'])
print(Units[Units > 200])
Output:
F3 320
F4 250
dtype: int64
B1.44Practice2 marks
Write the output of the following code.
import pandas as pd
S = pd.Series({'F1': 160, 'F2': 130, 'F3': 320, 'F4': 250})
print(S.head(2))
print(S.size)
Answer
Output:
F1 160
F2 130
dtype: int64
4
B1.45Practice2 marks
Write a Python program to create a Series Score that stores the quiz scores of five teams as 26, 24, 38, 44, 12, with the labels Red, Blue, Green, Gold, Pink. Then display the values that are more than 26.
import pandas as pd
S = pd.Series([26, 24, 38, 44], index=['Red', 'Blue', 'Green', 'Gold'])
print(S.tail(2))
print(S['Red'])
Answer
Output:
Green 38
Gold 44
dtype: int64
26
B1.47Practice2 marks
Write a Python program to create a Series Wages that stores the daily wages of five workers as 600, 750, 450, 900, 650, with the labels Anil, Bela, Chand, Devi, Esha. Then display the values that are more than 650.
import pandas as pd
S = pd.Series({'Anil': 600, 'Bela': 750, 'Chand': 450, 'Devi': 900})
print(S * 2)
Answer
Output:
Anil 1200
Bela 1500
Chand 900
Devi 1800
dtype: int64
B1.49Practice2 marks
Write a Python program to create a Series Likes that stores the likes on five posts as 80, 115, 170, 75, 140, with the labels P1, P2, P3, P4, P5. Then display the values that are more than 115.
import pandas as pd
S = pd.Series([80, 115, 170, 75], index=['P1', 'P2', 'P3', 'P4'])
print(S[1:3])
print(S.max())
Answer
Output:
P2 115
P3 170
dtype: int64
170
B1.51Practice2 marks
Write a Python program to create a Series Steps that stores the steps (in hundreds) walked on five days as 95, 110, 65, 90, 85, with the labels Mon, Tue, Wed, Thu, Fri. Then display the values that are more than 90.
import pandas as pd
S = pd.Series({'Mon': 95, 'Tue': 110, 'Wed': 65, 'Thu': 90})
print(S.head(2))
print(S.size)
Answer
Output:
Mon 95
Tue 110
dtype: int64
4
B1.53Practice2 marks
Write a Python program to create a Series Seats that stores the seats in five halls as 40, 240, 260, 120, 300, with the labels H1, H2, H3, H4, H5. Then display the values that are more than 240.
import pandas as pd
S = pd.Series([40, 240, 260, 120], index=['H1', 'H2', 'H3', 'H4'])
print(S.tail(2))
print(S['H1'])
Answer
Output:
H3 260
H4 120
dtype: int64
40
B1.55Practice2 marks
Write a Python program to create a Series Weight that stores the weight (in kg) of five parcels as 17, 38, 8, 23, 5, with the labels A, B, C, D, E. Then display the values that are more than 17.
import pandas as pd
S = pd.Series({'A': 17, 'B': 38, 'C': 8, 'D': 23})
print(S * 2)
Answer
Output:
A 34
B 76
C 16
D 46
dtype: int64
B1.57Practice2 marks
Write a Python program to create a Series Visits that stores the visitors of a museum on five days as 275, 200, 125, 450, 175, with the labels Mon, Tue, Wed, Thu, Fri. Then display the values that are more than 200.
import pandas as pd
S = pd.Series([275, 200, 125, 450], index=['Mon', 'Tue', 'Wed', 'Thu'])
print(S[1:3])
print(S.max())
Answer
Output:
Tue 200
Wed 125
dtype: int64
450
B1.59Practice2 marks
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Item 'Pen', Price 260 and Qty 55. The second has Item 'Notebook' and Price 150 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Item': 'Pen', 'Price': 260, 'Qty': 55},
{'Item': 'Notebook', 'Price': 150}]
df = pd.DataFrame(L)
print(df)
Output:
Item Price Qty
0 Pen 260 55.0
1 Notebook 150 NaN
The second dictionary has no key Qty, so NaN is shown there. The column becomes float.
B1.60Practice2 marks
Consider the DataFrame df given below. Write statements to:
Display only the column Maths
Display the rows where Eng is more than 63.
DataFrame: df
Name
Eng
Maths
R1
Asha
85
60
R2
Ravi
63
61
R3
Tina
67
73
R4
Om
60
63
Answer
(i)
print(df['Maths'])
Output:
R1 60
R2 61
R3 73
R4 63
Name: Maths, dtype: int64
(ii)
print(df[df['Eng'] > 63])
Output:
Name Eng Maths
R1 Asha 85 60
R3 Tina 67 73
B1.61Practice2 marks
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Player 'Rohit', Fours 36 and Sixes 2. The second has Player 'Virat' and Fours 27 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Player': 'Rohit', 'Fours': 36, 'Sixes': 2},
{'Player': 'Virat', 'Fours': 27}]
df = pd.DataFrame(L)
print(df)
Output:
Player Fours Sixes
0 Rohit 36 2.0
1 Virat 27 NaN
The second dictionary has no key Sixes, so NaN is shown there. The column becomes float.
B1.62Practice2 marks
Consider the DataFrame df given below. Write statements to:
Shop Income Expense
S3 City 115 45
S4 Deluxe 90 20
B1.63Practice2 marks
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Class 'IX', Boys 29 and Girls 18. The second has Class 'X' and Boys 28 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Class': 'IX', 'Boys': 29, 'Girls': 18},
{'Class': 'X', 'Boys': 28}]
df = pd.DataFrame(L)
print(df)
Output:
Class Boys Girls
0 IX 29 18.0
1 X 28 NaN
The second dictionary has no key Girls, so NaN is shown there. The column becomes float.
B1.64Practice2 marks
Consider the DataFrame df given below. Write statements to:
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has RoomType 'Single', Rent 3800 and Days 3. The second has RoomType 'Double' and Rent 2400 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'RoomType': 'Single', 'Rent': 3800, 'Days': 3},
{'RoomType': 'Double', 'Rent': 2400}]
df = pd.DataFrame(L)
print(df)
Output:
RoomType Rent Days
0 Single 3800 3.0
1 Double 2400 NaN
The second dictionary has no key Days, so NaN is shown there. The column becomes float.
B1.66Practice2 marks
Consider the DataFrame df given below. Write statements to:
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has House 'Shivaji', Gold 9 and Silver 3. The second has House 'Tagore' and Gold 11 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'House': 'Shivaji', 'Gold': 9, 'Silver': 3},
{'House': 'Tagore', 'Gold': 11}]
df = pd.DataFrame(L)
print(df)
Output:
House Gold Silver
0 Shivaji 9 3.0
1 Tagore 11 NaN
The second dictionary has no key Silver, so NaN is shown there. The column becomes float.
B1.68Practice2 marks
Consider the DataFrame df given below. Write statements to:
Display only the column Qtr2
Display the rows where Qtr1 is more than 36.
DataFrame: df
Name
Qtr1
Qtr2
S1
Kabir
54
56
S2
Meera
58
20
S3
Nitin
36
18
S4
Pooja
22
48
Answer
(i)
print(df['Qtr2'])
Output:
S1 56
S2 20
S3 18
S4 48
Name: Qtr2, dtype: int64
(ii)
print(df[df['Qtr1'] > 36])
Output:
Name Qtr1 Qtr2
S1 Kabir 54 56
S2 Meera 58 20
B1.69Practice2 marks
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Vehicle 'Car', Litres 55 and Rate 92. The second has Vehicle 'Bike' and Litres 45 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Vehicle': 'Car', 'Litres': 55, 'Rate': 92},
{'Vehicle': 'Bike', 'Litres': 45}]
df = pd.DataFrame(L)
print(df)
Output:
Vehicle Litres Rate
0 Car 55 92.0
1 Bike 45 NaN
The second dictionary has no key Rate, so NaN is shown there. The column becomes float.
B1.70Practice2 marks
Consider the DataFrame df given below. Write statements to:
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Name 'Gopal', Basic 20000 and Bonus 3500. The second has Name 'Hema' and Basic 48000 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Name': 'Gopal', 'Basic': 20000, 'Bonus': 3500},
{'Name': 'Hema', 'Basic': 48000}]
df = pd.DataFrame(L)
print(df)
Output:
Name Basic Bonus
0 Gopal 20000 3500.0
1 Hema 48000 NaN
The second dictionary has no key Bonus, so NaN is shown there. The column becomes float.
B1.72Practice2 marks
Consider the DataFrame df given below. Write statements to:
Show Tickets Price
T2 Noon 100 200
T4 Night 130 300
B1.73Practice2 marks
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has City 'Delhi', MaxTemp 39 and MinTemp 18. The second has City 'Shimla' and MaxTemp 31 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'City': 'Delhi', 'MaxTemp': 39, 'MinTemp': 18},
{'City': 'Shimla', 'MaxTemp': 31}]
df = pd.DataFrame(L)
print(df)
Output:
City MaxTemp MinTemp
0 Delhi 39 18.0
1 Shimla 31 NaN
The second dictionary has no key MinTemp, so NaN is shown there. The column becomes float.
B1.74Practice2 marks
Consider the DataFrame df given below. Write statements to:
Display only the column Sold
Display the rows where Price is more than 30.
DataFrame: df
Item
Price
Sold
C1
Samosa
20
140
C2
Tea
30
20
C3
Juice
55
90
C4
Sandwich
60
60
Answer
(i)
print(df['Sold'])
Output:
C1 140
C2 20
C3 90
C4 60
Name: Sold, dtype: int64
(ii)
print(df[df['Price'] > 30])
Output:
Item Price Sold
C3 Juice 55 90
C4 Sandwich 60 60
B1.75Practice2 marks
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Dept 'Sports', Allotted 190 and Spent 20. The second has Dept 'Library' and Allotted 170 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Dept': 'Sports', 'Allotted': 190, 'Spent': 20},
{'Dept': 'Library', 'Allotted': 170}]
df = pd.DataFrame(L)
print(df)
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Class 'VI', Students 31 and Teachers 5. The second has Class 'VII' and Students 36 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Class': 'VI', 'Students': 31, 'Teachers': 5},
{'Class': 'VII', 'Students': 36}]
df = pd.DataFrame(L)
print(df)
Output:
Class Students Teachers
0 VI 31 5.0
1 VII 36 NaN
The second dictionary has no key Teachers, so NaN is shown there. The column becomes float.
B1.78Practice2 marks
Consider the DataFrame df given below. Write statements to:
Garden Trees Shrubs
G1 Rose 110 70
G2 Lotus 90 120
B1.79Practice2 marks
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Customer 'Farah', Deposit 60 and Withdraw 45. The second has Customer 'Girish' and Deposit 180 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Customer': 'Farah', 'Deposit': 60, 'Withdraw': 45},
{'Customer': 'Girish', 'Deposit': 180}]
df = pd.DataFrame(L)
print(df)
Write a Python program to create a DataFrame df from a list of two dictionaries. The first dictionary has Model 'Astra', Price 10000 and Stock 4. The second has Model 'Bolt' and Price 15000 only. Display the DataFrame. What is shown for the missing value?
Answer
import pandas as pd
L = [{'Model': 'Astra', 'Price': 10000, 'Stock': 4},
{'Model': 'Bolt', 'Price': 15000}]
df = pd.DataFrame(L)
print(df)
Output:
Model Price Stock
0 Astra 10000 4.0
1 Bolt 15000 NaN
The second dictionary has no key Stock, so NaN is shown there. The column becomes float.
B1.82Practice2 marks
Consider the DataFrame df given below. Write statements to:
B2Data visualization short answers2 marks · 24 questions
B2.1SQP 2026-272 marks
What is data visualization? Write its purpose.
Answer
Data visualization is showing data in the form of pictures such as charts and graphs. It helps us to see patterns, trends, variations and relationships in the data quickly, which are hard to see in a table of numbers.
B2.2Practice2 marks
Write two differences between a bar chart and a histogram.
Answer
(1) A bar chart compares separate categories (such as products); a histogram shows how numeric values are spread over continuous intervals. (2) The bars of a bar chart have gaps; the bars of a histogram touch each other.
B2.3Practice2 marks
What is the use of plt.legend()? What must be written in plt.plot() for it to work?
Answer
legend() shows a small box that tells which line or bar stands for which data. Each plot() call must be given a name with the label parameter, for example plt.plot(x, y, label='Sales').
B2.4Practice2 marks
Write the difference between plt.show() and plt.savefig().
Answer
show() displays the chart on the screen. savefig('name.png') saves the chart as a picture file. In a program, savefig() is written before show().
B2.5Practice2 marks
Write the use of the functions title() and xlabel() of pyplot with one example each.
Answer
title() writes a heading on top of the chart. xlabel() writes a label below the X-axis.
plt.title('Monthly Sales')
plt.xlabel('Month')
B2.6Practice2 marks
What is a histogram? What is the use of the bins parameter?
Answer
A histogram shows the frequency distribution of numeric data: the range of values is cut into intervals and a bar shows how many values fall in each interval. bins gives the number of intervals, or the list of interval edges.
B2.7Practice2 marks
Name the chart you will choose in each case:
Rainfall of a city in each month of a year, to see the trend
Number of students in four houses of a school.
Answer
(i) Line chart, because it shows a change over time. (ii) Bar chart, because it compares separate categories.
B2.8Practice2 marks
Write the use of any two of these parameters of plt.plot(): color, linestyle, marker, linewidth.
Answer
color sets the colour of the line ('r', 'g', 'blue'). linestyle sets the kind of line ('-' solid, '--' dashed, ':' dotted). marker puts a symbol on every data point ('o', '*', 's'). linewidth sets the thickness of the line.
B2.9Practice2 marks
Write the statements to import the plotting module and to draw a line chart of the lists x and y.
Answer
pyplot is imported with the short name plt.
import matplotlib.pyplot as plt
plt.plot(x, y)
plt.show()
The chart this code draws (with sample values for x, y)
B2.10Practice2 marks
Write the difference between plt.bar() and plt.barh().
Answer
bar(x, height) draws vertical bars: the categories are on the X-axis. barh(y, width) draws horizontal bars: the categories are on the Y-axis.
B2.11Practice2 marks
Why is a chart easier to understand than a table of numbers? Write two points.
Answer
(1) A chart shows the highest, the lowest and the trend at one look. (2) Large data can be compared quickly, and the picture is remembered for a longer time.
B2.12Practice2 marks
What will this code draw? plt.plot([1, 2, 3], [10, 20, 15], 'g--', marker='o')
Answer
A green dashed line that joins the points (1, 10), (2, 20) and (3, 15). A circle is shown on each of the three points.
The chart this code draws
B2.13Practice2 marks
Write statements to draw a bar chart of the list runs against the list players with red bars and the title 'Runs scored'.
Answer
The first list goes to the X-axis and the second list gives the heights.
The chart this code draws (with sample values for months, sales2026, sales2027)
B2.16Practice2 marks
What is the use of plt.grid(True) and plt.xticks()?
Answer
grid(True) draws light horizontal and vertical lines on the chart so that values can be read easily. xticks() sets the positions and the labels of the marks on the X-axis.
B2.17Practice2 marks
A student wrote plt.show() first and plt.savefig('a.png') after it. The saved picture was blank. Why? Write the correct order.
Answer
After show() the chart is cleared, so nothing is left to save. Write plt.savefig('a.png') first and plt.show() after it.
B2.18Practice2 marks
Write any four functions of pyplot that are used to decorate (customise) a chart.
Answer
title() for the heading, xlabel() and ylabel() for the axis labels, legend() for the key, grid() for grid lines. (Any four.)
B2.19Practice2 marks
Name the three kinds of plots in your syllabus and the pyplot function for each.
Answer
Line plot: plot(). Bar graph: bar() (or barh() for horizontal bars). Histogram: hist().
B2.20Practice2 marks
In a histogram of marks with bins=[0, 20, 40, 60, 80, 100], how many bars are drawn? In which bar does the value 40 fall?
Answer
Five bars, one for each interval. The value 40 falls in the third bar (40 to 60), because each interval includes its left edge. Only the last interval includes both edges.
B2.21Practice2 marks
Write the use of the width and color parameters of plt.bar().
Answer
width sets the thickness of the bars (the default is 0.8). color sets the colour of the bars; a list of colours gives a different colour to each bar.
B2.22Practice2 marks
A DataFrame df has the columns Year and Profit. Write statements to draw a line chart of Profit against Year.
Answer
The two columns are given to plot().
plt.plot(df['Year'], df['Profit'])
plt.show()
The chart this code draws (with sample values for df)
B2.23Practice2 marks
What is the use of the marker and markersize parameters? Give one example.
Answer
marker puts a symbol on each data point and markersize sets how big the symbol is.
plt.plot(x, y, marker='*', markersize=10)
The chart this code draws (with sample values for x, y)
B2.24Practice2 marks
Which chart will you use to show the heights of 200 students in the ranges 140-150, 150-160 and so on? Give a reason.
Answer
Histogram, because height is continuous numeric data and we want to see how many students fall in each range (frequency distribution).
B3SQL functions: query and output2 marks · 45 questions
B3.1SQP 2026-272 marks
A table EMPLOYEE has a column Ename. Write an SQL query to display the last three characters of each Ename.
Write the output of the query SELECT INSTR('Informatics', 'ma');
Answer
(i)
SELECT RIGHT(Ename, 3) FROM EMPLOYEE;
(ii)
6
B3.2Practice2 marks
The table PATIENT has the columns PNo, PName, Dept, Days, Bill, DOA. Write an SQL query to display the last two characters of each PName.
Write the output of the query SELECT MID('Education', 4, 3);
Answer
(i)
SELECT RIGHT(PName, 2) FROM PATIENT;
(ii)
cat
B3.3Practice2 marks
The table EMPLOYEE has the columns ENo, EName, Dept, Salary, Bonus, DOJ. Write an SQL query to display the first three characters of each EName.
Write the output of the query SELECT MOD(80, 3);
Answer
(i)
SELECT LEFT(EName, 3) FROM EMPLOYEE;
(ii)
2
B3.4Practice2 marks
The table BOOK has the columns BNo, Title, Genre, Pages, Price, DOP. Write an SQL query to display the Title in capital letters.
Write the output of the query SELECT UCASE(DAYNAME('2027-01-01'));
Answer
(i)
SELECT UCASE(Title) FROM BOOK;
(ii)
FRIDAY
B3.5Practice2 marks
The table STUDENT has the columns RNo, SName, Stream, Marks, Fees, DOB. Write an SQL query to display each SName and the number of characters in it.
Write the output of the query SELECT LEFT('Network', 5);
Answer
(i)
SELECT SName, LENGTH(SName) FROM STUDENT;
(ii)
Netwo
B3.6Practice2 marks
The table PRODUCT has the columns PCode, PName, Company, Stock, Price, MfgDate. Write an SQL query to display each PName and the name of the month of MfgDate.
Write the output of the query SELECT POWER(2, 2);
Answer
(i)
SELECT PName, MONTHNAME(MfgDate) FROM PRODUCT;
(ii)
4
B3.7Practice2 marks
The table MEMBER has the columns MNo, MName, Plan, Months, Fee, JoinDate. Write an SQL query to display each MName and its Fee rounded to one decimal place.
Write the output of the query SELECT ROUND(163.769, 1);
Answer
(i)
SELECT MName, ROUND(Fee, 1) FROM MEMBER;
(ii)
163.8
B3.8Practice2 marks
The table TICKET has the columns TNo, Passenger, Dest, Seats, Fare, TravelDate. Write an SQL query to display three characters of each Passenger, starting from the second character.
Write the output of the query SELECT LENGTH('Data Science');
Answer
(i)
SELECT MID(Passenger, 2, 3) FROM TICKET;
(ii)
12
B3.9Practice2 marks
The table MOVIE has the columns MNo, Title, Genre, Minutes, Rating, RelDate. Write an SQL query to display each Title and the name of the week day of RelDate.
Write the output of the query SELECT INSTR('Matplotlib', 'at');
Answer
(i)
SELECT Title, DAYNAME(RelDate) FROM MOVIE;
(ii)
2
B3.10Practice2 marks
The table COURSE has the columns CNo, CName, Mode, Weeks, Fee, StartDate. Write an SQL query to display each CName and its Fee rounded to the nearest whole number.
Write the output of the query SELECT DAYNAME('2024-07-03');
Answer
(i)
SELECT CName, ROUND(Fee) FROM COURSE;
(ii)
Wednesday
B3.11Practice2 marks
The table VEHICLE has the columns VNo, Owner, Type, Km, Tax, RegDate. Write an SQL query to display each Owner and the year of RegDate.
Write the output of the query SELECT LENGTH('Pandas') + INSTR('Pandas', 'n');
Answer
(i)
SELECT Owner, YEAR(RegDate) FROM VEHICLE;
(ii)
9
B3.12Practice2 marks
The table ORDERS has the columns ONo, Customer, City, Qty, Amount, ODate. Write an SQL query to display each Customer and the position of the letter 'a' in it.
Write the output of the query SELECT LENGTH(RTRIM(' Data Science '));
Answer
(i)
SELECT Customer, INSTR(Customer, 'a') FROM ORDERS;
(ii)
14
B3.13Practice2 marks
The table DOCTOR has the columns DNo, DName, Spec, Exp, Fee, DOJ. Write an SQL query to display each DName and the remainder when Exp is divided by 7.
Write the output of the query SELECT RIGHT('Matplotlib', 4);
Answer
(i)
SELECT DName, MOD(Exp, 7) FROM DOCTOR;
(ii)
tlib
B3.14Practice2 marks
The table PLAYER has the columns PNo, PName, Game, Matches, Average, DOB. Write an SQL query to display the last two characters of each PName.
Write the output of the query SELECT SUBSTRING('Programming', 3, 3);
Answer
(i)
SELECT RIGHT(PName, 2) FROM PLAYER;
(ii)
ogr
B3.15Practice2 marks
The table HOSTEL has the columns HNo, SName, Block, Room, Mess, DOA. Write an SQL query to display the first three characters of each SName.
Write the output of the query SELECT MOD(92, 8);
Answer
(i)
SELECT LEFT(SName, 3) FROM HOSTEL;
(ii)
4
B3.16Practice2 marks
The table LOAN has the columns LNo, CName, Type, Years, Rate, StartDate. Write an SQL query to display the CName in capital letters.
Write the output of the query SELECT UCASE(DAYNAME('2025-11-11'));
Answer
(i)
SELECT UCASE(CName) FROM LOAN;
(ii)
TUESDAY
B3.17Practice2 marks
The table STAFF has the columns SNo, SName, Post, Periods, Allowance, DOJ. Write an SQL query to display each SName and the number of characters in it.
Write the output of the query SELECT LEFT('Cyber Safety', 6);
Answer
(i)
SELECT SName, LENGTH(SName) FROM STAFF;
(ii)
Cyber
B3.18Practice2 marks
The table GARMENT has the columns GCode, GName, Fabric, Stock, Price, Launch. Write an SQL query to display each GName and the name of the month of Launch.
Write the output of the query SELECT POWER(7, 2);
Answer
(i)
SELECT GName, MONTHNAME(Launch) FROM GARMENT;
(ii)
49
B3.19Practice2 marks
The table EVENT has the columns ENo, EName, House, Points, Prize, EDate. Write an SQL query to display each EName and its Prize rounded to one decimal place.
Write the output of the query SELECT ROUND(463.804, 1);
Answer
(i)
SELECT EName, ROUND(Prize, 1) FROM EVENT;
(ii)
463.8
B3.20Practice2 marks
The table TRAIN has the columns TNo, TName, Zone, Coaches, Fare, StartDate. Write an SQL query to display three characters of each TName, starting from the second character.
Write the output of the query SELECT LENGTH('Kendriya');
Answer
(i)
SELECT MID(TName, 2, 3) FROM TRAIN;
(ii)
8
B3.21Practice2 marks
The table LAPTOP has the columns LNo, Model, Brand, RAM, Price, Launch. Write an SQL query to display each Model and the name of the week day of Launch.
Write the output of the query SELECT INSTR('Internet', 'rn');
Answer
(i)
SELECT Model, DAYNAME(Launch) FROM LAPTOP;
(ii)
5
B3.22Practice2 marks
The table CLUB has the columns CNo, MName, Activity, Age, Fee, DOJ. Write an SQL query to display each MName and its Fee rounded to the nearest whole number.
Write the output of the query SELECT MONTHNAME('2025-03-17');
Answer
(i)
SELECT MName, ROUND(Fee) FROM CLUB;
(ii)
March
B3.23Practice2 marks
The table FARM has the columns FNo, Farmer, Crop, Acres, Yield, SowDate. Write an SQL query to display each Farmer and the year of SowDate.
Write the output of the query SELECT UPPER(RIGHT('Digital India', 3));
Answer
(i)
SELECT Farmer, YEAR(SowDate) FROM FARM;
(ii)
DIA
B3.24Practice2 marks
The table PATIENT has the columns PNo, PName, Dept, Days, Bill, DOA. Write an SQL query to display each PName and the position of the letter 'a' in it.
Write the output of the query SELECT LENGTH(TRIM(' Sample Paper '));
Answer
(i)
SELECT PName, INSTR(PName, 'a') FROM PATIENT;
(ii)
12
B3.25Practice2 marks
The table EMPLOYEE has the columns ENo, EName, Dept, Salary, Bonus, DOJ. Write an SQL query to display each EName and the remainder when Salary is divided by 7.
Write the output of the query SELECT RIGHT('Data Science', 3);
Answer
(i)
SELECT EName, MOD(Salary, 7) FROM EMPLOYEE;
(ii)
nce
B3.26Practice2 marks
The table BOOK has the columns BNo, Title, Genre, Pages, Price, DOP. Write an SQL query to display the last two characters of each Title.
Write the output of the query SELECT SUBSTRING('Pandas', 2, 4);
Answer
(i)
SELECT RIGHT(Title, 2) FROM BOOK;
(ii)
anda
B3.27Practice2 marks
The table STUDENT has the columns RNo, SName, Stream, Marks, Fees, DOB. Write an SQL query to display the first three characters of each SName.
Write the output of the query SELECT MOD(91, 5);
Answer
(i)
SELECT LEFT(SName, 3) FROM STUDENT;
(ii)
1
B3.28Practice2 marks
The table PRODUCT has the columns PCode, PName, Company, Stock, Price, MfgDate. Write an SQL query to display the PName in capital letters.
Write the output of the query SELECT DAY('2025-03-12') + MONTH('2025-03-12');
Answer
(i)
SELECT UCASE(PName) FROM PRODUCT;
(ii)
15
B3.29Practice2 marks
The table MEMBER has the columns MNo, MName, Plan, Months, Fee, JoinDate. Write an SQL query to display each MName and the number of characters in it.
Write the output of the query SELECT LEFT('Open Source', 9);
Answer
(i)
SELECT MName, LENGTH(MName) FROM MEMBER;
(ii)
Open Sour
B3.30Practice2 marks
The table TICKET has the columns TNo, Passenger, Dest, Seats, Fare, TravelDate. Write an SQL query to display each Passenger and the name of the month of TravelDate.
Write the output of the query SELECT POWER(6, 2);
Answer
(i)
SELECT Passenger, MONTHNAME(TravelDate) FROM TICKET;
(ii)
36
B3.31Practice2 marks
The table MOVIE has the columns MNo, Title, Genre, Minutes, Rating, RelDate. Write an SQL query to display each Title and its Rating rounded to one decimal place.
Write the output of the query SELECT ROUND(94.711, 2);
Answer
(i)
SELECT Title, ROUND(Rating, 1) FROM MOVIE;
(ii)
94.71
B3.32Practice2 marks
The table COURSE has the columns CNo, CName, Mode, Weeks, Fee, StartDate. Write an SQL query to display three characters of each CName, starting from the second character.
Write the output of the query SELECT LENGTH('Cyber Safety');
Answer
(i)
SELECT MID(CName, 2, 3) FROM COURSE;
(ii)
12
B3.33Practice2 marks
The table VEHICLE has the columns VNo, Owner, Type, Km, Tax, RegDate. Write an SQL query to display each Owner and the name of the week day of RegDate.
Write the output of the query SELECT INSTR('Kendriya', 'i');
Answer
(i)
SELECT Owner, DAYNAME(RegDate) FROM VEHICLE;
(ii)
6
B3.34Practice2 marks
The table ORDERS has the columns ONo, Customer, City, Qty, Amount, ODate. Write an SQL query to display each Customer and its Amount rounded to the nearest whole number.
Write the output of the query SELECT MONTH('2027-04-18');
Answer
(i)
SELECT Customer, ROUND(Amount) FROM ORDERS;
(ii)
4
B3.35Practice2 marks
The table DOCTOR has the columns DNo, DName, Spec, Exp, Fee, DOJ. Write an SQL query to display each DName and the year of DOJ.
Write the output of the query SELECT LCASE(LEFT('Programming', 5));
Answer
(i)
SELECT DName, YEAR(DOJ) FROM DOCTOR;
(ii)
progr
B3.36Practice2 marks
The table PLAYER has the columns PNo, PName, Game, Matches, Average, DOB. Write an SQL query to display each PName and the position of the letter 'a' in it.
Write the output of the query SELECT LENGTH(RTRIM(' Digital India '));
Answer
(i)
SELECT PName, INSTR(PName, 'a') FROM PLAYER;
(ii)
14
B3.37Practice2 marks
The table HOSTEL has the columns HNo, SName, Block, Room, Mess, DOA. Write an SQL query to display each SName and the remainder when Room is divided by 7.
Write the output of the query SELECT RIGHT('Network', 2);
Answer
(i)
SELECT SName, MOD(Room, 7) FROM HOSTEL;
(ii)
rk
B3.38Practice2 marks
The table LOAN has the columns LNo, CName, Type, Years, Rate, StartDate. Write an SQL query to display the last two characters of each CName.
Write the output of the query SELECT MID('Network', 3, 4);
Answer
(i)
SELECT RIGHT(CName, 2) FROM LOAN;
(ii)
twor
B3.39Practice2 marks
The table STAFF has the columns SNo, SName, Post, Periods, Allowance, DOJ. Write an SQL query to display the first three characters of each SName.
Write the output of the query SELECT MOD(38, 7);
Answer
(i)
SELECT LEFT(SName, 3) FROM STAFF;
(ii)
3
B3.40Practice2 marks
The table GARMENT has the columns GCode, GName, Fabric, Stock, Price, Launch. Write an SQL query to display the GName in capital letters.
Write the output of the query SELECT MOD(YEAR('2027-04-26'), 100);
Answer
(i)
SELECT UCASE(GName) FROM GARMENT;
(ii)
27
B3.41Practice2 marks
The table EVENT has the columns ENo, EName, House, Points, Prize, EDate. Write an SQL query to display each EName and the number of characters in it.
Write the output of the query SELECT LEFT('Computer', 5);
Answer
(i)
SELECT EName, LENGTH(EName) FROM EVENT;
(ii)
Compu
B3.42Practice2 marks
The table TRAIN has the columns TNo, TName, Zone, Coaches, Fare, StartDate. Write an SQL query to display each TName and the name of the month of StartDate.
Write the output of the query SELECT POWER(2, 4);
Answer
(i)
SELECT TName, MONTHNAME(StartDate) FROM TRAIN;
(ii)
16
B3.43Practice2 marks
The table LAPTOP has the columns LNo, Model, Brand, RAM, Price, Launch. Write an SQL query to display each Model and its Price rounded to one decimal place.
Write the output of the query SELECT ROUND(730.203);
Answer
(i)
SELECT Model, ROUND(Price, 1) FROM LAPTOP;
(ii)
730
B3.44Practice2 marks
The table CLUB has the columns CNo, MName, Activity, Age, Fee, DOJ. Write an SQL query to display three characters of each MName, starting from the second character.
Write the output of the query SELECT LENGTH('Computer');
Answer
(i)
SELECT MID(MName, 2, 3) FROM CLUB;
(ii)
8
B3.45Practice2 marks
The table FARM has the columns FNo, Farmer, Crop, Acres, Yield, SowDate. Write an SQL query to display each Farmer and the name of the week day of SowDate.
Write the output of the query SELECT INSTR('Vidyalaya', 'y');
Answer
(i)
SELECT Farmer, DAYNAME(SowDate) FROM FARM;
(ii)
4
B4Network short answers2 marks · 44 questions
B4.1SQP 2026-272 marks
What is a star topology? Write one advantage of it.
Answer
In a star topology every computer is connected to a central device (hub or switch) with its own cable. Advantage: if one computer or one cable fails, the others keep working; a fault is easy to find.
B4.2SQP 2026-272 marks
What is VoIP? Write one advantage of it.
Answer
VoIP means Voice over Internet Protocol. It lets us make voice calls over the Internet: the voice is changed into data packets. Advantage: calls, even long-distance ones, are very cheap.
B4.3Practice2 marks
Write two differences between a hub and a switch.
Answer
(1) A hub sends the data it receives to all the computers connected to it; a switch sends it only to the computer it is meant for. (2) So a hub causes more traffic and is slower; a switch is faster and safer.
B4.4Practice2 marks
Write two differences between LAN and WAN.
Answer
(1) A LAN covers a small area such as a room, building or campus; a WAN covers countries and continents. (2) A LAN is usually owned by one organisation and is fast; a WAN uses public links such as telephone lines and satellites, and is slower and costlier.
B4.5Practice2 marks
Write two differences between a static web page and a dynamic web page.
Answer
(1) The content of a static page stays the same for every visitor; the content of a dynamic page changes with the user, time or data. (2) A static page is made with HTML only and is quick to load; a dynamic page uses scripts and usually a database (example: a result page).
B4.6Practice2 marks
Write two differences between a website and a web page.
Answer
(1) A web page is one document on the Web; a website is a collection of related web pages. (2) A web page has its own URL; a website has one domain name, and its first page is the home page.
B4.7Practice2 marks
What is a repeater? When is it needed?
Answer
A repeater is a device that receives a weak signal, makes it strong again and sends it forward. It is needed when the cable between two points is long (more than about 100 m), because the signal becomes weak over distance.
B4.8Practice2 marks
What is a modem? Why is it needed?
Answer
Modem means modulator-demodulator. It changes the digital signals of a computer into analog signals for a telephone line (modulation) and changes the incoming analog signals back to digital (demodulation). It is needed to connect a computer to the Internet through such lines.
B4.9Practice2 marks
What is a router? How is it different from a switch?
Answer
A router connects two or more networks and sends data along the best path. A switch connects the computers inside one network; a router connects different networks, for example a home LAN to the Internet.
B4.10Practice2 marks
What is a gateway?
Answer
A gateway is a device that connects two networks which work in different ways (use different protocols). It acts as the entry and exit point of a network, for example between a LAN and the Internet.
B4.11Practice2 marks
Write two differences between star and bus topologies.
Answer
(1) In a star, every computer is connected to a central device; in a bus, all the computers are connected to one main cable. (2) A star needs more cable but a fault is easy to find; a bus needs less cable, but if the main cable breaks the whole network stops.
B4.12Practice2 marks
What is a mesh topology? Write one advantage and one disadvantage.
Answer
In a mesh topology every computer is connected to every other computer. Advantage: if one link fails, data takes another path, so it is very reliable. Disadvantage: it needs a lot of cable, so it is costly.
B4.13Practice2 marks
What is a tree topology?
Answer
A tree topology joins groups of star networks to one main (bus) cable, so it looks like the branches of a tree. It is easy to expand, but if the main cable fails the groups cannot talk to each other.
B4.14Practice2 marks
What is a URL? Name its parts with an example.
Answer
URL means Uniform Resource Locator. It is the unique address of a resource on the Web. In https://www.kvs.ac.in/result.html, https is the protocol, www.kvs.ac.in is the domain name and result.html is the file (page) name.
B4.15Practice2 marks
Write the difference between the Internet and the World Wide Web.
Answer
The Internet is a worldwide network of networks: the cables, devices and connections. The World Wide Web is a service that runs on the Internet: a collection of linked web pages that we open in a browser. E-mail and VoIP are other services of the Internet.
B4.16Practice2 marks
What is a web browser? Name any two.
Answer
A web browser is a program that asks a web server for a web page and shows it on the screen. Examples: Google Chrome, Mozilla Firefox, Microsoft Edge, Safari. (Any two.)
B4.17Practice2 marks
What is a web server?
Answer
A web server is a computer (and its software) that stores websites and sends the web pages to browsers when they ask for them. Example of web server software: Apache.
B4.18Practice2 marks
What is web hosting? Why is it needed?
Answer
Web hosting is a service that gives space on a web server to store the files of a website. It is needed so that the website is connected to the Internet all the time and anyone can open it.
B4.19Practice2 marks
What are cookies? Write one use.
Answer
Cookies are small text files that a website saves on the user's computer through the browser. They remember the user's details, such as login name, language or items in the cart, so that the site can show them on the next visit.
B4.20Practice2 marks
Write the difference between add-ons and plug-ins of a browser.
Answer
An add-on (extension) adds a new feature to the browser itself, such as an ad blocker or a dictionary. A plug-in is a separate program that helps the browser to show content it cannot handle on its own, such as some video or document formats.
B4.21Practice2 marks
Write any two settings of a web browser that a user can change.
Answer
Any two: set the home page; clear the browsing history and cookies; block pop-ups; choose the default search engine; save or remove passwords; turn on private browsing.
B4.22Practice2 marks
What is e-mail? Write two advantages.
Answer
E-mail (electronic mail) is a service to send and receive messages over the Internet. Advantages: it reaches in seconds anywhere in the world; files such as photos and documents can be attached; it costs almost nothing. (Any two.)
B4.23Practice2 marks
Write the difference between e-mail and chat.
Answer
E-mail is like a letter: the message waits in the mailbox and the other person may read it later. Chat is live: both persons are online and the typed messages are received at once.
B4.24Practice2 marks
Expand:
PAN
MAN
URL
WWW.
Answer
(i) Personal Area Network (ii) Metropolitan Area Network (iii) Uniform Resource Locator (iv) World Wide Web.
B4.25Practice2 marks
What is a computer network? Write two advantages.
Answer
A computer network is a group of computers and devices connected to each other to share data and resources. Advantages: files and data are shared quickly; costly devices such as printers are shared; people communicate by e-mail and chat. (Any two.)
B4.26Practice2 marks
Classify each as PAN, LAN, MAN or WAN:
A phone connected to a smart watch
Computers of a school lab
Offices of a company in Delhi and London
A cable TV network in a city.
Answer
(i) PAN (ii) LAN (iii) WAN (iv) MAN.
B4.27Practice2 marks
What is a PAN? Give two examples.
Answer
A Personal Area Network connects the devices of one person within about 10 metres. Examples: a phone connected to earbuds by Bluetooth; a laptop connected to a wireless mouse; a phone sharing its hotspot with a laptop. (Any two.)
B4.28Practice2 marks
What is a MAN? Give one example.
Answer
A Metropolitan Area Network covers a city or a large town. It is bigger than a LAN and smaller than a WAN. Example: a cable TV network, or the network that joins all the branches of a bank in one city.
B4.29Practice2 marks
In a network layout, where should the server be placed and why?
Answer
The server is placed in the block that has the largest number of computers. Most of the data then travels inside that block, so the traffic on the links between blocks and the cable cost are less.
B4.30Practice2 marks
Which device will you use in each case?
To connect all the computers of one block.
Between two blocks that are 150 m apart.
Answer
(i) Switch (or hub), because it connects many computers of a LAN. (ii) Repeater, because the signal becomes weak beyond about 100 m and must be made strong again.
B4.31Practice2 marks
A school wants a website where parents can log in and see the marks of their ward. Should it be static or dynamic? Give a reason.
Answer
Dynamic. The page must show different marks to different parents, taken from a database. A static page shows the same content to everyone.
B4.32Practice2 marks
Write two advantages of the star topology over the bus topology.
Answer
(1) If one computer or cable fails, the rest of the network keeps working. (2) A fault is easy to find and a new computer is easy to add, without stopping the network.
B4.33Practice2 marks
What is the home page of a website?
Answer
The home page is the first (main) page of a website. It opens when we type the address of the site, and it has links to the other pages of the site.
B4.34Practice2 marks
Name the device for each:
Connects networks that use different protocols
Chooses the best path for data between networks.
Answer
(i) Gateway (ii) Router.
B4.35Practice2 marks
What is the use of the World Wide Web? Name any two of its applications.
Answer
The Web lets us open linked pages of text, pictures, sound and video from anywhere. Applications: information search, e-mail on the web, online shopping, online classes, social networking. (Any two.)
B4.36Practice2 marks
Your friend says that cookies are viruses. Is it correct? Explain.
Answer
No. Cookies are plain text files, not programs, so they cannot run or harm the computer. But they store data about the user, so they can affect privacy. They can be deleted from the browser settings.
B4.37Practice2 marks
Write one difference between a domain name and a URL with an example.
Answer
A domain name is the name of a website, such as cbse.gov.in. A URL is the full address of one page or file, including the protocol and the path, such as https://www.cbse.gov.in/newsite/index.html.
B4.38Practice2 marks
Why is a switch preferred to a hub in a school lab? Write two reasons.
Answer
(1) A switch sends the data only to the computer it is meant for, so the network is faster. (2) Other computers do not receive the data, so it is safer.
B4.39Practice2 marks
What is the difference between a web browser and a web server?
Answer
A web browser is a program on the user's computer that asks for web pages and shows them. A web server is a computer on the Internet that stores the pages and sends them to the browser.
B4.40Practice2 marks
What is the role of a modem and a router in a home Internet connection?
Answer
The modem connects the home to the Internet line of the service provider and changes the signals. The router shares this one connection among the phones and computers of the home and sends the data to the right device.
B4.41Practice2 marks
Write any two differences between a LAN and a MAN.
Answer
(1) A LAN covers a building or campus; a MAN covers a city. (2) A LAN is owned by one organisation; a MAN is often run by a service provider and joins many LANs.
B4.42Practice2 marks
What is an add-on? Give two examples.
Answer
An add-on (extension) is a small program that is added to a browser to give it an extra feature. Examples: an ad blocker, a password manager, a grammar checker, a dark-mode extension. (Any two.)
B4.43Practice2 marks
Which application of the Internet will you use for each?
A free voice call to a cousin abroad.
Sending a project file to your teacher.
Answer
(i) VoIP. (ii) E-mail (with the file as an attachment).
B4.44Practice2 marks
What is a bus topology? Write one advantage and one disadvantage.
Answer
All the computers are connected to one main cable called the backbone. Advantage: it needs the least cable and is cheap. Disadvantage: if the main cable breaks, the whole network stops, and a fault is hard to find.
B5Societal impacts short answers2 marks · 44 questions
B5.1SQP 2026-272 marks
Write the difference between an active and a passive digital footprint.
Answer
An active digital footprint is the data we share on purpose, such as posts, comments and e-mails. A passive digital footprint is the data collected without our action, such as the sites we visit, our location and our search history.
B5.2SQP 2026-272 marks
Write any two net etiquettes (netiquettes) that a good Internet user follows.
Answer
(1) Be ethical: do not copy others' work, and share only true information. (2) Be respectful: be polite, respect the privacy and views of others. Also: be responsible; do not feed the trolls. (Any two, with a line on each.)
B5.3Practice2 marks
What is a digital footprint? Why should we be careful about it?
Answer
A digital footprint is the trail of data we leave when we use the Internet. It stays for a very long time and can be seen by others, so a careless post can harm our image, admission or job later.
B5.4Practice2 marks
What is plagiarism? Write two ways to avoid it.
Answer
Plagiarism is using someone else's work or ideas as our own without giving credit. To avoid it: (1) write in your own words, (2) name the source (cite it), and put copied lines in quotation marks.
B5.5Practice2 marks
Write the difference between copyright and patent.
Answer
Copyright protects original creative work such as books, music, films and software; it is given to the creator automatically. A patent protects an invention; it must be applied for and is given for a fixed period (20 years).
B5.6Practice2 marks
Write the difference between copyright and trademark.
Answer
Copyright protects creative work such as a book, a song or a program. A trademark protects the name, logo or symbol by which the goods of a company are known.
B5.7Practice2 marks
What are Intellectual Property Rights? Name any two.
Answer
They are the legal rights of a person over the things created by his or her mind, such as inventions, writings, designs and brand names. Examples: copyright, patent, trademark. (Any two.)
B5.8Practice2 marks
What is FOSS? Give two examples.
Answer
FOSS means Free and Open Source Software. Its source code is given to everyone, and users are free to use, study, change and share it. Examples: Linux, LibreOffice, Python, Mozilla Firefox. (Any two.)
B5.9Practice2 marks
Write two differences between open source software and proprietary software.
Answer
(1) The source code of open source software is available to all; the source code of proprietary software is kept secret by the company. (2) Open source software can be changed and shared freely; proprietary software needs a paid licence and cannot be changed or shared.
B5.10Practice2 marks
What is a software licence? Name any two public licences.
Answer
A licence is a legal permission that tells how a software or work may be used, copied and shared. Public licences: GNU General Public License (GPL), Creative Commons (CC), Apache licence. (Any two.)
B5.11Practice2 marks
What is hacking? How is an ethical hacker different from a cracker?
Answer
Hacking is getting into a computer or network without permission. An ethical hacker does it with permission to find weak points so that they can be fixed. A cracker does it to steal or damage, which is a crime.
B5.12Practice2 marks
What is phishing? Write two ways to stay safe from it.
Answer
Phishing is cheating a person through a fake e-mail, message or website that looks real, to get passwords or bank details. Safety: (1) do not click on unknown links; check the address of the site, (2) never share OTP, PIN or password with anyone.
B5.13Practice2 marks
What is cyber bullying? What should a student do if it happens?
Answer
Cyber bullying is troubling, threatening or insulting a person again and again through the Internet or phone. The student should not reply, should keep the proof (screenshots), block the person and tell parents or a teacher. It can be reported on the cyber crime portal.
B5.14Practice2 marks
What is the Information Technology Act, 2000? Write its two purposes.
Answer
It is the main cyber law of India (amended in 2008). (1) It gives legal recognition to electronic records and digital signatures. (2) It defines cyber crimes such as hacking and identity theft and fixes the punishment for them.
B5.15Practice2 marks
What is e-waste? Write two harmful effects of it.
Answer
E-waste is old or discarded electrical and electronic items such as phones, computers and batteries. (1) It has lead, mercury and cadmium, which poison the soil and water. (2) Burning it pollutes the air and causes breathing and skin diseases.
B5.16Practice2 marks
Write any two ways of managing e-waste.
Answer
(1) Reduce: buy a new gadget only when needed and use it for a longer time. (2) Reuse or refurbish: donate or repair and use old gadgets. (3) Recycle: give the waste to an authorised recycler who recovers the useful metals. (Any two.)
B5.17Practice2 marks
Write two health problems caused by the over-use of technology and one way to prevent each.
Answer
(1) Eye strain: look away from the screen at regular intervals and keep the screen at arm's length. (2) Back, neck and wrist pain: sit straight on a proper chair and take short breaks.
B5.18Practice2 marks
What is data protection? Write two ways to protect your personal data online.
Answer
Data protection means keeping personal data safe from misuse. Ways: use strong and different passwords with two-step verification; do not share personal details on unknown sites; check the privacy settings of apps. (Any two.)
B5.19Practice2 marks
What is identity theft? Give one example.
Answer
Identity theft is stealing someone's personal details and using them to pretend to be that person. Example: making a fake social media profile with a person's name and photo, or using stolen card details for shopping.
B5.20Practice2 marks
What is software piracy? Why is it wrong?
Answer
Software piracy is copying, using or selling a software without buying its licence. It is illegal, it takes away the earning of the people who made the software, and pirated copies may carry viruses.
B5.21Practice2 marks
Write two differences between freeware and free and open source software.
Answer
(1) Freeware costs nothing but its source code is not given; FOSS gives the source code. (2) Freeware cannot be changed by the user; FOSS can be changed and shared.
B5.22Practice2 marks
What is the difference between recycling and refurbishing of e-waste?
Answer
Recycling breaks the old item into parts and materials such as metal, plastic and glass, which are used to make new products. Refurbishing repairs the old item so that the same item can be used again.
B5.23Practice2 marks
Write any two points you will keep in mind while using social media.
Answer
(1) Do not share personal details such as address, phone number and passwords. (2) Think before posting: a post stays for ever. (3) Do not accept requests from strangers. (4) Check a message before forwarding it. (Any two.)
B5.24Practice2 marks
What is a strong password? Write two points.
Answer
(1) It is long (8 or more characters) and has capital letters, small letters, digits and symbols. (2) It does not have a name, date of birth or a common word, and it is different for every account.
B5.25Practice2 marks
What is copyright infringement? Give one example.
Answer
It is using a copyrighted work without the permission of its owner. Example: downloading a new film from an illegal site, or using a photograph from the Internet in an advertisement without permission.
B5.26Practice2 marks
Rohan copied the code of a classmate's project and submitted it as his own. Name this act. Write one thing he should have done.
Answer
Plagiarism. He should have written his own code, or taken permission and clearly given credit to the classmate.
B5.27Practice2 marks
Why is it said that the digital footprint is permanent?
Answer
Once something is posted, copies of it are saved on servers and may be shared or saved by other users. Even if we delete it from our account, it can remain elsewhere on the Internet.
B5.28Practice2 marks
Write two ways in which a school can reduce its e-waste.
Answer
(1) Repair and upgrade old computers and use them for a longer time. (2) Donate working machines and give the dead ones only to an authorised e-waste recycler.
B5.29Practice2 marks
What is ergonomics in computer use? Write one example.
Answer
Ergonomics means arranging the work place so that the body is comfortable and safe. Example: keeping the top of the screen at eye level and the feet flat on the floor while working.
B5.30Practice2 marks
Mention two do's for safe online transactions.
Answer
(1) Use only trusted sites and apps; check for https and the lock sign. (2) Never share OTP, PIN or CVV; log out after the work, and do not use public Wi-Fi for payments.
B5.31Practice2 marks
What is a Creative Commons licence?
Answer
It is a public licence that lets a creator give others the right to use, share and sometimes change the work for free, under conditions chosen by the creator, such as giving credit to the creator.
B5.32Practice2 marks
Write the difference between hacking and phishing.
Answer
In hacking, a person breaks into a computer or account without permission using technical tricks. In phishing, the person is fooled by a fake message or website into giving the password or bank details himself.
B5.33Practice2 marks
Why should we not connect to any free public Wi-Fi for banking work?
Answer
Public Wi-Fi is often not secured. Others on the same network may read the data we send, such as passwords and card numbers, and misuse them.
B5.34Practice2 marks
What does 'be responsible' mean as a net etiquette? Give two points.
Answer
(1) Do not share personal information of yourself or of others. (2) Think before you post or forward, and avoid cyber bullying.
B5.35Practice2 marks
What does 'be ethical' mean as a net etiquette? Give two points.
Answer
(1) Do not use copyrighted material without permission (no piracy, no plagiarism). (2) Share only knowledge and information that is true and useful.
B5.36Practice2 marks
Write two harmful materials present in e-waste and the harm each causes.
Answer
Lead (in batteries and monitors) damages the brain and kidneys. Mercury (in switches and screens) harms the nervous system. Cadmium (in batteries) damages the kidneys and bones. (Any two.)
B5.37Practice2 marks
What is the role of the cyber crime portal of India? What kind of complaints can be made there?
Answer
The National Cyber Crime Reporting Portal lets citizens report cyber crimes online. Complaints of online cheating, cyber bullying, fake profiles, hacking and crimes against women and children can be made there.
B5.38Practice2 marks
Your phone is slow, so you plan to throw it in the dustbin. Write two better options.
Answer
(1) Get it repaired or reset and keep using it, or give it to someone who needs it. (2) If it cannot be used, give it to an authorised e-waste collection centre or the company's take-back scheme.
B5.39Practice2 marks
Write two points of difference between a patent and a trademark.
Answer
(1) A patent protects an invention; a trademark protects a brand name, logo or symbol. (2) A patent is valid for a fixed period (20 years); a trademark can be renewed again and again.
B5.40Practice2 marks
How does excessive use of social media affect a student? Write two points.
Answer
(1) It wastes study and sleep time and reduces concentration. (2) It can cause stress, loneliness and a habit that is hard to break. Limited and planned use avoids this.
B5.41Practice2 marks
What is meant by 'digital property rights'? Give one example.
Answer
They are the rights of a person over the digital things he or she has created, such as a website, a software, an e-book or a digital photo. Example: a photographer's right over the photos she uploads.
B5.42Practice2 marks
Which Intellectual Property Right will protect each of these?
A new kind of water purifier.
The logo of a shoe company.
Answer
(i) Patent (ii) Trademark.
B5.43Practice2 marks
Write two effects of long hours of gaming on a child's health.
Answer
(1) Eye strain, headache and poor sleep. (2) Less physical activity, which leads to weight gain and back or neck pain.
B5.44Practice2 marks
What should you check before you download a picture from the Internet for your school magazine?
Answer
Check whether the picture is copyrighted and under which licence it is shared. Use it only if the licence allows it (for example Creative Commons) or after taking permission, and give credit to the owner.
Section C · 3 marks each
C1Societal impacts: three situations3 marks · 24 questions
C1.1SQP 2026-273 marks
Read the three situations and answer.
Meena gets an e-mail that looks like it is from her bank. It asks her to click a link and enter her ATM PIN. Name this cyber crime.
A group of classmates keeps posting insulting comments on Arun's photos every day. Name this act.
Write one net etiquette that tells us to share only verified information in polite language.
Answer
Phishing.
Cyber bullying.
Be credible / be polite: share only verified information and use polite language.
C1.2Practice3 marks
Ravi downloaded a paid game from an illegal website and shared it with his friends.
Name the wrong act done by Ravi.
Which right of the game company is violated?
Write one legal way in which Ravi can get games.
Answer
Software piracy.
Copyright (an Intellectual Property Right).
Buy the game from the official store, or use free and open source games.
C1.3Practice3 marks
A company throws its old computers in an open ground outside the city.
What is such waste called?
Write one harm it causes to the environment.
Suggest one correct way to dispose of it.
Answer
E-waste.
Metals such as lead and mercury mix with the soil and ground water and poison them.
Give it to an authorised e-waste recycler (or donate the working computers).
C1.4Practice3 marks
Sana copied three pages from a website into her project report and did not mention the source.
Name this act.
Is it ethical? Give a reason.
Write one way in which she can use the material correctly.
Answer
Plagiarism.
No. She is showing another person's work as her own.
Write it in her own words and mention the source (citation); put copied lines in quotes.
C1.5Practice3 marks
Karan uses the same password 'karan123' for his e-mail, his bank and his social media.
Write one risk of this habit.
Write two features of a strong password.
Name one more step that makes an account safer.
Answer
If one account is hacked, all his accounts can be opened.
It is long, and it mixes capital letters, small letters, digits and symbols.
Two-step verification (OTP).
C1.6Practice3 marks
Anita's photo and name are used by an unknown person to make a fake profile and send messages to her friends.
Name this cyber crime.
Under which Act of India can action be taken?
Write one step Anita should take at once.
Answer
Identity theft.
The Information Technology Act, 2000.
Report the profile to the site, tell her parents, and complain on the cyber crime portal or to the police.
C1.7Practice3 marks
A scientist has made a new low-cost machine that cleans river water.
Which Intellectual Property Right should she apply for?
She has also designed a logo for her company. Which right protects it?
Why are such rights given?
Answer
Patent.
Trademark.
So that the creator gets credit and money for the work, and others cannot copy it without permission. This encourages new inventions.
C1.8Practice3 marks
Dev plays games on his phone for six hours every day.
Write two health problems he may face.
Write one bad effect on his studies or behaviour.
Suggest two good habits for him.
Answer
Eye strain and headache; neck and back pain; poor sleep. (Any two.)
Less time and attention for studies; he may become irritable and stay away from family and friends.
Fix a time limit for the screen; take breaks and play outdoor games.
C1.9Practice3 marks
A school wants to install software on 60 computers but has a small budget.
Which kind of software should it choose: proprietary or free and open source?
Write one reason.
Name one such operating system and one office package.
Answer
Free and open source software.
It costs nothing, can be installed on any number of computers legally, and can be changed as needed.
Linux (for example Ubuntu); LibreOffice.
C1.10Practice3 marks
Neha posts her daily location and photos of her house on a public social media account.
Which kind of digital footprint is she creating?
Write one danger of this habit.
Write one setting or habit that will make her safer.
Answer
Active digital footprint.
Strangers come to know where she lives and when the house is empty; the photos can be misused.
Keep the account private and do not share location and personal details.
C1.11Practice3 marks
Mohan received a call saying that his electricity will be cut tonight unless he installs an app and shares the OTP.
What kind of act is this?
What should Mohan do?
Where can he report it?
Answer
Online fraud (a phishing or vishing attempt).
He should not install the app or share the OTP, and should cut the call.
On the National Cyber Crime Reporting Portal or the helpline 1930, or at the nearest police station.
C1.12Practice3 marks
An author finds that her e-book is being sold on another website without her permission.
Which right of the author is violated?
What is this violation called?
Name the licence she could use if she wants people to share her book freely with credit to her.
Answer
Copyright.
Copyright infringement.
A Creative Commons licence.
C1.13Practice3 marks
A shopkeeper repairs old laptops, puts new batteries in them and sells them at a low price.
What is this process called?
Which 'R' of e-waste management does a buyer of such a laptop follow?
Write one benefit of this to the environment.
Answer
Refurbishing.
Reuse.
Less e-waste is thrown away and fewer new raw materials are needed.
C1.14Practice3 marks
During an online class, some students type rude jokes in the chat box and share the meeting link with outsiders.
Which rules of behaviour are they breaking?
Write two such rules for an online class.
What can be the result of sharing the link?
Answer
Net etiquettes (netiquette).
Be polite and respectful in chat; keep the microphone muted when not speaking; do not disturb the class. (Any two.)
Unknown persons can enter the class, disturb it and misuse the names and pictures of the students.
C1.15Practice3 marks
A website asks Tina to accept cookies.
What are cookies?
Write one benefit of cookies to Tina.
Write one privacy concern about cookies.
Answer
Small text files that a website saves on the user's computer through the browser.
The site remembers her login, language and cart items, so she need not enter them again.
They record her browsing habits, which can be used to track her and show targeted advertisements.
C1.16Practice3 marks
Arjun got the admin password of his school website by watching the teacher type it. He then changed the notices on the site as a joke.
Name the cyber crime.
Is it punishable in India? Name the law.
What should a responsible student have done?
Answer
Hacking (unauthorised access).
Yes, under the Information Technology Act, 2000.
He should not have used the password, and should have told the teacher to change it.
C1.17Practice3 marks
Priya writes a blog. She wants to use a song and some pictures made by others in it.
What should she check first?
What must she do if the work is copyrighted?
What must she do even if the work is free to use?
Answer
Whether the work is copyrighted, and under which licence it is shared.
Take permission from the owner (or pay for the licence).
Give credit to the creator, as the licence asks.
C1.18Practice3 marks
An office worker types for eight hours a day and now has pain in the wrists and neck.
Name the health problem linked to such repeated work.
Write two changes in the sitting arrangement that will help.
Write one habit that reduces eye strain.
Answer
Repetitive strain injury.
Keep the keyboard at elbow height with the wrists straight; keep the screen at eye level and sit with back support.
Look at a far object for a few seconds at regular intervals and blink often.
C1.19Practice3 marks
A social media app collects the contact list and location of its users without telling them clearly.
Which kind of digital footprint is being made for the users?
Which right of the users is affected?
Write one step a user can take.
Answer
Passive digital footprint.
Right to privacy (protection of personal data).
Check the app permissions and turn off the ones that are not needed; read the privacy policy.
C1.20Practice3 marks
Raj forwards every message he receives, including a false message about a medicine.
Which net etiquette is he not following?
Write one harm such forwards can cause.
What should he do before forwarding a message?
Answer
Be credible / be responsible: share only true information.
People may believe the false message and harm their health; it spreads fear and rumours.
Check the message from a trusted source; if not sure, do not forward it.
C1.21Practice3 marks
A college student builds a useful app. She wants everyone to see, improve and share its code.
Which kind of software should she release it as?
Name one licence she can use.
Write one benefit to other programmers.
Answer
Free and open source software.
GNU General Public License (GPL), or the Apache licence.
They can study the code, learn from it, fix errors and add new features.
C1.22Practice3 marks
Sumit's old phone has a swollen battery and does not start.
Should he throw it in the dustbin? Give a reason.
Name one harmful substance in it.
Where should he give it?
Answer
No. It can catch fire, and its chemicals pollute the soil and water.
Lead, cadmium or lithium. (Any one.)
At an authorised e-waste collection centre or the company's take-back counter.
C1.23Practice3 marks
A stranger whom Riya met in an online game asks for her school name and photo.
Should she share them? Give a reason.
Write one safe step she should take.
Write one rule for making friends online.
Answer
No. The stranger may not be who he says he is and can misuse the details.
Block and report the player, and tell her parents.
Do not share personal details or meet a person known only online.
C1.24Practice3 marks
A shop prints the logo of a famous sports brand on its own cheap shoes and sells them.
Which Intellectual Property Right is violated?
Who is harmed by this?
How long can the brand keep this right?
Answer
Trademark.
The company (loss of sales and name) and the buyers, who are cheated with fake goods.
As long as it keeps renewing the registration.
C2Series and DataFrame: code and output3 marks · 52 questions
C2.1Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Asha': 49, 'Ravi': 69, 'Tina': 89} and a Series S2 from the dictionary {'Ravi': 78, 'Tina': 62, 'Om': 40}. Display S1 + S2. Also write the output.
Asha NaN
Om NaN
Ravi 147.0
Tina 151.0
dtype: float64
The labels Asha and Om are present in only one Series, so they get NaN. The result becomes float.
C2.2Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Rohit': 84, 'Virat': 118, 'Gill': 34} and a Series S2 from the dictionary {'Virat': 61, 'Gill': 90, 'Rahul': 112}. Display S1 - S2. Also write the output.
Gill -56.0
Rahul NaN
Rohit NaN
Virat 57.0
dtype: float64
The labels Rohit and Rahul are present in only one Series, so they get NaN. The result becomes float.
C2.3Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Jan': 40, 'Feb': 70, 'Mar': 65} and a Series S2 from the dictionary {'Feb': 85, 'Mar': 55, 'Apr': 35}. Display S1 * S2. Also write the output.
Apr NaN
Feb 5950.0
Jan NaN
Mar 3575.0
dtype: float64
The labels Jan and Apr are present in only one Series, so they get NaN. The result becomes float.
C2.4Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Pen': 300, 'Book': 140, 'Bag': 50} and a Series S2 from the dictionary {'Book': 30, 'Bag': 160, 'Box': 130}. Display S1 - S2. Also write the output.
Bag -110.0
Book 110.0
Box NaN
Pen NaN
dtype: float64
The labels Pen and Box are present in only one Series, so they get NaN. The result becomes float.
C2.5Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Delhi': 6, 'Pune': 17, 'Agra': 19} and a Series S2 from the dictionary {'Pune': 13, 'Agra': 18, 'Kochi': 32}. Display S1 - S2. Also write the output.
Agra 1.0
Delhi NaN
Kochi NaN
Pune 4.0
dtype: float64
The labels Delhi and Kochi are present in only one Series, so they get NaN. The result becomes float.
C2.6Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Eng': 70, 'Hin': 60, 'Maths': 75} and a Series S2 from the dictionary {'Hin': 40, 'Maths': 60, 'Sci': 85}. Display S1 * S2. Also write the output.
Eng NaN
Hin 2400.0
Maths 4500.0
Sci NaN
dtype: float64
The labels Eng and Sci are present in only one Series, so they get NaN. The result becomes float.
C2.7Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Jun': 240, 'Jul': 300, 'Aug': 170} and a Series S2 from the dictionary {'Jul': 150, 'Aug': 180, 'Sep': 270}. Display S1 + S2. Also write the output.
Aug 350.0
Jul 450.0
Jun NaN
Sep NaN
dtype: float64
The labels Jun and Sep are present in only one Series, so they get NaN. The result becomes float.
C2.8Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Yoga': 600, 'Dance': 1200, 'Music': 1400} and a Series S2 from the dictionary {'Dance': 1300, 'Music': 1100, 'Art': 700}. Display S1 - S2. Also write the output.
Art NaN
Dance -100.0
Music 300.0
Yoga NaN
dtype: float64
The labels Yoga and Art are present in only one Series, so they get NaN. The result becomes float.
C2.9Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'F1': 160, 'F2': 130, 'F3': 320} and a Series S2 from the dictionary {'F2': 190, 'F3': 170, 'F4': 330}. Display S1 + S2. Also write the output.
The labels F1 and F4 are present in only one Series, so they get NaN. The result becomes float.
C2.10Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Red': 26, 'Blue': 24, 'Green': 38} and a Series S2 from the dictionary {'Blue': 14, 'Green': 28, 'Gold': 10}. Display S1 + S2. Also write the output.
Blue 38.0
Gold NaN
Green 66.0
Red NaN
dtype: float64
The labels Red and Gold are present in only one Series, so they get NaN. The result becomes float.
C2.11Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Anil': 600, 'Bela': 750, 'Chand': 450} and a Series S2 from the dictionary {'Bela': 700, 'Chand': 350, 'Devi': 450}. Display S1 + S2. Also write the output.
Anil NaN
Bela 1450.0
Chand 800.0
Devi NaN
dtype: float64
The labels Anil and Devi are present in only one Series, so they get NaN. The result becomes float.
C2.12Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'P1': 80, 'P2': 115, 'P3': 170} and a Series S2 from the dictionary {'P2': 95, 'P3': 245, 'P4': 35}. Display S1 - S2. Also write the output.
The labels P1 and P4 are present in only one Series, so they get NaN. The result becomes float.
C2.13Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Mon': 95, 'Tue': 110, 'Wed': 65} and a Series S2 from the dictionary {'Tue': 120, 'Wed': 40, 'Thu': 80}. Display S1 + S2. Also write the output.
Mon NaN
Thu NaN
Tue 230.0
Wed 105.0
dtype: float64
The labels Mon and Thu are present in only one Series, so they get NaN. The result becomes float.
C2.14Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'H1': 40, 'H2': 240, 'H3': 260} and a Series S2 from the dictionary {'H2': 220, 'H3': 80, 'H4': 240}. Display S1 - S2. Also write the output.
The labels H1 and H4 are present in only one Series, so they get NaN. The result becomes float.
C2.15Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'A': 17, 'B': 38, 'C': 8} and a Series S2 from the dictionary {'B': 14, 'C': 31, 'D': 9}. Display S1 * S2. Also write the output.
The labels A and D are present in only one Series, so they get NaN. The result becomes float.
C2.16Practice3 marks
Write a Python program to create a Series S1 from the dictionary {'Mon': 275, 'Tue': 200, 'Wed': 125} and a Series S2 from the dictionary {'Tue': 375, 'Wed': 500, 'Thu': 300}. Display S1 - S2. Also write the output.
C3SQL queries using functions3 marks · 44 questions
C3.1Practice3 marks
Consider the table PATIENT given below. Write SQL queries to display:
The PName in small letters, of the rows where Dept is 'Cardiology'
Each PName and the name of the week day of DOA
All the PName in alphabetical order.
Table: PATIENT
PNo
PName
Dept
Days
Bill
DOA
101
Yash
Cardiology
2
5000.32
2026-03-11
102
Chetan
Cardiology
15
5983.68
2026-03-01
103
Zeenat
Cardiology
4
8922.89
2026-07-02
104
Swati
Ortho
7
6492.81
2026-04-01
105
Pankaj
ENT
14
8701.77
2026-03-13
106
Mohit
ENT
13
5473.26
2026-02-19
Answer
(i)
SELECT LOWER(PName) FROM PATIENT WHERE Dept = 'Cardiology';
LOWER(PName)
yash
chetan
zeenat
Explanation: WHERE keeps only the rows where Dept is 'Cardiology': 3 of the 6 rows match (Yash, Chetan, Zeenat). The function LOWER is worked out for every row that is shown.
(ii)
SELECT PName, DAYNAME(DOA) FROM PATIENT;
PName
DAYNAME(DOA)
Yash
Wednesday
Chetan
Sunday
Zeenat
Thursday
Swati
Wednesday
Pankaj
Friday
Mohit
Thursday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT PName FROM PATIENT ORDER BY PName;
PName
Chetan
Mohit
Pankaj
Swati
Yash
Zeenat
Explanation: ORDER BY PName arranges the result in ascending (smallest first) order.
C3.2Practice3 marks
Consider the table PATIENT given below. Write SQL queries to display:
The last two characters of each PName
Each PName and the year of DOA
Each PName and the remainder when Days is divided by 7.
Table: PATIENT
PNo
PName
Dept
Days
Bill
DOA
101
Yash
Cardiology
2
5000.32
2026-03-11
102
Chetan
Cardiology
15
5983.68
2026-03-01
103
Zeenat
Cardiology
4
8922.89
2026-07-02
104
Swati
Ortho
7
6492.81
2026-04-01
105
Pankaj
ENT
14
8701.77
2026-03-13
106
Mohit
ENT
13
5473.26
2026-02-19
Answer
(i)
SELECT RIGHT(PName, 2) FROM PATIENT;
RIGHT(PName, 2)
sh
an
at
ti
aj
it
Explanation: The function RIGHT is worked out for every row that is shown.
(ii)
SELECT PName, YEAR(DOA) FROM PATIENT;
PName
YEAR(DOA)
Yash
2026
Chetan
2026
Zeenat
2026
Swati
2026
Pankaj
2026
Mohit
2026
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT PName, MOD(Days, 7) FROM PATIENT;
PName
MOD(Days, 7)
Yash
2
Chetan
1
Zeenat
4
Swati
0
Pankaj
0
Mohit
6
Explanation: The function MOD is worked out for every row that is shown.
C3.3Practice3 marks
Consider the table EMPLOYEE given below. Write SQL queries to display:
The EName in capital letters
Each EName and the name of the month of DOJ
The EName and Salary in descending order of Salary.
Table: EMPLOYEE
ENo
EName
Dept
Salary
Bonus
DOJ
11
Isha
HR
43000
3522.37
2023-02-02
12
Yash
Sales
40000
1725.02
2025-08-02
13
Suman
HR
44000
3550.14
2019-09-25
14
Jatin
Sales
45000
1269.74
2025-03-19
15
Nikhil
Sales
25000
3263.38
2022-09-09
16
Sachin
Accounts
31000
3064.28
2021-05-17
Answer
(i)
SELECT UCASE(EName) FROM EMPLOYEE;
UCASE(EName)
ISHA
YASH
SUMAN
JATIN
NIKHIL
SACHIN
Explanation: The function UCASE is worked out for every row that is shown.
(ii)
SELECT EName, MONTHNAME(DOJ) FROM EMPLOYEE;
EName
MONTHNAME(DOJ)
Isha
February
Yash
August
Suman
September
Jatin
March
Nikhil
September
Sachin
May
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT EName, Salary FROM EMPLOYEE ORDER BY Salary DESC;
EName
Salary
Jatin
45000
Suman
44000
Isha
43000
Yash
40000
Sachin
31000
Nikhil
25000
Explanation: ORDER BY Salary arranges the result in descending (largest first) order.
C3.4Practice3 marks
Consider the table EMPLOYEE given below. Write SQL queries to display:
Each EName and the number of characters in it
The EName of the rows where the month of DOJ is 2
The EName that end with the letter 'h'.
Table: EMPLOYEE
ENo
EName
Dept
Salary
Bonus
DOJ
11
Isha
HR
43000
3522.37
2023-02-02
12
Yash
Sales
40000
1725.02
2025-08-02
13
Suman
HR
44000
3550.14
2019-09-25
14
Jatin
Sales
45000
1269.74
2025-03-19
15
Nikhil
Sales
25000
3263.38
2022-09-09
16
Sachin
Accounts
31000
3064.28
2021-05-17
Answer
(i)
SELECT EName, LENGTH(EName) FROM EMPLOYEE;
EName
LENGTH(EName)
Isha
4
Yash
4
Suman
5
Jatin
5
Nikhil
6
Sachin
6
Explanation: The function LENGTH is worked out for every row that is shown.
(ii)
SELECT EName FROM EMPLOYEE WHERE MONTH(DOJ) = 2;
EName
Isha
Explanation: WHERE keeps only the rows where MONTH(DOJ) is 2: 1 of the 6 rows matches (Isha).
(iii)
SELECT EName FROM EMPLOYEE WHERE EName LIKE '%h';
EName
Yash
Explanation: WHERE keeps only the rows where EName matches the pattern '%h': 1 of the 6 rows matches (Yash). '%h' means the value ends with 'h'.
C3.5Practice3 marks
Consider the table BOOK given below. Write SQL queries to display:
The first three characters of each Title
Each Title and the year of DOP
Each Title and its Price rounded to one decimal place.
Table: BOOK
BNo
Title
Genre
Pages
Price
DOP
1
Wings of Fire
Fiction
120
342.44
2022-06-18
2
Malgudi Days
Fiction
290
337.03
2025-06-20
3
Panchatantra
Biography
150
339.91
2021-07-27
4
Godan
Poetry
320
195.34
2024-05-13
5
Gitanjali
Biography
440
520.87
2024-10-12
6
Train to Pakistan
Fiction
330
359.45
2021-10-21
Answer
(i)
SELECT LEFT(Title, 3) FROM BOOK;
LEFT(Title, 3)
Win
Mal
Pan
God
Git
Tra
Explanation: The function LEFT is worked out for every row that is shown.
(ii)
SELECT Title, YEAR(DOP) FROM BOOK;
Title
YEAR(DOP)
Wings of Fire
2022
Malgudi Days
2025
Panchatantra
2021
Godan
2024
Gitanjali
2024
Train to Pakistan
2021
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT Title, ROUND(Price, 1) FROM BOOK;
Title
ROUND(Price, 1)
Wings of Fire
342.4
Malgudi Days
337.0
Panchatantra
339.9
Godan
195.3
Gitanjali
520.9
Train to Pakistan
359.5
Explanation: The function ROUND is worked out for every row that is shown.
C3.6Practice3 marks
Consider the table BOOK given below. Write SQL queries to display:
Three characters of each Title, starting from the second character
The Title and DOP of the rows where the year of DOP is 2022 or later
All the Title in alphabetical order.
Table: BOOK
BNo
Title
Genre
Pages
Price
DOP
1
Wings of Fire
Fiction
120
342.44
2022-06-18
2
Malgudi Days
Fiction
290
337.03
2025-06-20
3
Panchatantra
Biography
150
339.91
2021-07-27
4
Godan
Poetry
320
195.34
2024-05-13
5
Gitanjali
Biography
440
520.87
2024-10-12
6
Train to Pakistan
Fiction
330
359.45
2021-10-21
Answer
(i)
SELECT MID(Title, 2, 3) FROM BOOK;
MID(Title, 2, 3)
ing
alg
anc
oda
ita
rai
Explanation: The function MID is worked out for every row that is shown.
(ii)
SELECT Title, DOP FROM BOOK WHERE YEAR(DOP) >= 2022;
Title
DOP
Wings of Fire
2022-06-18
Malgudi Days
2025-06-20
Godan
2024-05-13
Gitanjali
2024-10-12
Explanation: WHERE keeps only the rows where YEAR(DOP) is at least 2022: 4 of the 6 rows match (Wings of Fire, Malgudi Days, Godan, Gitanjali).
(iii)
SELECT Title FROM BOOK ORDER BY Title;
Title
Gitanjali
Godan
Malgudi Days
Panchatantra
Train to Pakistan
Wings of Fire
Explanation: ORDER BY Title arranges the result in ascending (smallest first) order.
C3.7Practice3 marks
Consider the table STUDENT given below. Write SQL queries to display:
The last two characters of each SName
The SName of the rows where the month of DOB is 8
Each SName and its Fees rounded to the nearest whole number.
Table: STUDENT
RNo
SName
Stream
Marks
Fees
DOB
1
Isha
Science
71
6193.93
2008-08-26
2
Deepak
Science
60
3799.37
2008-11-04
3
Geeta
Science
88
3372.65
2010-03-11
4
Tanvi
Humanities
76
4392.13
2009-02-04
5
Rohan
Commerce
63
3443.29
2008-05-08
6
Umesh
Commerce
85
2597.32
2010-06-25
Answer
(i)
SELECT RIGHT(SName, 2) FROM STUDENT;
RIGHT(SName, 2)
ha
ak
ta
vi
an
sh
Explanation: The function RIGHT is worked out for every row that is shown.
(ii)
SELECT SName FROM STUDENT WHERE MONTH(DOB) = 8;
SName
Isha
Explanation: WHERE keeps only the rows where MONTH(DOB) is 8: 1 of the 6 rows matches (Isha).
(iii)
SELECT SName, ROUND(Fees) FROM STUDENT;
SName
ROUND(Fees)
Isha
6194
Deepak
3799
Geeta
3373
Tanvi
4392
Rohan
3443
Umesh
2597
Explanation: The function ROUND is worked out for every row that is shown.
C3.8Practice3 marks
Consider the table STUDENT given below. Write SQL queries to display:
Each SName and the position of the letter 'a' in it
Each SName and the name of the week day of DOB
The SName and Marks in descending order of Marks.
Table: STUDENT
RNo
SName
Stream
Marks
Fees
DOB
1
Isha
Science
71
6193.93
2008-08-26
2
Deepak
Science
60
3799.37
2008-11-04
3
Geeta
Science
88
3372.65
2010-03-11
4
Tanvi
Humanities
76
4392.13
2009-02-04
5
Rohan
Commerce
63
3443.29
2008-05-08
6
Umesh
Commerce
85
2597.32
2010-06-25
Answer
(i)
SELECT SName, INSTR(SName, 'a') FROM STUDENT;
SName
INSTR(SName, "a")
Isha
4
Deepak
5
Geeta
5
Tanvi
2
Rohan
4
Umesh
0
Explanation: The function INSTR is worked out for every row that is shown.
(ii)
SELECT SName, DAYNAME(DOB) FROM STUDENT;
SName
DAYNAME(DOB)
Isha
Tuesday
Deepak
Tuesday
Geeta
Thursday
Tanvi
Wednesday
Rohan
Thursday
Umesh
Friday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT SName, Marks FROM STUDENT ORDER BY Marks DESC;
SName
Marks
Geeta
88
Umesh
85
Tanvi
76
Isha
71
Rohan
63
Deepak
60
Explanation: ORDER BY Marks arranges the result in descending (largest first) order.
C3.9Practice3 marks
Consider the table PRODUCT given below. Write SQL queries to display:
Each PName and the number of characters in it
The PName and MfgDate of the rows where the year of MfgDate is 2026 or later
Each PName and the remainder when Stock is divided by 7.
Table: PRODUCT
PCode
PName
Company
Stock
Price
MfgDate
501
Soap
Neha Foods
130
114.82
2026-04-27
502
Shampoo
Sai Mart
40
387.16
2026-05-15
503
Biscuit
Neha Foods
110
187.06
2026-07-05
504
Toothpaste
Om Traders
30
275.28
2026-11-16
505
Juice
Neha Foods
120
111.88
2026-11-04
506
Butter
Om Traders
180
293.32
2026-04-27
Answer
(i)
SELECT PName, LENGTH(PName) FROM PRODUCT;
PName
LENGTH(PName)
Soap
4
Shampoo
7
Biscuit
7
Toothpaste
10
Juice
5
Butter
6
Explanation: The function LENGTH is worked out for every row that is shown.
(ii)
SELECT PName, MfgDate FROM PRODUCT WHERE YEAR(MfgDate) >= 2026;
PName
MfgDate
Soap
2026-04-27
Shampoo
2026-05-15
Biscuit
2026-07-05
Toothpaste
2026-11-16
Juice
2026-11-04
Butter
2026-04-27
Explanation: WHERE keeps only the rows where YEAR(MfgDate) is at least 2026: 6 of the 6 rows match (Soap, Shampoo, Biscuit, Toothpaste, Juice, Butter).
(iii)
SELECT PName, MOD(Stock, 7) FROM PRODUCT;
PName
MOD(Stock, 7)
Soap
4
Shampoo
5
Biscuit
5
Toothpaste
2
Juice
1
Butter
5
Explanation: The function MOD is worked out for every row that is shown.
C3.10Practice3 marks
Consider the table PRODUCT given below. Write SQL queries to display:
The PName in small letters, of the rows where Company is 'Neha Foods'
Each PName and the name of the month of MfgDate
Each PName and its Price rounded to one decimal place.
Table: PRODUCT
PCode
PName
Company
Stock
Price
MfgDate
501
Soap
Neha Foods
130
114.82
2026-04-27
502
Shampoo
Sai Mart
40
387.16
2026-05-15
503
Biscuit
Neha Foods
110
187.06
2026-07-05
504
Toothpaste
Om Traders
30
275.28
2026-11-16
505
Juice
Neha Foods
120
111.88
2026-11-04
506
Butter
Om Traders
180
293.32
2026-04-27
Answer
(i)
SELECT LOWER(PName) FROM PRODUCT WHERE Company = 'Neha Foods';
LOWER(PName)
soap
biscuit
juice
Explanation: WHERE keeps only the rows where Company is 'Neha Foods': 3 of the 6 rows match (Soap, Biscuit, Juice). The function LOWER is worked out for every row that is shown.
(ii)
SELECT PName, MONTHNAME(MfgDate) FROM PRODUCT;
PName
MONTHNAME(MfgDate)
Soap
April
Shampoo
May
Biscuit
July
Toothpaste
November
Juice
November
Butter
April
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT PName, ROUND(Price, 1) FROM PRODUCT;
PName
ROUND(Price, 1)
Soap
114.8
Shampoo
387.2
Biscuit
187.1
Toothpaste
275.3
Juice
111.9
Butter
293.3
Explanation: The function ROUND is worked out for every row that is shown.
C3.11Practice3 marks
Consider the table MEMBER given below. Write SQL queries to display:
Three characters of each MName, starting from the second character
Each MName and the name of the week day of JoinDate
The MName that end with the letter 's'.
Table: MEMBER
MNo
MName
Plan
Months
Fee
JoinDate
1
Mohit
Gold
3
2755.29
2026-07-09
2
Vikas
Gold
9
1680.76
2025-04-25
3
Tanvi
Silver
12
2149.51
2025-01-03
4
Pallavi
Gold
4
1398.78
2026-05-02
5
Divya
Silver
6
2568.09
2025-06-13
6
Aman
Basic
8
2546.01
2026-06-19
Answer
(i)
SELECT MID(MName, 2, 3) FROM MEMBER;
MID(MName, 2, 3)
ohi
ika
anv
all
ivy
man
Explanation: The function MID is worked out for every row that is shown.
(ii)
SELECT MName, DAYNAME(JoinDate) FROM MEMBER;
MName
DAYNAME(JoinDate)
Mohit
Thursday
Vikas
Friday
Tanvi
Friday
Pallavi
Saturday
Divya
Friday
Aman
Friday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT MName FROM MEMBER WHERE MName LIKE '%s';
MName
Vikas
Explanation: WHERE keeps only the rows where MName matches the pattern '%s': 1 of the 6 rows matches (Vikas). '%s' means the value ends with 's'.
C3.12Practice3 marks
Consider the table MEMBER given below. Write SQL queries to display:
The MName in capital letters
Each MName and the year of JoinDate
Each MName and its Fee rounded to the nearest whole number.
Table: MEMBER
MNo
MName
Plan
Months
Fee
JoinDate
1
Mohit
Gold
3
2755.29
2026-07-09
2
Vikas
Gold
9
1680.76
2025-04-25
3
Tanvi
Silver
12
2149.51
2025-01-03
4
Pallavi
Gold
4
1398.78
2026-05-02
5
Divya
Silver
6
2568.09
2025-06-13
6
Aman
Basic
8
2546.01
2026-06-19
Answer
(i)
SELECT UCASE(MName) FROM MEMBER;
UCASE(MName)
MOHIT
VIKAS
TANVI
PALLAVI
DIVYA
AMAN
Explanation: The function UCASE is worked out for every row that is shown.
(ii)
SELECT MName, YEAR(JoinDate) FROM MEMBER;
MName
YEAR(JoinDate)
Mohit
2026
Vikas
2025
Tanvi
2025
Pallavi
2026
Divya
2025
Aman
2026
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT MName, ROUND(Fee) FROM MEMBER;
MName
ROUND(Fee)
Mohit
2755
Vikas
1681
Tanvi
2150
Pallavi
1399
Divya
2568
Aman
2546
Explanation: The function ROUND is worked out for every row that is shown.
C3.13Practice3 marks
Consider the table TICKET given below. Write SQL queries to display:
Each Passenger and the position of the letter 'a' in it
Each Passenger and the name of the month of TravelDate
All the Passenger in alphabetical order.
Table: TICKET
TNo
Passenger
Dest
Seats
Fare
TravelDate
301
Anita
Goa
3
9384.04
2026-01-28
302
Bhavna
Goa
3
6828.46
2026-03-11
303
Simran
Kochi
6
8802.73
2026-04-28
304
Aman
Kochi
4
6806.37
2026-10-14
305
Jatin
Goa
2
4173.89
2027-05-03
306
Sonal
Leh
5
9385.63
2026-12-18
Answer
(i)
SELECT Passenger, INSTR(Passenger, 'a') FROM TICKET;
Passenger
INSTR(Passenger, "a")
Anita
5
Bhavna
3
Simran
5
Aman
3
Jatin
2
Sonal
4
Explanation: The function INSTR is worked out for every row that is shown.
(ii)
SELECT Passenger, MONTHNAME(TravelDate) FROM TICKET;
Passenger
MONTHNAME(TravelDate)
Anita
January
Bhavna
March
Simran
April
Aman
October
Jatin
May
Sonal
December
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT Passenger FROM TICKET ORDER BY Passenger;
Passenger
Aman
Anita
Bhavna
Jatin
Simran
Sonal
Explanation: ORDER BY Passenger arranges the result in ascending (smallest first) order.
C3.14Practice3 marks
Consider the table TICKET given below. Write SQL queries to display:
The first three characters of each Passenger
The Passenger of the rows where the month of TravelDate is 1
Each Passenger and the remainder when Seats is divided by 7.
Table: TICKET
TNo
Passenger
Dest
Seats
Fare
TravelDate
301
Anita
Goa
3
9384.04
2026-01-28
302
Bhavna
Goa
3
6828.46
2026-03-11
303
Simran
Kochi
6
8802.73
2026-04-28
304
Aman
Kochi
4
6806.37
2026-10-14
305
Jatin
Goa
2
4173.89
2027-05-03
306
Sonal
Leh
5
9385.63
2026-12-18
Answer
(i)
SELECT LEFT(Passenger, 3) FROM TICKET;
LEFT(Passenger, 3)
Ani
Bha
Sim
Ama
Jat
Son
Explanation: The function LEFT is worked out for every row that is shown.
(ii)
SELECT Passenger FROM TICKET WHERE MONTH(TravelDate) = 1;
Passenger
Anita
Explanation: WHERE keeps only the rows where MONTH(TravelDate) is 1: 1 of the 6 rows matches (Anita).
(iii)
SELECT Passenger, MOD(Seats, 7) FROM TICKET;
Passenger
MOD(Seats, 7)
Anita
3
Bhavna
3
Simran
6
Aman
4
Jatin
2
Sonal
5
Explanation: The function MOD is worked out for every row that is shown.
C3.15Practice3 marks
Consider the table MOVIE given below. Write SQL queries to display:
The Title in small letters, of the rows where Genre is 'Comedy'
Each Title and the year of RelDate
The Title and Minutes in descending order of Minutes.
Table: MOVIE
MNo
Title
Genre
Minutes
Rating
RelDate
1
Udaan
Comedy
170
8.54
2026-03-24
2
Safar
Comedy
145
7.52
2024-08-10
3
Dosti
Drama
125
6.87
2023-12-27
4
Rangoli
Comedy
130
5.11
2023-10-16
5
Khel
Action
105
6.83
2024-12-18
6
Sapna
Action
115
5.33
2024-12-07
Answer
(i)
SELECT LOWER(Title) FROM MOVIE WHERE Genre = 'Comedy';
LOWER(Title)
udaan
safar
rangoli
Explanation: WHERE keeps only the rows where Genre is 'Comedy': 3 of the 6 rows match (Udaan, Safar, Rangoli). The function LOWER is worked out for every row that is shown.
(ii)
SELECT Title, YEAR(RelDate) FROM MOVIE;
Title
YEAR(RelDate)
Udaan
2026
Safar
2024
Dosti
2023
Rangoli
2023
Khel
2024
Sapna
2024
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT Title, Minutes FROM MOVIE ORDER BY Minutes DESC;
Title
Minutes
Udaan
170
Safar
145
Rangoli
130
Dosti
125
Sapna
115
Khel
105
Explanation: ORDER BY Minutes arranges the result in descending (largest first) order.
C3.16Practice3 marks
Consider the table MOVIE given below. Write SQL queries to display:
The last two characters of each Title
The Title and RelDate of the rows where the year of RelDate is 2024 or later
The Title that end with the letter 'r'.
Table: MOVIE
MNo
Title
Genre
Minutes
Rating
RelDate
1
Udaan
Comedy
170
8.54
2026-03-24
2
Safar
Comedy
145
7.52
2024-08-10
3
Dosti
Drama
125
6.87
2023-12-27
4
Rangoli
Comedy
130
5.11
2023-10-16
5
Khel
Action
105
6.83
2024-12-18
6
Sapna
Action
115
5.33
2024-12-07
Answer
(i)
SELECT RIGHT(Title, 2) FROM MOVIE;
RIGHT(Title, 2)
an
ar
ti
li
el
na
Explanation: The function RIGHT is worked out for every row that is shown.
(ii)
SELECT Title, RelDate FROM MOVIE WHERE YEAR(RelDate) >= 2024;
Title
RelDate
Udaan
2026-03-24
Safar
2024-08-10
Khel
2024-12-18
Sapna
2024-12-07
Explanation: WHERE keeps only the rows where YEAR(RelDate) is at least 2024: 4 of the 6 rows match (Udaan, Safar, Khel, Sapna).
(iii)
SELECT Title FROM MOVIE WHERE Title LIKE '%r';
Title
Safar
Explanation: WHERE keeps only the rows where Title matches the pattern '%r': 1 of the 6 rows matches (Safar). '%r' means the value ends with 'r'.
C3.17Practice3 marks
Consider the table COURSE given below. Write SQL queries to display:
The CName in capital letters
The CName of the rows where the month of StartDate is 6
Each CName and its Fee rounded to one decimal place.
Table: COURSE
CNo
CName
Mode
Weeks
Fee
StartDate
21
Python
Online
6
8375.41
2026-06-06
22
Web Design
Offline
8
3020.13
2026-10-13
23
Tally
Online
10
4826.35
2027-03-23
24
Animation
Hybrid
22
8778.76
2026-11-11
25
Robotics
Hybrid
4
6911.58
2026-09-27
26
Data Entry
Online
24
9871.53
2027-11-05
Answer
(i)
SELECT UCASE(CName) FROM COURSE;
UCASE(CName)
PYTHON
WEB DESIGN
TALLY
ANIMATION
ROBOTICS
DATA ENTRY
Explanation: The function UCASE is worked out for every row that is shown.
(ii)
SELECT CName FROM COURSE WHERE MONTH(StartDate) = 6;
CName
Python
Explanation: WHERE keeps only the rows where MONTH(StartDate) is 6: 1 of the 6 rows matches (Python).
(iii)
SELECT CName, ROUND(Fee, 1) FROM COURSE;
CName
ROUND(Fee, 1)
Python
8375.4
Web Design
3020.1
Tally
4826.4
Animation
8778.8
Robotics
6911.6
Data Entry
9871.5
Explanation: The function ROUND is worked out for every row that is shown.
C3.18Practice3 marks
Consider the table COURSE given below. Write SQL queries to display:
Each CName and the number of characters in it
Each CName and the name of the week day of StartDate
All the CName in alphabetical order.
Table: COURSE
CNo
CName
Mode
Weeks
Fee
StartDate
21
Python
Online
6
8375.41
2026-06-06
22
Web Design
Offline
8
3020.13
2026-10-13
23
Tally
Online
10
4826.35
2027-03-23
24
Animation
Hybrid
22
8778.76
2026-11-11
25
Robotics
Hybrid
4
6911.58
2026-09-27
26
Data Entry
Online
24
9871.53
2027-11-05
Answer
(i)
SELECT CName, LENGTH(CName) FROM COURSE;
CName
LENGTH(CName)
Python
6
Web Design
10
Tally
5
Animation
9
Robotics
8
Data Entry
10
Explanation: The function LENGTH is worked out for every row that is shown.
(ii)
SELECT CName, DAYNAME(StartDate) FROM COURSE;
CName
DAYNAME(StartDate)
Python
Saturday
Web Design
Tuesday
Tally
Tuesday
Animation
Wednesday
Robotics
Sunday
Data Entry
Friday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT CName FROM COURSE ORDER BY CName;
CName
Animation
Data Entry
Python
Robotics
Tally
Web Design
Explanation: ORDER BY CName arranges the result in ascending (smallest first) order.
C3.19Practice3 marks
Consider the table VEHICLE given below. Write SQL queries to display:
The first three characters of each Owner
The Owner and RegDate of the rows where the year of RegDate is 2019 or later
Each Owner and its Tax rounded to the nearest whole number.
Table: VEHICLE
VNo
Owner
Type
Km
Tax
RegDate
701
Yash
Bike
14500
2852.03
2019-01-09
702
Shreya
Van
59000
2222.07
2023-01-21
703
Simran
Car
27500
2206.18
2018-07-13
704
Swati
Van
25500
1253.91
2020-12-12
705
Sandeep
Car
54000
2275.81
2025-01-14
706
Aman
Car
15500
1981.68
2018-12-01
Answer
(i)
SELECT LEFT(Owner, 3) FROM VEHICLE;
LEFT(Owner, 3)
Yas
Shr
Sim
Swa
San
Ama
Explanation: The function LEFT is worked out for every row that is shown.
(ii)
SELECT Owner, RegDate FROM VEHICLE WHERE YEAR(RegDate) >= 2019;
Owner
RegDate
Yash
2019-01-09
Shreya
2023-01-21
Swati
2020-12-12
Sandeep
2025-01-14
Explanation: WHERE keeps only the rows where YEAR(RegDate) is at least 2019: 4 of the 6 rows match (Yash, Shreya, Swati, Sandeep).
(iii)
SELECT Owner, ROUND(Tax) FROM VEHICLE;
Owner
ROUND(Tax)
Yash
2852
Shreya
2222
Simran
2206
Swati
1254
Sandeep
2276
Aman
1982
Explanation: The function ROUND is worked out for every row that is shown.
C3.20Practice3 marks
Consider the table VEHICLE given below. Write SQL queries to display:
Three characters of each Owner, starting from the second character
Each Owner and the name of the month of RegDate
The Owner and Km in descending order of Km.
Table: VEHICLE
VNo
Owner
Type
Km
Tax
RegDate
701
Yash
Bike
14500
2852.03
2019-01-09
702
Shreya
Van
59000
2222.07
2023-01-21
703
Simran
Car
27500
2206.18
2018-07-13
704
Swati
Van
25500
1253.91
2020-12-12
705
Sandeep
Car
54000
2275.81
2025-01-14
706
Aman
Car
15500
1981.68
2018-12-01
Answer
(i)
SELECT MID(Owner, 2, 3) FROM VEHICLE;
MID(Owner, 2, 3)
ash
hre
imr
wat
and
man
Explanation: The function MID is worked out for every row that is shown.
(ii)
SELECT Owner, MONTHNAME(RegDate) FROM VEHICLE;
Owner
MONTHNAME(RegDate)
Yash
January
Shreya
January
Simran
July
Swati
December
Sandeep
January
Aman
December
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT Owner, Km FROM VEHICLE ORDER BY Km DESC;
Owner
Km
Shreya
59000
Sandeep
54000
Simran
27500
Swati
25500
Aman
15500
Yash
14500
Explanation: ORDER BY Km arranges the result in descending (largest first) order.
C3.21Practice3 marks
Consider the table ORDERS given below. Write SQL queries to display:
The last two characters of each Customer
Each Customer and the name of the week day of ODate
Each Customer and the remainder when Qty is divided by 7.
Table: ORDERS
ONo
Customer
City
Qty
Amount
ODate
9001
Harish
Delhi
5
6729.59
2026-06-22
9002
Pallavi
Agra
3
7662.03
2026-10-28
9003
Yash
Pune
11
561.13
2026-11-22
9004
Arjun
Pune
12
4746.24
2026-04-01
9005
Nikhil
Delhi
13
3876.23
2026-04-20
9006
Farhan
Delhi
6
6568.18
2026-03-14
Answer
(i)
SELECT RIGHT(Customer, 2) FROM ORDERS;
RIGHT(Customer, 2)
sh
vi
sh
un
il
an
Explanation: The function RIGHT is worked out for every row that is shown.
(ii)
SELECT Customer, DAYNAME(ODate) FROM ORDERS;
Customer
DAYNAME(ODate)
Harish
Monday
Pallavi
Wednesday
Yash
Sunday
Arjun
Wednesday
Nikhil
Monday
Farhan
Saturday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT Customer, MOD(Qty, 7) FROM ORDERS;
Customer
MOD(Qty, 7)
Harish
5
Pallavi
3
Yash
4
Arjun
5
Nikhil
6
Farhan
6
Explanation: The function MOD is worked out for every row that is shown.
C3.22Practice3 marks
Consider the table ORDERS given below. Write SQL queries to display:
Each Customer and the position of the letter 'a' in it
Each Customer and the year of ODate
Each Customer and its Amount rounded to one decimal place.
Table: ORDERS
ONo
Customer
City
Qty
Amount
ODate
9001
Harish
Delhi
5
6729.59
2026-06-22
9002
Pallavi
Agra
3
7662.03
2026-10-28
9003
Yash
Pune
11
561.13
2026-11-22
9004
Arjun
Pune
12
4746.24
2026-04-01
9005
Nikhil
Delhi
13
3876.23
2026-04-20
9006
Farhan
Delhi
6
6568.18
2026-03-14
Answer
(i)
SELECT Customer, INSTR(Customer, 'a') FROM ORDERS;
Customer
INSTR(Customer, "a")
Harish
2
Pallavi
2
Yash
2
Arjun
0
Nikhil
0
Farhan
2
Explanation: The function INSTR is worked out for every row that is shown.
(ii)
SELECT Customer, YEAR(ODate) FROM ORDERS;
Customer
YEAR(ODate)
Harish
2026
Pallavi
2026
Yash
2026
Arjun
2026
Nikhil
2026
Farhan
2026
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT Customer, ROUND(Amount, 1) FROM ORDERS;
Customer
ROUND(Amount, 1)
Harish
6729.6
Pallavi
7662.0
Yash
561.1
Arjun
4746.2
Nikhil
3876.2
Farhan
6568.2
Explanation: The function ROUND is worked out for every row that is shown.
C3.23Practice3 marks
Consider the table DOCTOR given below. Write SQL queries to display:
Each DName and the number of characters in it
Each DName and the name of the month of DOJ
The DName that end with the letter 'i'.
Table: DOCTOR
DNo
DName
Spec
Exp
Fee
DOJ
1
Anita
Dental
5
436.84
2022-09-22
2
Ojasvi
Skin
23
1051.09
2012-07-22
3
Nikhil
Eye
2
1178.34
2021-05-22
4
Meenal
Skin
14
1100.17
2020-08-28
5
Naveen
Dental
12
1207.47
2014-01-06
6
Vikas
Skin
6
435.16
2017-06-04
Answer
(i)
SELECT DName, LENGTH(DName) FROM DOCTOR;
DName
LENGTH(DName)
Anita
5
Ojasvi
6
Nikhil
6
Meenal
6
Naveen
6
Vikas
5
Explanation: The function LENGTH is worked out for every row that is shown.
(ii)
SELECT DName, MONTHNAME(DOJ) FROM DOCTOR;
DName
MONTHNAME(DOJ)
Anita
September
Ojasvi
July
Nikhil
May
Meenal
August
Naveen
January
Vikas
June
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT DName FROM DOCTOR WHERE DName LIKE '%i';
DName
Ojasvi
Explanation: WHERE keeps only the rows where DName matches the pattern '%i': 1 of the 6 rows matches (Ojasvi). '%i' means the value ends with 'i'.
C3.24Practice3 marks
Consider the table DOCTOR given below. Write SQL queries to display:
The DName in small letters, of the rows where Spec is 'Dental'
The DName of the rows where the month of DOJ is 9
Each DName and its Fee rounded to the nearest whole number.
Table: DOCTOR
DNo
DName
Spec
Exp
Fee
DOJ
1
Anita
Dental
5
436.84
2022-09-22
2
Ojasvi
Skin
23
1051.09
2012-07-22
3
Nikhil
Eye
2
1178.34
2021-05-22
4
Meenal
Skin
14
1100.17
2020-08-28
5
Naveen
Dental
12
1207.47
2014-01-06
6
Vikas
Skin
6
435.16
2017-06-04
Answer
(i)
SELECT LOWER(DName) FROM DOCTOR WHERE Spec = 'Dental';
LOWER(DName)
anita
naveen
Explanation: WHERE keeps only the rows where Spec is 'Dental': 2 of the 6 rows match (Anita, Naveen). The function LOWER is worked out for every row that is shown.
(ii)
SELECT DName FROM DOCTOR WHERE MONTH(DOJ) = 9;
DName
Anita
Explanation: WHERE keeps only the rows where MONTH(DOJ) is 9: 1 of the 6 rows matches (Anita).
(iii)
SELECT DName, ROUND(Fee) FROM DOCTOR;
DName
ROUND(Fee)
Anita
437
Ojasvi
1051
Nikhil
1178
Meenal
1100
Naveen
1207
Vikas
435
Explanation: The function ROUND is worked out for every row that is shown.
C3.25Practice3 marks
Consider the table PLAYER given below. Write SQL queries to display:
Three characters of each PName, starting from the second character
Each PName and the year of DOB
All the PName in alphabetical order.
Table: PLAYER
PNo
PName
Game
Matches
Average
DOB
1
Nisha
Cricket
35
39.93
2007-12-23
2
Rachna
Chess
44
48.49
2009-10-21
3
Meenal
Cricket
19
62.94
2010-04-10
4
Nikhil
Cricket
51
40.51
2006-12-17
5
Harish
Hockey
24
31.15
2010-08-13
6
Zeenat
Hockey
36
29.33
2009-07-23
Answer
(i)
SELECT MID(PName, 2, 3) FROM PLAYER;
MID(PName, 2, 3)
ish
ach
een
ikh
ari
een
Explanation: The function MID is worked out for every row that is shown.
(ii)
SELECT PName, YEAR(DOB) FROM PLAYER;
PName
YEAR(DOB)
Nisha
2007
Rachna
2009
Meenal
2010
Nikhil
2006
Harish
2010
Zeenat
2009
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT PName FROM PLAYER ORDER BY PName;
PName
Harish
Meenal
Nikhil
Nisha
Rachna
Zeenat
Explanation: ORDER BY PName arranges the result in ascending (smallest first) order.
C3.26Practice3 marks
Consider the table PLAYER given below. Write SQL queries to display:
The PName in capital letters
The PName and DOB of the rows where the year of DOB is 2009 or later
Each PName and the remainder when Matches is divided by 7.
Table: PLAYER
PNo
PName
Game
Matches
Average
DOB
1
Nisha
Cricket
35
39.93
2007-12-23
2
Rachna
Chess
44
48.49
2009-10-21
3
Meenal
Cricket
19
62.94
2010-04-10
4
Nikhil
Cricket
51
40.51
2006-12-17
5
Harish
Hockey
24
31.15
2010-08-13
6
Zeenat
Hockey
36
29.33
2009-07-23
Answer
(i)
SELECT UCASE(PName) FROM PLAYER;
UCASE(PName)
NISHA
RACHNA
MEENAL
NIKHIL
HARISH
ZEENAT
Explanation: The function UCASE is worked out for every row that is shown.
(ii)
SELECT PName, DOB FROM PLAYER WHERE YEAR(DOB) >= 2009;
PName
DOB
Rachna
2009-10-21
Meenal
2010-04-10
Harish
2010-08-13
Zeenat
2009-07-23
Explanation: WHERE keeps only the rows where YEAR(DOB) is at least 2009: 4 of the 6 rows match (Rachna, Meenal, Harish, Zeenat).
(iii)
SELECT PName, MOD(Matches, 7) FROM PLAYER;
PName
MOD(Matches, 7)
Nisha
0
Rachna
2
Meenal
5
Nikhil
2
Harish
3
Zeenat
1
Explanation: The function MOD is worked out for every row that is shown.
C3.27Practice3 marks
Consider the table HOSTEL given below. Write SQL queries to display:
Each SName and the position of the letter 'a' in it
The SName of the rows where the month of DOA is 6
The SName and Room in descending order of Room.
Table: HOSTEL
HNo
SName
Block
Room
Mess
DOA
1
Chetan
Yamuna
164
3027.92
2026-06-19
2
Rohan
Ganga
134
2314.26
2026-12-15
3
Swati
Kaveri
279
2306.82
2025-09-22
4
Harish
Ganga
250
1867.61
2025-10-10
5
Naveen
Yamuna
111
2282.33
2025-06-13
6
Aman
Ganga
101
2423.74
2026-07-10
Answer
(i)
SELECT SName, INSTR(SName, 'a') FROM HOSTEL;
SName
INSTR(SName, "a")
Chetan
5
Rohan
4
Swati
3
Harish
2
Naveen
2
Aman
3
Explanation: The function INSTR is worked out for every row that is shown.
(ii)
SELECT SName FROM HOSTEL WHERE MONTH(DOA) = 6;
SName
Chetan
Naveen
Explanation: WHERE keeps only the rows where MONTH(DOA) is 6: 2 of the 6 rows match (Chetan, Naveen).
(iii)
SELECT SName, Room FROM HOSTEL ORDER BY Room DESC;
SName
Room
Swati
279
Harish
250
Chetan
164
Rohan
134
Naveen
111
Aman
101
Explanation: ORDER BY Room arranges the result in descending (largest first) order.
C3.28Practice3 marks
Consider the table HOSTEL given below. Write SQL queries to display:
The first three characters of each SName
Each SName and the name of the week day of DOA
The SName that end with the letter 'n'.
Table: HOSTEL
HNo
SName
Block
Room
Mess
DOA
1
Chetan
Yamuna
164
3027.92
2026-06-19
2
Rohan
Ganga
134
2314.26
2026-12-15
3
Swati
Kaveri
279
2306.82
2025-09-22
4
Harish
Ganga
250
1867.61
2025-10-10
5
Naveen
Yamuna
111
2282.33
2025-06-13
6
Aman
Ganga
101
2423.74
2026-07-10
Answer
(i)
SELECT LEFT(SName, 3) FROM HOSTEL;
LEFT(SName, 3)
Che
Roh
Swa
Har
Nav
Ama
Explanation: The function LEFT is worked out for every row that is shown.
(ii)
SELECT SName, DAYNAME(DOA) FROM HOSTEL;
SName
DAYNAME(DOA)
Chetan
Friday
Rohan
Tuesday
Swati
Monday
Harish
Friday
Naveen
Friday
Aman
Friday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT SName FROM HOSTEL WHERE SName LIKE '%n';
SName
Chetan
Rohan
Naveen
Aman
Explanation: WHERE keeps only the rows where SName matches the pattern '%n': 4 of the 6 rows match (Chetan, Rohan, Naveen, Aman). '%n' means the value ends with 'n'.
C3.29Practice3 marks
Consider the table LOAN given below. Write SQL queries to display:
The CName in small letters, of the rows where Type is 'Education'
The CName and StartDate of the rows where the year of StartDate is 2022 or later
Each CName and its Rate rounded to one decimal place.
Table: LOAN
LNo
CName
Type
Years
Rate
StartDate
1
Divya
Education
19
11.17
2020-11-18
2
Sachin
Home
3
9.02
2022-04-01
3
Naveen
Car
12
9.46
2023-07-07
4
Sandeep
Car
2
9.92
2026-03-01
5
Umesh
Home
10
10.25
2021-02-05
6
Ritu
Home
17
8.62
2025-08-06
Answer
(i)
SELECT LOWER(CName) FROM LOAN WHERE Type = 'Education';
LOWER(CName)
divya
Explanation: WHERE keeps only the rows where Type is 'Education': 1 of the 6 rows matches (Divya). The function LOWER is worked out for every row that is shown.
(ii)
SELECT CName, StartDate FROM LOAN WHERE YEAR(StartDate) >= 2022;
CName
StartDate
Sachin
2022-04-01
Naveen
2023-07-07
Sandeep
2026-03-01
Ritu
2025-08-06
Explanation: WHERE keeps only the rows where YEAR(StartDate) is at least 2022: 4 of the 6 rows match (Sachin, Naveen, Sandeep, Ritu).
(iii)
SELECT CName, ROUND(Rate, 1) FROM LOAN;
CName
ROUND(Rate, 1)
Divya
11.2
Sachin
9.0
Naveen
9.5
Sandeep
9.9
Umesh
10.3
Ritu
8.6
Explanation: The function ROUND is worked out for every row that is shown.
C3.30Practice3 marks
Consider the table LOAN given below. Write SQL queries to display:
The last two characters of each CName
Each CName and the name of the month of StartDate
All the CName in alphabetical order.
Table: LOAN
LNo
CName
Type
Years
Rate
StartDate
1
Divya
Education
19
11.17
2020-11-18
2
Sachin
Home
3
9.02
2022-04-01
3
Naveen
Car
12
9.46
2023-07-07
4
Sandeep
Car
2
9.92
2026-03-01
5
Umesh
Home
10
10.25
2021-02-05
6
Ritu
Home
17
8.62
2025-08-06
Answer
(i)
SELECT RIGHT(CName, 2) FROM LOAN;
RIGHT(CName, 2)
ya
in
en
ep
sh
tu
Explanation: The function RIGHT is worked out for every row that is shown.
(ii)
SELECT CName, MONTHNAME(StartDate) FROM LOAN;
CName
MONTHNAME(StartDate)
Divya
November
Sachin
April
Naveen
July
Sandeep
March
Umesh
February
Ritu
August
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT CName FROM LOAN ORDER BY CName;
CName
Divya
Naveen
Ritu
Sachin
Sandeep
Umesh
Explanation: ORDER BY CName arranges the result in ascending (smallest first) order.
C3.31Practice3 marks
Consider the table STAFF given below. Write SQL queries to display:
The SName in capital letters
Each SName and the name of the week day of DOJ
Each SName and its Allowance rounded to the nearest whole number.
Table: STAFF
SNo
SName
Post
Periods
Allowance
DOJ
1
Rachna
TGT
21
6326.05
2023-07-03
2
Meenal
PGT
31
5316.67
2023-02-03
3
Sandeep
PGT
18
3601.57
2015-03-06
4
Yash
PGT
25
6358.03
2011-05-26
5
Ritu
PRT
30
5793.03
2022-08-12
6
Farhan
TGT
33
5942.38
2014-11-17
Answer
(i)
SELECT UCASE(SName) FROM STAFF;
UCASE(SName)
RACHNA
MEENAL
SANDEEP
YASH
RITU
FARHAN
Explanation: The function UCASE is worked out for every row that is shown.
(ii)
SELECT SName, DAYNAME(DOJ) FROM STAFF;
SName
DAYNAME(DOJ)
Rachna
Monday
Meenal
Friday
Sandeep
Friday
Yash
Thursday
Ritu
Friday
Farhan
Monday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT SName, ROUND(Allowance) FROM STAFF;
SName
ROUND(Allowance)
Rachna
6326
Meenal
5317
Sandeep
3602
Yash
6358
Ritu
5793
Farhan
5942
Explanation: The function ROUND is worked out for every row that is shown.
C3.32Practice3 marks
Consider the table STAFF given below. Write SQL queries to display:
Each SName and the number of characters in it
Each SName and the year of DOJ
The SName and Periods in descending order of Periods.
Table: STAFF
SNo
SName
Post
Periods
Allowance
DOJ
1
Rachna
TGT
21
6326.05
2023-07-03
2
Meenal
PGT
31
5316.67
2023-02-03
3
Sandeep
PGT
18
3601.57
2015-03-06
4
Yash
PGT
25
6358.03
2011-05-26
5
Ritu
PRT
30
5793.03
2022-08-12
6
Farhan
TGT
33
5942.38
2014-11-17
Answer
(i)
SELECT SName, LENGTH(SName) FROM STAFF;
SName
LENGTH(SName)
Rachna
6
Meenal
6
Sandeep
7
Yash
4
Ritu
4
Farhan
6
Explanation: The function LENGTH is worked out for every row that is shown.
(ii)
SELECT SName, YEAR(DOJ) FROM STAFF;
SName
YEAR(DOJ)
Rachna
2023
Meenal
2023
Sandeep
2015
Yash
2011
Ritu
2022
Farhan
2014
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT SName, Periods FROM STAFF ORDER BY Periods DESC;
SName
Periods
Farhan
33
Meenal
31
Ritu
30
Yash
25
Rachna
21
Sandeep
18
Explanation: ORDER BY Periods arranges the result in descending (largest first) order.
C3.33Practice3 marks
Consider the table GARMENT given below. Write SQL queries to display:
The first three characters of each GName
Each GName and the name of the month of Launch
Each GName and the remainder when Stock is divided by 7.
Table: GARMENT
GCode
GName
Fabric
Stock
Price
Launch
10
Shirt
Cotton
15
1434.77
2025-06-21
11
Jeans
Silk
25
3035.63
2025-11-15
12
Kurta
Denim
5
2149.33
2026-03-28
13
Jacket
Cotton
10
1170.28
2025-10-06
14
Saree
Denim
35
787.83
2025-11-07
15
Frock
Cotton
45
1436.34
2025-09-11
Answer
(i)
SELECT LEFT(GName, 3) FROM GARMENT;
LEFT(GName, 3)
Shi
Jea
Kur
Jac
Sar
Fro
Explanation: The function LEFT is worked out for every row that is shown.
(ii)
SELECT GName, MONTHNAME(Launch) FROM GARMENT;
GName
MONTHNAME(Launch)
Shirt
June
Jeans
November
Kurta
March
Jacket
October
Saree
November
Frock
September
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT GName, MOD(Stock, 7) FROM GARMENT;
GName
MOD(Stock, 7)
Shirt
1
Jeans
4
Kurta
5
Jacket
3
Saree
0
Frock
3
Explanation: The function MOD is worked out for every row that is shown.
C3.34Practice3 marks
Consider the table GARMENT given below. Write SQL queries to display:
Three characters of each GName, starting from the second character
The GName of the rows where the month of Launch is 6
Each GName and its Price rounded to one decimal place.
Table: GARMENT
GCode
GName
Fabric
Stock
Price
Launch
10
Shirt
Cotton
15
1434.77
2025-06-21
11
Jeans
Silk
25
3035.63
2025-11-15
12
Kurta
Denim
5
2149.33
2026-03-28
13
Jacket
Cotton
10
1170.28
2025-10-06
14
Saree
Denim
35
787.83
2025-11-07
15
Frock
Cotton
45
1436.34
2025-09-11
Answer
(i)
SELECT MID(GName, 2, 3) FROM GARMENT;
MID(GName, 2, 3)
hir
ean
urt
ack
are
roc
Explanation: The function MID is worked out for every row that is shown.
(ii)
SELECT GName FROM GARMENT WHERE MONTH(Launch) = 6;
GName
Shirt
Explanation: WHERE keeps only the rows where MONTH(Launch) is 6: 1 of the 6 rows matches (Shirt).
(iii)
SELECT GName, ROUND(Price, 1) FROM GARMENT;
GName
ROUND(Price, 1)
Shirt
1434.8
Jeans
3035.6
Kurta
2149.3
Jacket
1170.3
Saree
787.8
Frock
1436.3
Explanation: The function ROUND is worked out for every row that is shown.
C3.35Practice3 marks
Consider the table EVENT given below. Write SQL queries to display:
The last two characters of each EName
Each EName and the year of EDate
The EName that end with the letter 'z'.
Table: EVENT
ENo
EName
House
Points
Prize
EDate
1
Debate
Shivaji
30
2874.63
2026-07-02
2
Quiz
Raman
100
2924.74
2026-07-15
3
Dance
Shivaji
60
2767.11
2026-02-14
4
Drama
Raman
55
2300.04
2026-12-19
5
Painting
Shivaji
95
4017.09
2026-08-25
6
Singing
Tagore
75
1901.59
2026-10-04
Answer
(i)
SELECT RIGHT(EName, 2) FROM EVENT;
RIGHT(EName, 2)
te
iz
ce
ma
ng
ng
Explanation: The function RIGHT is worked out for every row that is shown.
(ii)
SELECT EName, YEAR(EDate) FROM EVENT;
EName
YEAR(EDate)
Debate
2026
Quiz
2026
Dance
2026
Drama
2026
Painting
2026
Singing
2026
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT EName FROM EVENT WHERE EName LIKE '%z';
EName
Quiz
Explanation: WHERE keeps only the rows where EName matches the pattern '%z': 1 of the 6 rows matches (Quiz). '%z' means the value ends with 'z'.
C3.36Practice3 marks
Consider the table EVENT given below. Write SQL queries to display:
Each EName and the position of the letter 'a' in it
The EName and EDate of the rows where the year of EDate is 2026 or later
Each EName and its Prize rounded to the nearest whole number.
Table: EVENT
ENo
EName
House
Points
Prize
EDate
1
Debate
Shivaji
30
2874.63
2026-07-02
2
Quiz
Raman
100
2924.74
2026-07-15
3
Dance
Shivaji
60
2767.11
2026-02-14
4
Drama
Raman
55
2300.04
2026-12-19
5
Painting
Shivaji
95
4017.09
2026-08-25
6
Singing
Tagore
75
1901.59
2026-10-04
Answer
(i)
SELECT EName, INSTR(EName, 'a') FROM EVENT;
EName
INSTR(EName, "a")
Debate
4
Quiz
0
Dance
2
Drama
3
Painting
2
Singing
0
Explanation: The function INSTR is worked out for every row that is shown.
(ii)
SELECT EName, EDate FROM EVENT WHERE YEAR(EDate) >= 2026;
EName
EDate
Debate
2026-07-02
Quiz
2026-07-15
Dance
2026-02-14
Drama
2026-12-19
Painting
2026-08-25
Singing
2026-10-04
Explanation: WHERE keeps only the rows where YEAR(EDate) is at least 2026: 6 of the 6 rows match (Debate, Quiz, Dance, Drama, Painting, Singing).
(iii)
SELECT EName, ROUND(Prize) FROM EVENT;
EName
ROUND(Prize)
Debate
2875
Quiz
2925
Dance
2767
Drama
2300
Painting
4017
Singing
1902
Explanation: The function ROUND is worked out for every row that is shown.
C3.37Practice3 marks
Consider the table TRAIN given below. Write SQL queries to display:
Each TName and the number of characters in it
The TName of the rows where the month of StartDate is 2
All the TName in alphabetical order.
Table: TRAIN
TNo
TName
Zone
Coaches
Fare
StartDate
12001
Rajdhani
Northern
17
2750.73
2017-02-22
12002
Shatabdi
Southern
24
2125.09
2024-03-03
12003
Duronto
Northern
13
2277.83
2024-03-16
12004
Garib Rath
Southern
10
3012.73
2021-04-10
12005
Tejas
Western
18
2091.89
2015-02-17
12006
Vande Bharat
Northern
20
1399.69
2020-04-10
Answer
(i)
SELECT TName, LENGTH(TName) FROM TRAIN;
TName
LENGTH(TName)
Rajdhani
8
Shatabdi
8
Duronto
7
Garib Rath
10
Tejas
5
Vande Bharat
12
Explanation: The function LENGTH is worked out for every row that is shown.
(ii)
SELECT TName FROM TRAIN WHERE MONTH(StartDate) = 2;
TName
Rajdhani
Tejas
Explanation: WHERE keeps only the rows where MONTH(StartDate) is 2: 2 of the 6 rows match (Rajdhani, Tejas).
(iii)
SELECT TName FROM TRAIN ORDER BY TName;
TName
Duronto
Garib Rath
Rajdhani
Shatabdi
Tejas
Vande Bharat
Explanation: ORDER BY TName arranges the result in ascending (smallest first) order.
C3.38Practice3 marks
Consider the table TRAIN given below. Write SQL queries to display:
The TName in small letters, of the rows where Zone is 'Northern'
Each TName and the name of the week day of StartDate
Each TName and the remainder when Coaches is divided by 7.
Table: TRAIN
TNo
TName
Zone
Coaches
Fare
StartDate
12001
Rajdhani
Northern
17
2750.73
2017-02-22
12002
Shatabdi
Southern
24
2125.09
2024-03-03
12003
Duronto
Northern
13
2277.83
2024-03-16
12004
Garib Rath
Southern
10
3012.73
2021-04-10
12005
Tejas
Western
18
2091.89
2015-02-17
12006
Vande Bharat
Northern
20
1399.69
2020-04-10
Answer
(i)
SELECT LOWER(TName) FROM TRAIN WHERE Zone = 'Northern';
LOWER(TName)
rajdhani
duronto
vande bharat
Explanation: WHERE keeps only the rows where Zone is 'Northern': 3 of the 6 rows match (Rajdhani, Duronto, Vande Bharat). The function LOWER is worked out for every row that is shown.
(ii)
SELECT TName, DAYNAME(StartDate) FROM TRAIN;
TName
DAYNAME(StartDate)
Rajdhani
Wednesday
Shatabdi
Sunday
Duronto
Saturday
Garib Rath
Saturday
Tejas
Tuesday
Vande Bharat
Friday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT TName, MOD(Coaches, 7) FROM TRAIN;
TName
MOD(Coaches, 7)
Rajdhani
3
Shatabdi
3
Duronto
6
Garib Rath
3
Tejas
4
Vande Bharat
6
Explanation: The function MOD is worked out for every row that is shown.
C3.39Practice3 marks
Consider the table LAPTOP given below. Write SQL queries to display:
Three characters of each Model, starting from the second character
The Model and Launch of the rows where the year of Launch is 2026 or later
The Model and RAM in descending order of RAM.
Table: LAPTOP
LNo
Model
Brand
RAM
Price
Launch
1
Astra 5
Orbit
16
86696.75
2026-11-10
2
Bolt X
Zenit
28
84541.93
2025-10-22
3
Comet Pro
Zenit
32
84965.49
2026-03-21
4
Dyna Air
Zenit
24
70706.77
2025-05-13
5
Eon Lite
Orbit
12
41551.16
2026-07-03
6
Flex 14
Nova
4
42044.12
2026-11-12
Answer
(i)
SELECT MID(Model, 2, 3) FROM LAPTOP;
MID(Model, 2, 3)
str
olt
ome
yna
on
lex
Explanation: The function MID is worked out for every row that is shown.
(ii)
SELECT Model, Launch FROM LAPTOP WHERE YEAR(Launch) >= 2026;
Model
Launch
Astra 5
2026-11-10
Comet Pro
2026-03-21
Eon Lite
2026-07-03
Flex 14
2026-11-12
Explanation: WHERE keeps only the rows where YEAR(Launch) is at least 2026: 4 of the 6 rows match (Astra 5, Comet Pro, Eon Lite, Flex 14).
(iii)
SELECT Model, RAM FROM LAPTOP ORDER BY RAM DESC;
Model
RAM
Comet Pro
32
Bolt X
28
Dyna Air
24
Astra 5
16
Eon Lite
12
Flex 14
4
Explanation: ORDER BY RAM arranges the result in descending (largest first) order.
C3.40Practice3 marks
Consider the table LAPTOP given below. Write SQL queries to display:
The Model in capital letters
Each Model and the name of the month of Launch
The Model that end with the letter 'X'.
Table: LAPTOP
LNo
Model
Brand
RAM
Price
Launch
1
Astra 5
Orbit
16
86696.75
2026-11-10
2
Bolt X
Zenit
28
84541.93
2025-10-22
3
Comet Pro
Zenit
32
84965.49
2026-03-21
4
Dyna Air
Zenit
24
70706.77
2025-05-13
5
Eon Lite
Orbit
12
41551.16
2026-07-03
6
Flex 14
Nova
4
42044.12
2026-11-12
Answer
(i)
SELECT UCASE(Model) FROM LAPTOP;
UCASE(Model)
ASTRA 5
BOLT X
COMET PRO
DYNA AIR
EON LITE
FLEX 14
Explanation: The function UCASE is worked out for every row that is shown.
(ii)
SELECT Model, MONTHNAME(Launch) FROM LAPTOP;
Model
MONTHNAME(Launch)
Astra 5
November
Bolt X
October
Comet Pro
March
Dyna Air
May
Eon Lite
July
Flex 14
November
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT Model FROM LAPTOP WHERE Model LIKE '%X';
Model
Bolt X
Explanation: WHERE keeps only the rows where Model matches the pattern '%X': 1 of the 6 rows matches (Bolt X). '%X' means the value ends with 'X'.
C3.41Practice3 marks
Consider the table CLUB given below. Write SQL queries to display:
Each MName and the position of the letter 'a' in it
Each MName and the name of the week day of DOJ
Each MName and its Fee rounded to one decimal place.
Table: CLUB
CNo
MName
Activity
Age
Fee
DOJ
1
Farhan
Tennis
27
1058.82
2026-12-05
2
Bhavna
Swimming
42
2296.53
2023-02-14
3
Lokesh
Yoga
16
805.04
2023-11-02
4
Simran
Yoga
36
1759.99
2026-03-27
5
Sachin
Tennis
17
3396.68
2026-04-14
6
Mohit
Yoga
56
1552.63
2023-06-09
Answer
(i)
SELECT MName, INSTR(MName, 'a') FROM CLUB;
MName
INSTR(MName, "a")
Farhan
2
Bhavna
3
Lokesh
0
Simran
5
Sachin
2
Mohit
0
Explanation: The function INSTR is worked out for every row that is shown.
(ii)
SELECT MName, DAYNAME(DOJ) FROM CLUB;
MName
DAYNAME(DOJ)
Farhan
Saturday
Bhavna
Tuesday
Lokesh
Thursday
Simran
Friday
Sachin
Tuesday
Mohit
Friday
Explanation: The function DAYNAME is worked out for every row that is shown.
(iii)
SELECT MName, ROUND(Fee, 1) FROM CLUB;
MName
ROUND(Fee, 1)
Farhan
1058.8
Bhavna
2296.5
Lokesh
805.0
Simran
1760.0
Sachin
3396.7
Mohit
1552.6
Explanation: The function ROUND is worked out for every row that is shown.
C3.42Practice3 marks
Consider the table CLUB given below. Write SQL queries to display:
The first three characters of each MName
Each MName and the year of DOJ
All the MName in alphabetical order.
Table: CLUB
CNo
MName
Activity
Age
Fee
DOJ
1
Farhan
Tennis
27
1058.82
2026-12-05
2
Bhavna
Swimming
42
2296.53
2023-02-14
3
Lokesh
Yoga
16
805.04
2023-11-02
4
Simran
Yoga
36
1759.99
2026-03-27
5
Sachin
Tennis
17
3396.68
2026-04-14
6
Mohit
Yoga
56
1552.63
2023-06-09
Answer
(i)
SELECT LEFT(MName, 3) FROM CLUB;
LEFT(MName, 3)
Far
Bha
Lok
Sim
Sac
Moh
Explanation: The function LEFT is worked out for every row that is shown.
(ii)
SELECT MName, YEAR(DOJ) FROM CLUB;
MName
YEAR(DOJ)
Farhan
2026
Bhavna
2023
Lokesh
2023
Simran
2026
Sachin
2026
Mohit
2023
Explanation: The function YEAR is worked out for every row that is shown.
(iii)
SELECT MName FROM CLUB ORDER BY MName;
MName
Bhavna
Farhan
Lokesh
Mohit
Sachin
Simran
Explanation: ORDER BY MName arranges the result in ascending (smallest first) order.
C3.43Practice3 marks
Consider the table FARM given below. Write SQL queries to display:
The Farmer in small letters, of the rows where Crop is 'Maize'
Each Farmer and the name of the month of SowDate
Each Farmer and its Yield rounded to the nearest whole number.
Table: FARM
FNo
Farmer
Crop
Acres
Yield
SowDate
1
Arjun
Maize
39
34.42
2026-12-19
2
Anita
Wheat
9
40.16
2025-07-19
3
Isha
Rice
11
24.93
2026-02-23
4
Sonal
Wheat
16
46.04
2025-06-25
5
Vandana
Rice
6
41.02
2026-10-11
6
Harish
Wheat
23
23.82
2025-11-28
Answer
(i)
SELECT LOWER(Farmer) FROM FARM WHERE Crop = 'Maize';
LOWER(Farmer)
arjun
Explanation: WHERE keeps only the rows where Crop is 'Maize': 1 of the 6 rows matches (Arjun). The function LOWER is worked out for every row that is shown.
(ii)
SELECT Farmer, MONTHNAME(SowDate) FROM FARM;
Farmer
MONTHNAME(SowDate)
Arjun
December
Anita
July
Isha
February
Sonal
June
Vandana
October
Harish
November
Explanation: The function MONTHNAME is worked out for every row that is shown.
(iii)
SELECT Farmer, ROUND(Yield) FROM FARM;
Farmer
ROUND(Yield)
Arjun
34
Anita
40
Isha
25
Sonal
46
Vandana
41
Harish
24
Explanation: The function ROUND is worked out for every row that is shown.
C3.44Practice3 marks
Consider the table FARM given below. Write SQL queries to display:
The last two characters of each Farmer
The Farmer of the rows where the month of SowDate is 12
The Farmer and Acres in descending order of Acres.
Table: FARM
FNo
Farmer
Crop
Acres
Yield
SowDate
1
Arjun
Maize
39
34.42
2026-12-19
2
Anita
Wheat
9
40.16
2025-07-19
3
Isha
Rice
11
24.93
2026-02-23
4
Sonal
Wheat
16
46.04
2025-06-25
5
Vandana
Rice
6
41.02
2026-10-11
6
Harish
Wheat
23
23.82
2025-11-28
Answer
(i)
SELECT RIGHT(Farmer, 2) FROM FARM;
RIGHT(Farmer, 2)
un
ta
ha
al
na
sh
Explanation: The function RIGHT is worked out for every row that is shown.
(ii)
SELECT Farmer FROM FARM WHERE MONTH(SowDate) = 12;
Farmer
Arjun
Explanation: WHERE keeps only the rows where MONTH(SowDate) is 12: 1 of the 6 rows matches (Arjun).
(iii)
SELECT Farmer, Acres FROM FARM ORDER BY Acres DESC;
Farmer
Acres
Arjun
39
Harish
23
Sonal
16
Isha
11
Anita
9
Vandana
6
Explanation: ORDER BY Acres arranges the result in descending (largest first) order.
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Monthly Sales', the X-axis label 'Month', the Y-axis label 'Sales (in thousand Rs)'. Also save the chart as monthly.png.
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Sales of Two Years', the X-axis label 'Month', the Y-axis label 'Sales (in lakh Rs)', a legend.
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Temperature in a Week', the X-axis label 'Day', the Y-axis label 'Temperature (C)'.
day = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
temperature = [30, 34, 37, 24, 40, 26, 39]
Answer
import matplotlib.pyplot as plt
day = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
temperature = [30, 34, 37, 24, 40, 26, 39]
plt.plot(day, temperature, color='red', linestyle='--')
plt.title('Temperature in a Week')
plt.xlabel('Day')
plt.ylabel('Temperature (C)')
plt.show()
The chart that this program draws:
D1.4Practice4 marks
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Runs in Five Matches', the X-axis label 'Match', the Y-axis label 'Runs', a legend. Also save the chart as runs.png.
import matplotlib.pyplot as plt
match = [1, 2, 3, 4, 5]
rohit = [15, 96, 93, 20, 47]
virat = [67, 33, 81, 34, 34]
plt.plot(match, rohit, label='Rohit')
plt.plot(match, virat, label='Virat')
plt.title('Runs in Five Matches')
plt.xlabel('Match')
plt.ylabel('Runs')
plt.legend()
plt.savefig('runs.png')
plt.show()
The chart that this program draws:
D1.5Practice4 marks
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Growth of a Plant', the X-axis label 'Week', the Y-axis label 'Height (cm)'.
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Students Enrolled', the X-axis label 'Year', the Y-axis label 'Number of Students', a legend.
import matplotlib.pyplot as plt
year = [2022, 2023, 2024, 2025, 2026]
boys = [510, 410, 410, 560, 470]
girls = [580, 290, 360, 520, 360]
plt.plot(year, boys, label='Boys')
plt.plot(year, girls, label='Girls')
plt.title('Students Enrolled')
plt.xlabel('Year')
plt.ylabel('Number of Students')
plt.legend()
plt.show()
The chart that this program draws:
D1.7Practice4 marks
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Price of Gold', the X-axis label 'Month', the Y-axis label 'Price (in thousand Rs)'. Also save the chart as price.png.
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Website Visitors', the X-axis label 'Day', the Y-axis label 'Visitors'.
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Rainfall of Two Cities', the X-axis label 'Month', the Y-axis label 'Rainfall (mm)', a legend.
Write a Python program to draw a line chart for the data given below. The chart must have the title 'Marks in Unit Tests', the X-axis label 'Test', the Y-axis label 'Marks', a legend. Also save the chart as marks.png.
test = ['UT1', 'UT2', 'UT3', 'UT4']
asha = [26, 32, 40, 26]
ravi = [22, 15, 39, 34]
Answer
import matplotlib.pyplot as plt
test = ['UT1', 'UT2', 'UT3', 'UT4']
asha = [26, 32, 40, 26]
ravi = [22, 15, 39, 34]
plt.plot(test, asha, label='Asha')
plt.plot(test, ravi, label='Ravi')
plt.title('Marks in Unit Tests')
plt.xlabel('Test')
plt.ylabel('Marks')
plt.legend()
plt.savefig('marks.png')
plt.show()
The chart that this program draws:
D1.11Practice4 marks
Write a Python program to draw a bar chart for the data given below. The chart must have the title 'Students in Four Houses', the X-axis label 'House', the Y-axis label 'Number of Students'.
import matplotlib.pyplot as plt
house = ['Shivaji', 'Tagore', 'Raman', 'Ashoka']
values = [150, 90, 120, 125]
plt.bar(house, values, color='green')
plt.title('Students in Four Houses')
plt.xlabel('House')
plt.ylabel('Number of Students')
plt.show()
The chart that this program draws:
D1.12Practice4 marks
Write a Python program to draw a bar chart for the data given below. The chart must have the title 'Books Sold', the X-axis label 'Subject', the Y-axis label 'Number of Books'.
Write a Python program to draw a bar chart for the data given below. The chart must have the title 'Medals Won', the X-axis label 'Country', the Y-axis label 'Medals'. Also save the chart as medals.png.
Write a Python program to draw a bar chart for the data given below. The chart must have the title 'Result of Class XII', the X-axis label 'Stream', the Y-axis label 'Pass Percentage'.
import matplotlib.pyplot as plt
stream = ['Science', 'Commerce', 'Humanities']
values = [83, 80, 95]
plt.bar(stream, values, color='purple')
plt.title('Result of Class XII')
plt.xlabel('Stream')
plt.ylabel('Pass Percentage')
plt.show()
The chart that this program draws:
D1.15Practice4 marks
Write a Python program to draw a horizontal bar chart for the data given below. The chart must have the title 'Population of Cities', the X-axis label 'Population (in lakh)', the Y-axis label 'City'.
import matplotlib.pyplot as plt
city = ['Agra', 'Pune', 'Surat', 'Patna']
values = [22, 53, 24, 37]
plt.barh(city, values, color='teal')
plt.title('Population of Cities')
plt.xlabel('Population (in lakh)')
plt.ylabel('City')
plt.show()
The chart that this program draws:
D1.16Practice4 marks
Write a Python program to draw a bar chart for the data given below. The chart must have the title 'Daily Sale of a Canteen', the X-axis label 'Item', the Y-axis label 'Plates Sold'. Also save the chart as daily.png.
import matplotlib.pyplot as plt
item = ['Samosa', 'Idli', 'Poha', 'Sandwich']
values = [45, 65, 145, 70]
plt.bar(item, values, color='brown', edgecolor='black')
plt.title('Daily Sale of a Canteen')
plt.xlabel('Item')
plt.ylabel('Plates Sold')
plt.savefig('daily.png')
plt.show()
The chart that this program draws:
D1.17Practice4 marks
Write a Python program to draw a horizontal bar chart for the data given below. The chart must have the title 'Favourite Sport', the X-axis label 'Number of Students', the Y-axis label 'Sport'.
import matplotlib.pyplot as plt
sport = ['Cricket', 'Football', 'Chess', 'Kabaddi']
values = [53, 47, 52, 22]
plt.barh(sport, values, color='red')
plt.title('Favourite Sport')
plt.xlabel('Number of Students')
plt.ylabel('Sport')
plt.show()
The chart that this program draws:
D1.18Practice4 marks
Write a Python program to draw a bar chart for the data given below. The chart must have the title 'Trees Planted', the X-axis label 'Class', the Y-axis label 'Number of Trees'.
Write a Python program to draw a histogram for the data given below. The chart must have the title 'Marks of 20 Students', the X-axis label 'Marks', the Y-axis label 'Number of Students', the bin edges [0, 20, 40, 60, 80, 100]. Also save the chart as marks.png.
Write a Python program to draw a histogram for the data given below. The chart must have the title 'Ages of Members', the X-axis label 'Age', the Y-axis label 'Number of Members', 5 intervals (bins).
import matplotlib.pyplot as plt
age = [55, 45, 59, 29, 30, 27, 47, 27, 23, 21, 46, 27, 42, 19, 37, 18, 15, 52]
plt.hist(age, bins=5, edgecolor='black', color='orange')
plt.title('Ages of Members')
plt.xlabel('Age')
plt.ylabel('Number of Members')
plt.show()
The chart that this program draws:
D1.21Practice4 marks
Write a Python program to draw a histogram for the data given below. The chart must have the title 'Heights of Students', the X-axis label 'Height (cm)', the Y-axis label 'Number of Students', 4 intervals (bins).
Write a Python program to draw a histogram for the data given below. The chart must have the title 'Daily Temperature', the X-axis label 'Temperature (C)', the Y-axis label 'Number of Days', the bin edges [15, 20, 25, 30, 35, 40, 45]. Also save the chart as daily.png.
Write a Python program to draw a histogram for the data given below. The chart must have the title 'Weights of Parcels', the X-axis label 'Weight (kg)', the Y-axis label 'Number of Parcels', 6 intervals (bins).
Write a Python program to draw a histogram for the data given below. The chart must have the title 'Scores in a Quiz', the X-axis label 'Score', the Y-axis label 'Number of Students', the bin edges [0, 10, 20, 30, 40, 50].
D2GROUP BY, HAVING and two tables4 marks · 44 questions
D2.1Practice4 marks
Consider the tables PATIENT and DEPARTMENT given below. Write SQL queries to display:
Each Dept and the number of rows in it
Each Dept and its total Days, only for the groups whose total Days is more than 20
The PName of each row with the Doctor of its Dept, using both the tables
The PName, Days and Floor of the rows where Days is more than 7, using both the tables.
Table: PATIENT
PNo
PName
Dept
Days
Bill
DOA
101
Yash
Cardiology
2
5000.32
2026-03-11
102
Chetan
Cardiology
15
5983.68
2026-03-01
103
Zeenat
Cardiology
4
8922.89
2026-07-02
104
Swati
Ortho
7
6492.81
2026-04-01
105
Pankaj
ENT
14
8701.77
2026-03-13
106
Mohit
ENT
13
5473.26
2026-02-19
Table: DEPARTMENT
Dept
Doctor
Floor
Cardiology
Dr. Rao
2
ENT
Dr. Sen
1
Ortho
Dr. Ali
3
Answer
(i)
SELECT Dept, COUNT(*) FROM PATIENT GROUP BY Dept;
Dept
COUNT(*)
Cardiology
3
ENT
2
Ortho
1
Explanation: GROUP BY Dept makes 3 groups (Cardiology, ENT, Ortho); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Dept, SUM(Days) FROM PATIENT GROUP BY Dept HAVING SUM(Days) > 20;
Dept
SUM(Days)
Cardiology
21
ENT
27
Explanation: GROUP BY Dept makes 3 groups (Cardiology, ENT, Ortho); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Days) is more than 20. SUM adds the values.
(iii)
SELECT PName, Doctor FROM PATIENT, DEPARTMENT WHERE PATIENT.Dept = DEPARTMENT.Dept;
PName
Doctor
Yash
Dr. Rao
Chetan
Dr. Rao
Zeenat
Dr. Rao
Swati
Dr. Ali
Pankaj
Dr. Sen
Mohit
Dr. Sen
Explanation: The two tables PATIENT and DEPARTMENT are joined: only the row pairs where PATIENT.Dept = DEPARTMENT.Dept are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT PName, Days, Floor FROM PATIENT, DEPARTMENT WHERE PATIENT.Dept = DEPARTMENT.Dept AND Days > 7;
PName
Days
Floor
Chetan
15
2
Pankaj
14
1
Mohit
13
1
Explanation: The two tables PATIENT and DEPARTMENT are joined: only the row pairs where PATIENT.Dept = DEPARTMENT.Dept are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Days is more than 7.
D2.2Practice4 marks
Consider the tables PATIENT and DEPARTMENT given below. Write the output of the following queries.
Table: PATIENT
PNo
PName
Dept
Days
Bill
DOA
101
Yash
Cardiology
2
5000.32
2026-03-11
102
Chetan
Cardiology
15
5983.68
2026-03-01
103
Zeenat
Cardiology
4
8922.89
2026-07-02
104
Swati
Ortho
7
6492.81
2026-04-01
105
Pankaj
ENT
14
8701.77
2026-03-13
106
Mohit
ENT
13
5473.26
2026-02-19
Table: DEPARTMENT
Dept
Doctor
Floor
Cardiology
Dr. Rao
2
ENT
Dr. Sen
1
Ortho
Dr. Ali
3
(i) SELECT Dept, COUNT(*) FROM PATIENT GROUP BY Dept HAVING COUNT(*) > 1;
(ii) SELECT Dept, MAX(Days) FROM PATIENT GROUP BY Dept ORDER BY MAX(Days) DESC;
(iii) SELECT PName, Days, Floor FROM PATIENT, DEPARTMENT WHERE PATIENT.Dept = DEPARTMENT.Dept AND Days > 7;
(iv) SELECT PName, Doctor FROM PATIENT, DEPARTMENT WHERE PATIENT.Dept = DEPARTMENT.Dept AND Doctor = 'Dr. Rao';
Answer
(i)
Dept
COUNT(*)
Cardiology
3
ENT
2
Explanation: GROUP BY Dept makes 3 groups (Cardiology, ENT, Ortho); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Dept
MAX(Days)
Cardiology
15
ENT
14
Ortho
7
Explanation: GROUP BY Dept makes 3 groups (Cardiology, ENT, Ortho); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Days) arranges the result in descending (largest first) order.
(iii)
PName
Days
Floor
Chetan
15
2
Pankaj
14
1
Mohit
13
1
Explanation: The two tables PATIENT and DEPARTMENT are joined: only the row pairs where PATIENT.Dept = DEPARTMENT.Dept are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Days is more than 7.
(iv)
PName
Doctor
Yash
Dr. Rao
Chetan
Dr. Rao
Zeenat
Dr. Rao
Explanation: The two tables PATIENT and DEPARTMENT are joined: only the row pairs where PATIENT.Dept = DEPARTMENT.Dept are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Doctor is 'Dr. Rao'.
D2.3Practice4 marks
Consider the tables EMPLOYEE and DEPT given below. Write SQL queries to display:
The Dept that have more than one row
Each Dept with its highest Salary, in descending order of the highest Salary
The EName of each row with the Manager of its Dept, using both the tables
The EName, Salary and Staff of the rows where Salary is more than 40000, using both the tables.
Table: EMPLOYEE
ENo
EName
Dept
Salary
Bonus
DOJ
11
Isha
HR
43000
3522.37
2023-02-02
12
Yash
Sales
40000
1725.02
2025-08-02
13
Suman
HR
44000
3550.14
2019-09-25
14
Jatin
Sales
45000
1269.74
2025-03-19
15
Nikhil
Sales
25000
3263.38
2022-09-09
16
Sachin
Accounts
31000
3064.28
2021-05-17
Table: DEPT
Dept
Manager
Staff
Sales
Mr. Bose
12
Accounts
Ms. Kaul
8
HR
Mr. Nair
5
Answer
(i)
SELECT Dept, COUNT(*) FROM EMPLOYEE GROUP BY Dept HAVING COUNT(*) > 1;
Dept
COUNT(*)
HR
2
Sales
3
Explanation: GROUP BY Dept makes 3 groups (Accounts, HR, Sales); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Dept, MAX(Salary) FROM EMPLOYEE GROUP BY Dept ORDER BY MAX(Salary) DESC;
Dept
MAX(Salary)
Sales
45000
HR
44000
Accounts
31000
Explanation: GROUP BY Dept makes 3 groups (Accounts, HR, Sales); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Salary) arranges the result in descending (largest first) order.
(iii)
SELECT EName, Manager FROM EMPLOYEE, DEPT WHERE EMPLOYEE.Dept = DEPT.Dept;
EName
Manager
Isha
Mr. Nair
Yash
Mr. Bose
Suman
Mr. Nair
Jatin
Mr. Bose
Nikhil
Mr. Bose
Sachin
Ms. Kaul
Explanation: The two tables EMPLOYEE and DEPT are joined: only the row pairs where EMPLOYEE.Dept = DEPT.Dept are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT EName, Salary, Staff FROM EMPLOYEE, DEPT WHERE EMPLOYEE.Dept = DEPT.Dept AND Salary > 40000;
EName
Salary
Staff
Isha
43000
5
Suman
44000
5
Jatin
45000
12
Explanation: The two tables EMPLOYEE and DEPT are joined: only the row pairs where EMPLOYEE.Dept = DEPT.Dept are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Salary is more than 40000.
D2.4Practice4 marks
Consider the tables EMPLOYEE and DEPT given below. Write the output of the following queries.
Table: EMPLOYEE
ENo
EName
Dept
Salary
Bonus
DOJ
11
Isha
HR
43000
3522.37
2023-02-02
12
Yash
Sales
40000
1725.02
2025-08-02
13
Suman
HR
44000
3550.14
2019-09-25
14
Jatin
Sales
45000
1269.74
2025-03-19
15
Nikhil
Sales
25000
3263.38
2022-09-09
16
Sachin
Accounts
31000
3064.28
2021-05-17
Table: DEPT
Dept
Manager
Staff
Sales
Mr. Bose
12
Accounts
Ms. Kaul
8
HR
Mr. Nair
5
(i) SELECT Dept, SUM(Salary) FROM EMPLOYEE GROUP BY Dept HAVING SUM(Salary) > 87000;
(ii) SELECT Dept, COUNT(*) FROM EMPLOYEE GROUP BY Dept;
(iii) SELECT EName, Salary, Staff FROM EMPLOYEE, DEPT WHERE EMPLOYEE.Dept = DEPT.Dept AND Salary > 40000;
(iv) SELECT EName, Manager FROM EMPLOYEE, DEPT WHERE EMPLOYEE.Dept = DEPT.Dept AND Manager = 'Mr. Bose';
Answer
(i)
Dept
SUM(Salary)
Sales
110000
Explanation: GROUP BY Dept makes 3 groups (Accounts, HR, Sales); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Salary) is more than 87000. SUM adds the values.
(ii)
Dept
COUNT(*)
Accounts
1
HR
2
Sales
3
Explanation: GROUP BY Dept makes 3 groups (Accounts, HR, Sales); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
EName
Salary
Staff
Isha
43000
5
Suman
44000
5
Jatin
45000
12
Explanation: The two tables EMPLOYEE and DEPT are joined: only the row pairs where EMPLOYEE.Dept = DEPT.Dept are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Salary is more than 40000.
(iv)
EName
Manager
Yash
Mr. Bose
Jatin
Mr. Bose
Nikhil
Mr. Bose
Explanation: The two tables EMPLOYEE and DEPT are joined: only the row pairs where EMPLOYEE.Dept = DEPT.Dept are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Manager is 'Mr. Bose'.
D2.5Practice4 marks
Consider the tables BOOK and GENRE given below. Write SQL queries to display:
Each Genre and the number of rows in it
Each Genre and its total Pages, only for the groups whose total Pages is more than 590
The Title of each row with the Shelf of its Genre, using both the tables
The Title, Pages and Copies of the rows where Pages is more than 290, using both the tables.
Table: BOOK
BNo
Title
Genre
Pages
Price
DOP
1
Wings of Fire
Fiction
120
342.44
2022-06-18
2
Malgudi Days
Fiction
290
337.03
2025-06-20
3
Panchatantra
Biography
150
339.91
2021-07-27
4
Godan
Poetry
320
195.34
2024-05-13
5
Gitanjali
Biography
440
520.87
2024-10-12
6
Train to Pakistan
Fiction
330
359.45
2021-10-21
Table: GENRE
Genre
Shelf
Copies
Fiction
S1
40
Biography
S2
15
Poetry
S3
22
Answer
(i)
SELECT Genre, COUNT(*) FROM BOOK GROUP BY Genre;
Genre
COUNT(*)
Biography
2
Fiction
3
Poetry
1
Explanation: GROUP BY Genre makes 3 groups (Biography, Fiction, Poetry); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Genre, SUM(Pages) FROM BOOK GROUP BY Genre HAVING SUM(Pages) > 590;
Genre
SUM(Pages)
Fiction
740
Explanation: GROUP BY Genre makes 3 groups (Biography, Fiction, Poetry); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Pages) is more than 590. SUM adds the values.
(iii)
SELECT Title, Shelf FROM BOOK, GENRE WHERE BOOK.Genre = GENRE.Genre;
Title
Shelf
Wings of Fire
S1
Malgudi Days
S1
Panchatantra
S2
Godan
S3
Gitanjali
S2
Train to Pakistan
S1
Explanation: The two tables BOOK and GENRE are joined: only the row pairs where BOOK.Genre = GENRE.Genre are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT Title, Pages, Copies FROM BOOK, GENRE WHERE BOOK.Genre = GENRE.Genre AND Pages > 290;
Title
Pages
Copies
Godan
320
22
Gitanjali
440
15
Train to Pakistan
330
40
Explanation: The two tables BOOK and GENRE are joined: only the row pairs where BOOK.Genre = GENRE.Genre are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Pages is more than 290.
D2.6Practice4 marks
Consider the tables BOOK and GENRE given below. Write the output of the following queries.
Table: BOOK
BNo
Title
Genre
Pages
Price
DOP
1
Wings of Fire
Fiction
120
342.44
2022-06-18
2
Malgudi Days
Fiction
290
337.03
2025-06-20
3
Panchatantra
Biography
150
339.91
2021-07-27
4
Godan
Poetry
320
195.34
2024-05-13
5
Gitanjali
Biography
440
520.87
2024-10-12
6
Train to Pakistan
Fiction
330
359.45
2021-10-21
Table: GENRE
Genre
Shelf
Copies
Fiction
S1
40
Biography
S2
15
Poetry
S3
22
(i) SELECT Genre, COUNT(*) FROM BOOK GROUP BY Genre HAVING COUNT(*) > 1;
(ii) SELECT Genre, MAX(Pages) FROM BOOK GROUP BY Genre ORDER BY MAX(Pages) DESC;
(iii) SELECT Title, Pages, Copies FROM BOOK, GENRE WHERE BOOK.Genre = GENRE.Genre AND Pages > 290;
(iv) SELECT Title, Shelf FROM BOOK, GENRE WHERE BOOK.Genre = GENRE.Genre AND Shelf = 'S1';
Answer
(i)
Genre
COUNT(*)
Biography
2
Fiction
3
Explanation: GROUP BY Genre makes 3 groups (Biography, Fiction, Poetry); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Genre
MAX(Pages)
Biography
440
Fiction
330
Poetry
320
Explanation: GROUP BY Genre makes 3 groups (Biography, Fiction, Poetry); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Pages) arranges the result in descending (largest first) order.
(iii)
Title
Pages
Copies
Godan
320
22
Gitanjali
440
15
Train to Pakistan
330
40
Explanation: The two tables BOOK and GENRE are joined: only the row pairs where BOOK.Genre = GENRE.Genre are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Pages is more than 290.
(iv)
Title
Shelf
Wings of Fire
S1
Malgudi Days
S1
Train to Pakistan
S1
Explanation: The two tables BOOK and GENRE are joined: only the row pairs where BOOK.Genre = GENRE.Genre are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Shelf is 'S1'.
D2.7Practice4 marks
Consider the tables STUDENT and STREAM given below. Write SQL queries to display:
The Stream that have more than one row
Each Stream with its highest Marks, in descending order of the highest Marks
The SName of each row with the Teacher of its Stream, using both the tables
The SName, Marks and Seats of the rows where Marks is more than 71, using both the tables.
Table: STUDENT
RNo
SName
Stream
Marks
Fees
DOB
1
Isha
Science
71
6193.93
2008-08-26
2
Deepak
Science
60
3799.37
2008-11-04
3
Geeta
Science
88
3372.65
2010-03-11
4
Tanvi
Humanities
76
4392.13
2009-02-04
5
Rohan
Commerce
63
3443.29
2008-05-08
6
Umesh
Commerce
85
2597.32
2010-06-25
Table: STREAM
Stream
Teacher
Seats
Science
Mr. Iyer
40
Commerce
Ms. Gill
45
Humanities
Mr. Khan
35
Answer
(i)
SELECT Stream, COUNT(*) FROM STUDENT GROUP BY Stream HAVING COUNT(*) > 1;
Stream
COUNT(*)
Commerce
2
Science
3
Explanation: GROUP BY Stream makes 3 groups (Commerce, Humanities, Science); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Stream, MAX(Marks) FROM STUDENT GROUP BY Stream ORDER BY MAX(Marks) DESC;
Stream
MAX(Marks)
Science
88
Commerce
85
Humanities
76
Explanation: GROUP BY Stream makes 3 groups (Commerce, Humanities, Science); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Marks) arranges the result in descending (largest first) order.
(iii)
SELECT SName, Teacher FROM STUDENT, STREAM WHERE STUDENT.Stream = STREAM.Stream;
SName
Teacher
Isha
Mr. Iyer
Deepak
Mr. Iyer
Geeta
Mr. Iyer
Tanvi
Mr. Khan
Rohan
Ms. Gill
Umesh
Ms. Gill
Explanation: The two tables STUDENT and STREAM are joined: only the row pairs where STUDENT.Stream = STREAM.Stream are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT SName, Marks, Seats FROM STUDENT, STREAM WHERE STUDENT.Stream = STREAM.Stream AND Marks > 71;
SName
Marks
Seats
Geeta
88
40
Tanvi
76
35
Umesh
85
45
Explanation: The two tables STUDENT and STREAM are joined: only the row pairs where STUDENT.Stream = STREAM.Stream are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Marks is more than 71.
D2.8Practice4 marks
Consider the tables STUDENT and STREAM given below. Write the output of the following queries.
Table: STUDENT
RNo
SName
Stream
Marks
Fees
DOB
1
Isha
Science
71
6193.93
2008-08-26
2
Deepak
Science
60
3799.37
2008-11-04
3
Geeta
Science
88
3372.65
2010-03-11
4
Tanvi
Humanities
76
4392.13
2009-02-04
5
Rohan
Commerce
63
3443.29
2008-05-08
6
Umesh
Commerce
85
2597.32
2010-06-25
Table: STREAM
Stream
Teacher
Seats
Science
Mr. Iyer
40
Commerce
Ms. Gill
45
Humanities
Mr. Khan
35
(i) SELECT Stream, SUM(Marks) FROM STUDENT GROUP BY Stream HAVING SUM(Marks) > 145;
(ii) SELECT Stream, COUNT(*) FROM STUDENT GROUP BY Stream;
(iii) SELECT SName, Marks, Seats FROM STUDENT, STREAM WHERE STUDENT.Stream = STREAM.Stream AND Marks > 71;
(iv) SELECT SName, Teacher FROM STUDENT, STREAM WHERE STUDENT.Stream = STREAM.Stream AND Teacher = 'Mr. Iyer';
Answer
(i)
Stream
SUM(Marks)
Commerce
148
Science
219
Explanation: GROUP BY Stream makes 3 groups (Commerce, Humanities, Science); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Marks) is more than 145. SUM adds the values.
(ii)
Stream
COUNT(*)
Commerce
2
Humanities
1
Science
3
Explanation: GROUP BY Stream makes 3 groups (Commerce, Humanities, Science); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
SName
Marks
Seats
Geeta
88
40
Tanvi
76
35
Umesh
85
45
Explanation: The two tables STUDENT and STREAM are joined: only the row pairs where STUDENT.Stream = STREAM.Stream are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Marks is more than 71.
(iv)
SName
Teacher
Isha
Mr. Iyer
Deepak
Mr. Iyer
Geeta
Mr. Iyer
Explanation: The two tables STUDENT and STREAM are joined: only the row pairs where STUDENT.Stream = STREAM.Stream are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Teacher is 'Mr. Iyer'.
D2.9Practice4 marks
Consider the tables PRODUCT and COMPANY given below. Write SQL queries to display:
Each Company and the number of rows in it
Each Company and its total Stock, only for the groups whose total Stock is more than 210
The PName of each row with the City of its Company, using both the tables
The PName, Stock and Agents of the rows where Stock is more than 110, using both the tables.
Table: PRODUCT
PCode
PName
Company
Stock
Price
MfgDate
501
Soap
Neha Foods
130
114.82
2026-04-27
502
Shampoo
Sai Mart
40
387.16
2026-05-15
503
Biscuit
Neha Foods
110
187.06
2026-07-05
504
Toothpaste
Om Traders
30
275.28
2026-11-16
505
Juice
Neha Foods
120
111.88
2026-11-04
506
Butter
Om Traders
180
293.32
2026-04-27
Table: COMPANY
Company
City
Agents
Neha Foods
Indore
14
Om Traders
Nagpur
9
Sai Mart
Kanpur
6
Answer
(i)
SELECT Company, COUNT(*) FROM PRODUCT GROUP BY Company;
Company
COUNT(*)
Neha Foods
3
Om Traders
2
Sai Mart
1
Explanation: GROUP BY Company makes 3 groups (Neha Foods, Om Traders, Sai Mart); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Company, SUM(Stock) FROM PRODUCT GROUP BY Company HAVING SUM(Stock) > 210;
Company
SUM(Stock)
Neha Foods
360
Explanation: GROUP BY Company makes 3 groups (Neha Foods, Om Traders, Sai Mart); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Stock) is more than 210. SUM adds the values.
(iii)
SELECT PName, City FROM PRODUCT, COMPANY WHERE PRODUCT.Company = COMPANY.Company;
PName
City
Soap
Indore
Shampoo
Kanpur
Biscuit
Indore
Toothpaste
Nagpur
Juice
Indore
Butter
Nagpur
Explanation: The two tables PRODUCT and COMPANY are joined: only the row pairs where PRODUCT.Company = COMPANY.Company are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT PName, Stock, Agents FROM PRODUCT, COMPANY WHERE PRODUCT.Company = COMPANY.Company AND Stock > 110;
PName
Stock
Agents
Soap
130
14
Juice
120
14
Butter
180
9
Explanation: The two tables PRODUCT and COMPANY are joined: only the row pairs where PRODUCT.Company = COMPANY.Company are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Stock is more than 110.
D2.10Practice4 marks
Consider the tables PRODUCT and COMPANY given below. Write the output of the following queries.
Table: PRODUCT
PCode
PName
Company
Stock
Price
MfgDate
501
Soap
Neha Foods
130
114.82
2026-04-27
502
Shampoo
Sai Mart
40
387.16
2026-05-15
503
Biscuit
Neha Foods
110
187.06
2026-07-05
504
Toothpaste
Om Traders
30
275.28
2026-11-16
505
Juice
Neha Foods
120
111.88
2026-11-04
506
Butter
Om Traders
180
293.32
2026-04-27
Table: COMPANY
Company
City
Agents
Neha Foods
Indore
14
Om Traders
Nagpur
9
Sai Mart
Kanpur
6
(i) SELECT Company, COUNT(*) FROM PRODUCT GROUP BY Company HAVING COUNT(*) > 1;
(ii) SELECT Company, MAX(Stock) FROM PRODUCT GROUP BY Company ORDER BY MAX(Stock) DESC;
(iii) SELECT PName, Stock, Agents FROM PRODUCT, COMPANY WHERE PRODUCT.Company = COMPANY.Company AND Stock > 110;
(iv) SELECT PName, City FROM PRODUCT, COMPANY WHERE PRODUCT.Company = COMPANY.Company AND City = 'Indore';
Answer
(i)
Company
COUNT(*)
Neha Foods
3
Om Traders
2
Explanation: GROUP BY Company makes 3 groups (Neha Foods, Om Traders, Sai Mart); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Company
MAX(Stock)
Om Traders
180
Neha Foods
130
Sai Mart
40
Explanation: GROUP BY Company makes 3 groups (Neha Foods, Om Traders, Sai Mart); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Stock) arranges the result in descending (largest first) order.
(iii)
PName
Stock
Agents
Soap
130
14
Juice
120
14
Butter
180
9
Explanation: The two tables PRODUCT and COMPANY are joined: only the row pairs where PRODUCT.Company = COMPANY.Company are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Stock is more than 110.
(iv)
PName
City
Soap
Indore
Biscuit
Indore
Juice
Indore
Explanation: The two tables PRODUCT and COMPANY are joined: only the row pairs where PRODUCT.Company = COMPANY.Company are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: City is 'Indore'.
D2.11Practice4 marks
Consider the tables MEMBER and PLAN given below. Write SQL queries to display:
The Plan that have more than one row
Each Plan with its highest Months, in descending order of the highest Months
The MName of each row with the Trainer of its Plan, using both the tables
The MName, Months and Hours of the rows where Months is more than 6, using both the tables.
Table: MEMBER
MNo
MName
Plan
Months
Fee
JoinDate
1
Mohit
Gold
3
2755.29
2026-07-09
2
Vikas
Gold
9
1680.76
2025-04-25
3
Tanvi
Silver
12
2149.51
2025-01-03
4
Pallavi
Gold
4
1398.78
2026-05-02
5
Divya
Silver
6
2568.09
2025-06-13
6
Aman
Basic
8
2546.01
2026-06-19
Table: PLAN
Plan
Trainer
Hours
Gold
Vijay
3
Silver
Sana
2
Basic
Rocky
1
Answer
(i)
SELECT Plan, COUNT(*) FROM MEMBER GROUP BY Plan HAVING COUNT(*) > 1;
Plan
COUNT(*)
Gold
3
Silver
2
Explanation: GROUP BY Plan makes 3 groups (Basic, Gold, Silver); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Plan, MAX(Months) FROM MEMBER GROUP BY Plan ORDER BY MAX(Months) DESC;
Plan
MAX(Months)
Silver
12
Gold
9
Basic
8
Explanation: GROUP BY Plan makes 3 groups (Basic, Gold, Silver); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Months) arranges the result in descending (largest first) order.
(iii)
SELECT MName, Trainer FROM MEMBER, PLAN WHERE MEMBER.Plan = PLAN.Plan;
MName
Trainer
Mohit
Vijay
Vikas
Vijay
Tanvi
Sana
Pallavi
Vijay
Divya
Sana
Aman
Rocky
Explanation: The two tables MEMBER and PLAN are joined: only the row pairs where MEMBER.Plan = PLAN.Plan are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT MName, Months, Hours FROM MEMBER, PLAN WHERE MEMBER.Plan = PLAN.Plan AND Months > 6;
MName
Months
Hours
Vikas
9
3
Tanvi
12
2
Aman
8
1
Explanation: The two tables MEMBER and PLAN are joined: only the row pairs where MEMBER.Plan = PLAN.Plan are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Months is more than 6.
D2.12Practice4 marks
Consider the tables MEMBER and PLAN given below. Write the output of the following queries.
Table: MEMBER
MNo
MName
Plan
Months
Fee
JoinDate
1
Mohit
Gold
3
2755.29
2026-07-09
2
Vikas
Gold
9
1680.76
2025-04-25
3
Tanvi
Silver
12
2149.51
2025-01-03
4
Pallavi
Gold
4
1398.78
2026-05-02
5
Divya
Silver
6
2568.09
2025-06-13
6
Aman
Basic
8
2546.01
2026-06-19
Table: PLAN
Plan
Trainer
Hours
Gold
Vijay
3
Silver
Sana
2
Basic
Rocky
1
(i) SELECT Plan, SUM(Months) FROM MEMBER GROUP BY Plan HAVING SUM(Months) > 15;
(ii) SELECT Plan, COUNT(*) FROM MEMBER GROUP BY Plan;
(iii) SELECT MName, Months, Hours FROM MEMBER, PLAN WHERE MEMBER.Plan = PLAN.Plan AND Months > 6;
(iv) SELECT MName, Trainer FROM MEMBER, PLAN WHERE MEMBER.Plan = PLAN.Plan AND Trainer = 'Vijay';
Answer
(i)
Plan
SUM(Months)
Gold
16
Silver
18
Explanation: GROUP BY Plan makes 3 groups (Basic, Gold, Silver); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Months) is more than 15. SUM adds the values.
(ii)
Plan
COUNT(*)
Basic
1
Gold
3
Silver
2
Explanation: GROUP BY Plan makes 3 groups (Basic, Gold, Silver); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
MName
Months
Hours
Vikas
9
3
Tanvi
12
2
Aman
8
1
Explanation: The two tables MEMBER and PLAN are joined: only the row pairs where MEMBER.Plan = PLAN.Plan are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Months is more than 6.
(iv)
MName
Trainer
Mohit
Vijay
Vikas
Vijay
Pallavi
Vijay
Explanation: The two tables MEMBER and PLAN are joined: only the row pairs where MEMBER.Plan = PLAN.Plan are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Trainer is 'Vijay'.
D2.13Practice4 marks
Consider the tables TICKET and ROUTE given below. Write SQL queries to display:
Each Dest and the number of rows in it
Each Dest and its total Seats, only for the groups whose total Seats is more than 7
The Passenger of each row with the Airline of its Dest, using both the tables
The Passenger, Seats and Hours of the rows where Seats is more than 3, using both the tables.
Table: TICKET
TNo
Passenger
Dest
Seats
Fare
TravelDate
301
Anita
Goa
3
9384.04
2026-01-28
302
Bhavna
Goa
3
6828.46
2026-03-11
303
Simran
Kochi
6
8802.73
2026-04-28
304
Aman
Kochi
4
6806.37
2026-10-14
305
Jatin
Goa
2
4173.89
2027-05-03
306
Sonal
Leh
5
9385.63
2026-12-18
Table: ROUTE
Dest
Airline
Hours
Goa
SkyJet
3
Leh
AirWing
2
Kochi
BlueSky
4
Answer
(i)
SELECT Dest, COUNT(*) FROM TICKET GROUP BY Dest;
Dest
COUNT(*)
Goa
3
Kochi
2
Leh
1
Explanation: GROUP BY Dest makes 3 groups (Goa, Kochi, Leh); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Dest, SUM(Seats) FROM TICKET GROUP BY Dest HAVING SUM(Seats) > 7;
Dest
SUM(Seats)
Goa
8
Kochi
10
Explanation: GROUP BY Dest makes 3 groups (Goa, Kochi, Leh); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Seats) is more than 7. SUM adds the values.
(iii)
SELECT Passenger, Airline FROM TICKET, ROUTE WHERE TICKET.Dest = ROUTE.Dest;
Passenger
Airline
Anita
SkyJet
Bhavna
SkyJet
Simran
BlueSky
Aman
BlueSky
Jatin
SkyJet
Sonal
AirWing
Explanation: The two tables TICKET and ROUTE are joined: only the row pairs where TICKET.Dest = ROUTE.Dest are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT Passenger, Seats, Hours FROM TICKET, ROUTE WHERE TICKET.Dest = ROUTE.Dest AND Seats > 3;
Passenger
Seats
Hours
Simran
6
4
Aman
4
4
Sonal
5
2
Explanation: The two tables TICKET and ROUTE are joined: only the row pairs where TICKET.Dest = ROUTE.Dest are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Seats is more than 3.
D2.14Practice4 marks
Consider the tables TICKET and ROUTE given below. Write the output of the following queries.
Table: TICKET
TNo
Passenger
Dest
Seats
Fare
TravelDate
301
Anita
Goa
3
9384.04
2026-01-28
302
Bhavna
Goa
3
6828.46
2026-03-11
303
Simran
Kochi
6
8802.73
2026-04-28
304
Aman
Kochi
4
6806.37
2026-10-14
305
Jatin
Goa
2
4173.89
2027-05-03
306
Sonal
Leh
5
9385.63
2026-12-18
Table: ROUTE
Dest
Airline
Hours
Goa
SkyJet
3
Leh
AirWing
2
Kochi
BlueSky
4
(i) SELECT Dest, COUNT(*) FROM TICKET GROUP BY Dest HAVING COUNT(*) > 1;
(ii) SELECT Dest, MAX(Seats) FROM TICKET GROUP BY Dest ORDER BY MAX(Seats) DESC;
(iii) SELECT Passenger, Seats, Hours FROM TICKET, ROUTE WHERE TICKET.Dest = ROUTE.Dest AND Seats > 3;
(iv) SELECT Passenger, Airline FROM TICKET, ROUTE WHERE TICKET.Dest = ROUTE.Dest AND Airline = 'SkyJet';
Answer
(i)
Dest
COUNT(*)
Goa
3
Kochi
2
Explanation: GROUP BY Dest makes 3 groups (Goa, Kochi, Leh); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Dest
MAX(Seats)
Kochi
6
Leh
5
Goa
3
Explanation: GROUP BY Dest makes 3 groups (Goa, Kochi, Leh); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Seats) arranges the result in descending (largest first) order.
(iii)
Passenger
Seats
Hours
Simran
6
4
Aman
4
4
Sonal
5
2
Explanation: The two tables TICKET and ROUTE are joined: only the row pairs where TICKET.Dest = ROUTE.Dest are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Seats is more than 3.
(iv)
Passenger
Airline
Anita
SkyJet
Bhavna
SkyJet
Jatin
SkyJet
Explanation: The two tables TICKET and ROUTE are joined: only the row pairs where TICKET.Dest = ROUTE.Dest are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Airline is 'SkyJet'.
D2.15Practice4 marks
Consider the tables MOVIE and GENRE given below. Write SQL queries to display:
The Genre that have more than one row
Each Genre with its highest Minutes, in descending order of the highest Minutes
The Title of each row with the Award of its Genre, using both the tables
The Title, Minutes and Shows of the rows where Minutes is more than 125, using both the tables.
Table: MOVIE
MNo
Title
Genre
Minutes
Rating
RelDate
1
Udaan
Comedy
170
8.54
2026-03-24
2
Safar
Comedy
145
7.52
2024-08-10
3
Dosti
Drama
125
6.87
2023-12-27
4
Rangoli
Comedy
130
5.11
2023-10-16
5
Khel
Action
105
6.83
2024-12-18
6
Sapna
Action
115
5.33
2024-12-07
Table: GENRE
Genre
Award
Shows
Comedy
Hasya
4
Drama
Kala
3
Action
Veer
5
Answer
(i)
SELECT Genre, COUNT(*) FROM MOVIE GROUP BY Genre HAVING COUNT(*) > 1;
Genre
COUNT(*)
Action
2
Comedy
3
Explanation: GROUP BY Genre makes 3 groups (Action, Comedy, Drama); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Genre, MAX(Minutes) FROM MOVIE GROUP BY Genre ORDER BY MAX(Minutes) DESC;
Genre
MAX(Minutes)
Comedy
170
Drama
125
Action
115
Explanation: GROUP BY Genre makes 3 groups (Action, Comedy, Drama); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Minutes) arranges the result in descending (largest first) order.
(iii)
SELECT Title, Award FROM MOVIE, GENRE WHERE MOVIE.Genre = GENRE.Genre;
Title
Award
Udaan
Hasya
Safar
Hasya
Dosti
Kala
Rangoli
Hasya
Khel
Veer
Sapna
Veer
Explanation: The two tables MOVIE and GENRE are joined: only the row pairs where MOVIE.Genre = GENRE.Genre are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT Title, Minutes, Shows FROM MOVIE, GENRE WHERE MOVIE.Genre = GENRE.Genre AND Minutes > 125;
Title
Minutes
Shows
Udaan
170
4
Safar
145
4
Rangoli
130
4
Explanation: The two tables MOVIE and GENRE are joined: only the row pairs where MOVIE.Genre = GENRE.Genre are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Minutes is more than 125.
D2.16Practice4 marks
Consider the tables MOVIE and GENRE given below. Write the output of the following queries.
Table: MOVIE
MNo
Title
Genre
Minutes
Rating
RelDate
1
Udaan
Comedy
170
8.54
2026-03-24
2
Safar
Comedy
145
7.52
2024-08-10
3
Dosti
Drama
125
6.87
2023-12-27
4
Rangoli
Comedy
130
5.11
2023-10-16
5
Khel
Action
105
6.83
2024-12-18
6
Sapna
Action
115
5.33
2024-12-07
Table: GENRE
Genre
Award
Shows
Comedy
Hasya
4
Drama
Kala
3
Action
Veer
5
(i) SELECT Genre, SUM(Minutes) FROM MOVIE GROUP BY Genre HAVING SUM(Minutes) > 220;
(ii) SELECT Genre, COUNT(*) FROM MOVIE GROUP BY Genre;
(iii) SELECT Title, Minutes, Shows FROM MOVIE, GENRE WHERE MOVIE.Genre = GENRE.Genre AND Minutes > 125;
(iv) SELECT Title, Award FROM MOVIE, GENRE WHERE MOVIE.Genre = GENRE.Genre AND Award = 'Hasya';
Answer
(i)
Genre
SUM(Minutes)
Comedy
445
Explanation: GROUP BY Genre makes 3 groups (Action, Comedy, Drama); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Minutes) is more than 220. SUM adds the values.
(ii)
Genre
COUNT(*)
Action
2
Comedy
3
Drama
1
Explanation: GROUP BY Genre makes 3 groups (Action, Comedy, Drama); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
Title
Minutes
Shows
Udaan
170
4
Safar
145
4
Rangoli
130
4
Explanation: The two tables MOVIE and GENRE are joined: only the row pairs where MOVIE.Genre = GENRE.Genre are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Minutes is more than 125.
(iv)
Title
Award
Udaan
Hasya
Safar
Hasya
Rangoli
Hasya
Explanation: The two tables MOVIE and GENRE are joined: only the row pairs where MOVIE.Genre = GENRE.Genre are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Award is 'Hasya'.
D2.17Practice4 marks
Consider the tables COURSE and MODE given below. Write SQL queries to display:
Each Mode and the number of rows in it
Each Mode and its total Weeks, only for the groups whose total Weeks is more than 25
The CName of each row with the Centre of its Mode, using both the tables
The CName, Weeks and Seats of the rows where Weeks is more than 8, using both the tables.
Table: COURSE
CNo
CName
Mode
Weeks
Fee
StartDate
21
Python
Online
6
8375.41
2026-06-06
22
Web Design
Offline
8
3020.13
2026-10-13
23
Tally
Online
10
4826.35
2027-03-23
24
Animation
Hybrid
22
8778.76
2026-11-11
25
Robotics
Hybrid
4
6911.58
2026-09-27
26
Data Entry
Online
24
9871.53
2027-11-05
Table: MODE
Mode
Centre
Seats
Online
Rohini
60
Offline
Dwarka
30
Hybrid
Saket
40
Answer
(i)
SELECT Mode, COUNT(*) FROM COURSE GROUP BY Mode;
Mode
COUNT(*)
Hybrid
2
Offline
1
Online
3
Explanation: GROUP BY Mode makes 3 groups (Hybrid, Offline, Online); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Mode, SUM(Weeks) FROM COURSE GROUP BY Mode HAVING SUM(Weeks) > 25;
Mode
SUM(Weeks)
Hybrid
26
Online
40
Explanation: GROUP BY Mode makes 3 groups (Hybrid, Offline, Online); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Weeks) is more than 25. SUM adds the values.
(iii)
SELECT CName, Centre FROM COURSE, MODE WHERE COURSE.Mode = MODE.Mode;
CName
Centre
Python
Rohini
Web Design
Dwarka
Tally
Rohini
Animation
Saket
Robotics
Saket
Data Entry
Rohini
Explanation: The two tables COURSE and MODE are joined: only the row pairs where COURSE.Mode = MODE.Mode are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT CName, Weeks, Seats FROM COURSE, MODE WHERE COURSE.Mode = MODE.Mode AND Weeks > 8;
CName
Weeks
Seats
Tally
10
60
Animation
22
40
Data Entry
24
60
Explanation: The two tables COURSE and MODE are joined: only the row pairs where COURSE.Mode = MODE.Mode are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Weeks is more than 8.
D2.18Practice4 marks
Consider the tables COURSE and MODE given below. Write the output of the following queries.
Table: COURSE
CNo
CName
Mode
Weeks
Fee
StartDate
21
Python
Online
6
8375.41
2026-06-06
22
Web Design
Offline
8
3020.13
2026-10-13
23
Tally
Online
10
4826.35
2027-03-23
24
Animation
Hybrid
22
8778.76
2026-11-11
25
Robotics
Hybrid
4
6911.58
2026-09-27
26
Data Entry
Online
24
9871.53
2027-11-05
Table: MODE
Mode
Centre
Seats
Online
Rohini
60
Offline
Dwarka
30
Hybrid
Saket
40
(i) SELECT Mode, COUNT(*) FROM COURSE GROUP BY Mode HAVING COUNT(*) > 1;
(ii) SELECT Mode, MAX(Weeks) FROM COURSE GROUP BY Mode ORDER BY MAX(Weeks) DESC;
(iii) SELECT CName, Weeks, Seats FROM COURSE, MODE WHERE COURSE.Mode = MODE.Mode AND Weeks > 8;
(iv) SELECT CName, Centre FROM COURSE, MODE WHERE COURSE.Mode = MODE.Mode AND Centre = 'Rohini';
Answer
(i)
Mode
COUNT(*)
Hybrid
2
Online
3
Explanation: GROUP BY Mode makes 3 groups (Hybrid, Offline, Online); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Mode
MAX(Weeks)
Online
24
Hybrid
22
Offline
8
Explanation: GROUP BY Mode makes 3 groups (Hybrid, Offline, Online); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Weeks) arranges the result in descending (largest first) order.
(iii)
CName
Weeks
Seats
Tally
10
60
Animation
22
40
Data Entry
24
60
Explanation: The two tables COURSE and MODE are joined: only the row pairs where COURSE.Mode = MODE.Mode are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Weeks is more than 8.
(iv)
CName
Centre
Python
Rohini
Tally
Rohini
Data Entry
Rohini
Explanation: The two tables COURSE and MODE are joined: only the row pairs where COURSE.Mode = MODE.Mode are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Centre is 'Rohini'.
D2.19Practice4 marks
Consider the tables VEHICLE and VTYPE given below. Write SQL queries to display:
The Type that have more than one row
Each Type with its highest Km, in descending order of the highest Km
The Owner of each row with the Licence of its Type, using both the tables
The Owner, Km and Parking of the rows where Km is more than 25500, using both the tables.
Table: VEHICLE
VNo
Owner
Type
Km
Tax
RegDate
701
Yash
Bike
14500
2852.03
2019-01-09
702
Shreya
Van
59000
2222.07
2023-01-21
703
Simran
Car
27500
2206.18
2018-07-13
704
Swati
Van
25500
1253.91
2020-12-12
705
Sandeep
Car
54000
2275.81
2025-01-14
706
Aman
Car
15500
1981.68
2018-12-01
Table: VTYPE
Type
Licence
Parking
Car
LMV
100
Bike
MCWG
30
Van
LMV-TR
150
Answer
(i)
SELECT Type, COUNT(*) FROM VEHICLE GROUP BY Type HAVING COUNT(*) > 1;
Type
COUNT(*)
Car
3
Van
2
Explanation: GROUP BY Type makes 3 groups (Bike, Car, Van); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Type, MAX(Km) FROM VEHICLE GROUP BY Type ORDER BY MAX(Km) DESC;
Type
MAX(Km)
Van
59000
Car
54000
Bike
14500
Explanation: GROUP BY Type makes 3 groups (Bike, Car, Van); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Km) arranges the result in descending (largest first) order.
(iii)
SELECT Owner, Licence FROM VEHICLE, VTYPE WHERE VEHICLE.Type = VTYPE.Type;
Owner
Licence
Yash
MCWG
Shreya
LMV-TR
Simran
LMV
Swati
LMV-TR
Sandeep
LMV
Aman
LMV
Explanation: The two tables VEHICLE and VTYPE are joined: only the row pairs where VEHICLE.Type = VTYPE.Type are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT Owner, Km, Parking FROM VEHICLE, VTYPE WHERE VEHICLE.Type = VTYPE.Type AND Km > 25500;
Owner
Km
Parking
Shreya
59000
150
Simran
27500
100
Sandeep
54000
100
Explanation: The two tables VEHICLE and VTYPE are joined: only the row pairs where VEHICLE.Type = VTYPE.Type are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Km is more than 25500.
D2.20Practice4 marks
Consider the tables VEHICLE and VTYPE given below. Write the output of the following queries.
Table: VEHICLE
VNo
Owner
Type
Km
Tax
RegDate
701
Yash
Bike
14500
2852.03
2019-01-09
702
Shreya
Van
59000
2222.07
2023-01-21
703
Simran
Car
27500
2206.18
2018-07-13
704
Swati
Van
25500
1253.91
2020-12-12
705
Sandeep
Car
54000
2275.81
2025-01-14
706
Aman
Car
15500
1981.68
2018-12-01
Table: VTYPE
Type
Licence
Parking
Car
LMV
100
Bike
MCWG
30
Van
LMV-TR
150
(i) SELECT Type, SUM(Km) FROM VEHICLE GROUP BY Type HAVING SUM(Km) > 84500;
(ii) SELECT Type, COUNT(*) FROM VEHICLE GROUP BY Type;
(iii) SELECT Owner, Km, Parking FROM VEHICLE, VTYPE WHERE VEHICLE.Type = VTYPE.Type AND Km > 25500;
(iv) SELECT Owner, Licence FROM VEHICLE, VTYPE WHERE VEHICLE.Type = VTYPE.Type AND Licence = 'LMV';
Answer
(i)
Type
SUM(Km)
Car
97000
Explanation: GROUP BY Type makes 3 groups (Bike, Car, Van); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Km) is more than 84500. SUM adds the values.
(ii)
Type
COUNT(*)
Bike
1
Car
3
Van
2
Explanation: GROUP BY Type makes 3 groups (Bike, Car, Van); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
Owner
Km
Parking
Shreya
59000
150
Simran
27500
100
Sandeep
54000
100
Explanation: The two tables VEHICLE and VTYPE are joined: only the row pairs where VEHICLE.Type = VTYPE.Type are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Km is more than 25500.
(iv)
Owner
Licence
Simran
LMV
Sandeep
LMV
Aman
LMV
Explanation: The two tables VEHICLE and VTYPE are joined: only the row pairs where VEHICLE.Type = VTYPE.Type are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Licence is 'LMV'.
D2.21Practice4 marks
Consider the tables ORDERS and CITY given below. Write SQL queries to display:
Each City and the number of rows in it
Each City and its total Qty, only for the groups whose total Qty is more than 20
The Customer of each row with the State of its City, using both the tables
The Customer, Qty and Stores of the rows where Qty is more than 6, using both the tables.
Table: ORDERS
ONo
Customer
City
Qty
Amount
ODate
9001
Harish
Delhi
5
6729.59
2026-06-22
9002
Pallavi
Agra
3
7662.03
2026-10-28
9003
Yash
Pune
11
561.13
2026-11-22
9004
Arjun
Pune
12
4746.24
2026-04-01
9005
Nikhil
Delhi
13
3876.23
2026-04-20
9006
Farhan
Delhi
6
6568.18
2026-03-14
Table: CITY
City
State
Stores
Delhi
Delhi
5
Pune
Maharashtra
3
Agra
Uttar Pradesh
2
Answer
(i)
SELECT City, COUNT(*) FROM ORDERS GROUP BY City;
City
COUNT(*)
Agra
1
Delhi
3
Pune
2
Explanation: GROUP BY City makes 3 groups (Agra, Delhi, Pune); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT City, SUM(Qty) FROM ORDERS GROUP BY City HAVING SUM(Qty) > 20;
City
SUM(Qty)
Delhi
24
Pune
23
Explanation: GROUP BY City makes 3 groups (Agra, Delhi, Pune); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Qty) is more than 20. SUM adds the values.
(iii)
SELECT Customer, State FROM ORDERS, CITY WHERE ORDERS.City = CITY.City;
Customer
State
Harish
Delhi
Pallavi
Uttar Pradesh
Yash
Maharashtra
Arjun
Maharashtra
Nikhil
Delhi
Farhan
Delhi
Explanation: The two tables ORDERS and CITY are joined: only the row pairs where ORDERS.City = CITY.City are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT Customer, Qty, Stores FROM ORDERS, CITY WHERE ORDERS.City = CITY.City AND Qty > 6;
Customer
Qty
Stores
Yash
11
3
Arjun
12
3
Nikhil
13
5
Explanation: The two tables ORDERS and CITY are joined: only the row pairs where ORDERS.City = CITY.City are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Qty is more than 6.
D2.22Practice4 marks
Consider the tables ORDERS and CITY given below. Write the output of the following queries.
Table: ORDERS
ONo
Customer
City
Qty
Amount
ODate
9001
Harish
Delhi
5
6729.59
2026-06-22
9002
Pallavi
Agra
3
7662.03
2026-10-28
9003
Yash
Pune
11
561.13
2026-11-22
9004
Arjun
Pune
12
4746.24
2026-04-01
9005
Nikhil
Delhi
13
3876.23
2026-04-20
9006
Farhan
Delhi
6
6568.18
2026-03-14
Table: CITY
City
State
Stores
Delhi
Delhi
5
Pune
Maharashtra
3
Agra
Uttar Pradesh
2
(i) SELECT City, COUNT(*) FROM ORDERS GROUP BY City HAVING COUNT(*) > 1;
(ii) SELECT City, MAX(Qty) FROM ORDERS GROUP BY City ORDER BY MAX(Qty) DESC;
(iii) SELECT Customer, Qty, Stores FROM ORDERS, CITY WHERE ORDERS.City = CITY.City AND Qty > 6;
(iv) SELECT Customer, State FROM ORDERS, CITY WHERE ORDERS.City = CITY.City AND State = 'Delhi';
Answer
(i)
City
COUNT(*)
Delhi
3
Pune
2
Explanation: GROUP BY City makes 3 groups (Agra, Delhi, Pune); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
City
MAX(Qty)
Delhi
13
Pune
12
Agra
3
Explanation: GROUP BY City makes 3 groups (Agra, Delhi, Pune); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Qty) arranges the result in descending (largest first) order.
(iii)
Customer
Qty
Stores
Yash
11
3
Arjun
12
3
Nikhil
13
5
Explanation: The two tables ORDERS and CITY are joined: only the row pairs where ORDERS.City = CITY.City are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Qty is more than 6.
(iv)
Customer
State
Harish
Delhi
Nikhil
Delhi
Farhan
Delhi
Explanation: The two tables ORDERS and CITY are joined: only the row pairs where ORDERS.City = CITY.City are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: State is 'Delhi'.
D2.23Practice4 marks
Consider the tables DOCTOR and SPEC given below. Write SQL queries to display:
The Spec that have more than one row
Each Spec with its highest Exp, in descending order of the highest Exp
The DName of each row with the Room of its Spec, using both the tables
The DName, Exp and Nurses of the rows where Exp is more than 6, using both the tables.
Table: DOCTOR
DNo
DName
Spec
Exp
Fee
DOJ
1
Anita
Dental
5
436.84
2022-09-22
2
Ojasvi
Skin
23
1051.09
2012-07-22
3
Nikhil
Eye
2
1178.34
2021-05-22
4
Meenal
Skin
14
1100.17
2020-08-28
5
Naveen
Dental
12
1207.47
2014-01-06
6
Vikas
Skin
6
435.16
2017-06-04
Table: SPEC
Spec
Room
Nurses
Skin
R1
2
Eye
R2
3
Dental
R3
4
Answer
(i)
SELECT Spec, COUNT(*) FROM DOCTOR GROUP BY Spec HAVING COUNT(*) > 1;
Spec
COUNT(*)
Dental
2
Skin
3
Explanation: GROUP BY Spec makes 3 groups (Dental, Eye, Skin); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Spec, MAX(Exp) FROM DOCTOR GROUP BY Spec ORDER BY MAX(Exp) DESC;
Spec
MAX(Exp)
Skin
23
Dental
12
Eye
2
Explanation: GROUP BY Spec makes 3 groups (Dental, Eye, Skin); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Exp) arranges the result in descending (largest first) order.
(iii)
SELECT DName, Room FROM DOCTOR, SPEC WHERE DOCTOR.Spec = SPEC.Spec;
DName
Room
Anita
R3
Ojasvi
R1
Nikhil
R2
Meenal
R1
Naveen
R3
Vikas
R1
Explanation: The two tables DOCTOR and SPEC are joined: only the row pairs where DOCTOR.Spec = SPEC.Spec are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT DName, Exp, Nurses FROM DOCTOR, SPEC WHERE DOCTOR.Spec = SPEC.Spec AND Exp > 6;
DName
Exp
Nurses
Ojasvi
23
2
Meenal
14
2
Naveen
12
4
Explanation: The two tables DOCTOR and SPEC are joined: only the row pairs where DOCTOR.Spec = SPEC.Spec are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Exp is more than 6.
D2.24Practice4 marks
Consider the tables DOCTOR and SPEC given below. Write the output of the following queries.
Table: DOCTOR
DNo
DName
Spec
Exp
Fee
DOJ
1
Anita
Dental
5
436.84
2022-09-22
2
Ojasvi
Skin
23
1051.09
2012-07-22
3
Nikhil
Eye
2
1178.34
2021-05-22
4
Meenal
Skin
14
1100.17
2020-08-28
5
Naveen
Dental
12
1207.47
2014-01-06
6
Vikas
Skin
6
435.16
2017-06-04
Table: SPEC
Spec
Room
Nurses
Skin
R1
2
Eye
R2
3
Dental
R3
4
(i) SELECT Spec, SUM(Exp) FROM DOCTOR GROUP BY Spec HAVING SUM(Exp) > 15;
(ii) SELECT Spec, COUNT(*) FROM DOCTOR GROUP BY Spec;
(iii) SELECT DName, Exp, Nurses FROM DOCTOR, SPEC WHERE DOCTOR.Spec = SPEC.Spec AND Exp > 6;
(iv) SELECT DName, Room FROM DOCTOR, SPEC WHERE DOCTOR.Spec = SPEC.Spec AND Room = 'R1';
Answer
(i)
Spec
SUM(Exp)
Dental
17
Skin
43
Explanation: GROUP BY Spec makes 3 groups (Dental, Eye, Skin); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Exp) is more than 15. SUM adds the values.
(ii)
Spec
COUNT(*)
Dental
2
Eye
1
Skin
3
Explanation: GROUP BY Spec makes 3 groups (Dental, Eye, Skin); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
DName
Exp
Nurses
Ojasvi
23
2
Meenal
14
2
Naveen
12
4
Explanation: The two tables DOCTOR and SPEC are joined: only the row pairs where DOCTOR.Spec = SPEC.Spec are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Exp is more than 6.
(iv)
DName
Room
Ojasvi
R1
Meenal
R1
Vikas
R1
Explanation: The two tables DOCTOR and SPEC are joined: only the row pairs where DOCTOR.Spec = SPEC.Spec are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Room is 'R1'.
D2.25Practice4 marks
Consider the tables PLAYER and GAME given below. Write SQL queries to display:
Each Game and the number of rows in it
Each Game and its total Matches, only for the groups whose total Matches is more than 60
The PName of each row with the Coach of its Game, using both the tables
The PName, Matches and Fees of the rows where Matches is more than 35, using both the tables.
Table: PLAYER
PNo
PName
Game
Matches
Average
DOB
1
Nisha
Cricket
35
39.93
2007-12-23
2
Rachna
Chess
44
48.49
2009-10-21
3
Meenal
Cricket
19
62.94
2010-04-10
4
Nikhil
Cricket
51
40.51
2006-12-17
5
Harish
Hockey
24
31.15
2010-08-13
6
Zeenat
Hockey
36
29.33
2009-07-23
Table: GAME
Game
Coach
Fees
Cricket
Mr. Dev
1500
Hockey
Ms. Roy
1000
Chess
Mr. Paul
800
Answer
(i)
SELECT Game, COUNT(*) FROM PLAYER GROUP BY Game;
Game
COUNT(*)
Chess
1
Cricket
3
Hockey
2
Explanation: GROUP BY Game makes 3 groups (Chess, Cricket, Hockey); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Game, SUM(Matches) FROM PLAYER GROUP BY Game HAVING SUM(Matches) > 60;
Game
SUM(Matches)
Cricket
105
Explanation: GROUP BY Game makes 3 groups (Chess, Cricket, Hockey); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Matches) is more than 60. SUM adds the values.
(iii)
SELECT PName, Coach FROM PLAYER, GAME WHERE PLAYER.Game = GAME.Game;
PName
Coach
Nisha
Mr. Dev
Rachna
Mr. Paul
Meenal
Mr. Dev
Nikhil
Mr. Dev
Harish
Ms. Roy
Zeenat
Ms. Roy
Explanation: The two tables PLAYER and GAME are joined: only the row pairs where PLAYER.Game = GAME.Game are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT PName, Matches, Fees FROM PLAYER, GAME WHERE PLAYER.Game = GAME.Game AND Matches > 35;
PName
Matches
Fees
Rachna
44
800
Nikhil
51
1500
Zeenat
36
1000
Explanation: The two tables PLAYER and GAME are joined: only the row pairs where PLAYER.Game = GAME.Game are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Matches is more than 35.
D2.26Practice4 marks
Consider the tables PLAYER and GAME given below. Write the output of the following queries.
Table: PLAYER
PNo
PName
Game
Matches
Average
DOB
1
Nisha
Cricket
35
39.93
2007-12-23
2
Rachna
Chess
44
48.49
2009-10-21
3
Meenal
Cricket
19
62.94
2010-04-10
4
Nikhil
Cricket
51
40.51
2006-12-17
5
Harish
Hockey
24
31.15
2010-08-13
6
Zeenat
Hockey
36
29.33
2009-07-23
Table: GAME
Game
Coach
Fees
Cricket
Mr. Dev
1500
Hockey
Ms. Roy
1000
Chess
Mr. Paul
800
(i) SELECT Game, COUNT(*) FROM PLAYER GROUP BY Game HAVING COUNT(*) > 1;
(ii) SELECT Game, MAX(Matches) FROM PLAYER GROUP BY Game ORDER BY MAX(Matches) DESC;
(iii) SELECT PName, Matches, Fees FROM PLAYER, GAME WHERE PLAYER.Game = GAME.Game AND Matches > 35;
(iv) SELECT PName, Coach FROM PLAYER, GAME WHERE PLAYER.Game = GAME.Game AND Coach = 'Mr. Dev';
Answer
(i)
Game
COUNT(*)
Cricket
3
Hockey
2
Explanation: GROUP BY Game makes 3 groups (Chess, Cricket, Hockey); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Game
MAX(Matches)
Cricket
51
Chess
44
Hockey
36
Explanation: GROUP BY Game makes 3 groups (Chess, Cricket, Hockey); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Matches) arranges the result in descending (largest first) order.
(iii)
PName
Matches
Fees
Rachna
44
800
Nikhil
51
1500
Zeenat
36
1000
Explanation: The two tables PLAYER and GAME are joined: only the row pairs where PLAYER.Game = GAME.Game are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Matches is more than 35.
(iv)
PName
Coach
Nisha
Mr. Dev
Meenal
Mr. Dev
Nikhil
Mr. Dev
Explanation: The two tables PLAYER and GAME are joined: only the row pairs where PLAYER.Game = GAME.Game are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Coach is 'Mr. Dev'.
D2.27Practice4 marks
Consider the tables HOSTEL and BLOCK given below. Write SQL queries to display:
The Block that have more than one row
Each Block with its highest Room, in descending order of the highest Room
The SName of each row with the Warden of its Block, using both the tables
The SName, Room and Rooms of the rows where Room is more than 134, using both the tables.
Table: HOSTEL
HNo
SName
Block
Room
Mess
DOA
1
Chetan
Yamuna
164
3027.92
2026-06-19
2
Rohan
Ganga
134
2314.26
2026-12-15
3
Swati
Kaveri
279
2306.82
2025-09-22
4
Harish
Ganga
250
1867.61
2025-10-10
5
Naveen
Yamuna
111
2282.33
2025-06-13
6
Aman
Ganga
101
2423.74
2026-07-10
Table: BLOCK
Block
Warden
Rooms
Ganga
Mr. Jha
40
Yamuna
Ms. Das
35
Kaveri
Mr. Pal
50
Answer
(i)
SELECT Block, COUNT(*) FROM HOSTEL GROUP BY Block HAVING COUNT(*) > 1;
Block
COUNT(*)
Ganga
3
Yamuna
2
Explanation: GROUP BY Block makes 3 groups (Ganga, Kaveri, Yamuna); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Block, MAX(Room) FROM HOSTEL GROUP BY Block ORDER BY MAX(Room) DESC;
Block
MAX(Room)
Kaveri
279
Ganga
250
Yamuna
164
Explanation: GROUP BY Block makes 3 groups (Ganga, Kaveri, Yamuna); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Room) arranges the result in descending (largest first) order.
(iii)
SELECT SName, Warden FROM HOSTEL, BLOCK WHERE HOSTEL.Block = BLOCK.Block;
SName
Warden
Chetan
Ms. Das
Rohan
Mr. Jha
Swati
Mr. Pal
Harish
Mr. Jha
Naveen
Ms. Das
Aman
Mr. Jha
Explanation: The two tables HOSTEL and BLOCK are joined: only the row pairs where HOSTEL.Block = BLOCK.Block are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT SName, Room, Rooms FROM HOSTEL, BLOCK WHERE HOSTEL.Block = BLOCK.Block AND Room > 134;
SName
Room
Rooms
Chetan
164
35
Swati
279
50
Harish
250
40
Explanation: The two tables HOSTEL and BLOCK are joined: only the row pairs where HOSTEL.Block = BLOCK.Block are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Room is more than 134.
D2.28Practice4 marks
Consider the tables HOSTEL and BLOCK given below. Write the output of the following queries.
Table: HOSTEL
HNo
SName
Block
Room
Mess
DOA
1
Chetan
Yamuna
164
3027.92
2026-06-19
2
Rohan
Ganga
134
2314.26
2026-12-15
3
Swati
Kaveri
279
2306.82
2025-09-22
4
Harish
Ganga
250
1867.61
2025-10-10
5
Naveen
Yamuna
111
2282.33
2025-06-13
6
Aman
Ganga
101
2423.74
2026-07-10
Table: BLOCK
Block
Warden
Rooms
Ganga
Mr. Jha
40
Yamuna
Ms. Das
35
Kaveri
Mr. Pal
50
(i) SELECT Block, SUM(Room) FROM HOSTEL GROUP BY Block HAVING SUM(Room) > 275;
(ii) SELECT Block, COUNT(*) FROM HOSTEL GROUP BY Block;
(iii) SELECT SName, Room, Rooms FROM HOSTEL, BLOCK WHERE HOSTEL.Block = BLOCK.Block AND Room > 134;
(iv) SELECT SName, Warden FROM HOSTEL, BLOCK WHERE HOSTEL.Block = BLOCK.Block AND Warden = 'Mr. Jha';
Answer
(i)
Block
SUM(Room)
Ganga
485
Kaveri
279
Explanation: GROUP BY Block makes 3 groups (Ganga, Kaveri, Yamuna); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Room) is more than 275. SUM adds the values.
(ii)
Block
COUNT(*)
Ganga
3
Kaveri
1
Yamuna
2
Explanation: GROUP BY Block makes 3 groups (Ganga, Kaveri, Yamuna); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
SName
Room
Rooms
Chetan
164
35
Swati
279
50
Harish
250
40
Explanation: The two tables HOSTEL and BLOCK are joined: only the row pairs where HOSTEL.Block = BLOCK.Block are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Room is more than 134.
(iv)
SName
Warden
Rohan
Mr. Jha
Harish
Mr. Jha
Aman
Mr. Jha
Explanation: The two tables HOSTEL and BLOCK are joined: only the row pairs where HOSTEL.Block = BLOCK.Block are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Warden is 'Mr. Jha'.
D2.29Practice4 marks
Consider the tables LOAN and LOANTYPE given below. Write SQL queries to display:
Each Type and the number of rows in it
Each Type and its total Years, only for the groups whose total Years is more than 15
The CName of each row with the Officer of its Type, using both the tables
The CName, Years and MaxYears of the rows where Years is more than 10, using both the tables.
Table: LOAN
LNo
CName
Type
Years
Rate
StartDate
1
Divya
Education
19
11.17
2020-11-18
2
Sachin
Home
3
9.02
2022-04-01
3
Naveen
Car
12
9.46
2023-07-07
4
Sandeep
Car
2
9.92
2026-03-01
5
Umesh
Home
10
10.25
2021-02-05
6
Ritu
Home
17
8.62
2025-08-06
Table: LOANTYPE
Type
Officer
MaxYears
Home
Mr. Sethi
20
Car
Ms. Vohra
7
Education
Mr. Lal
10
Answer
(i)
SELECT Type, COUNT(*) FROM LOAN GROUP BY Type;
Type
COUNT(*)
Car
2
Education
1
Home
3
Explanation: GROUP BY Type makes 3 groups (Car, Education, Home); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Type, SUM(Years) FROM LOAN GROUP BY Type HAVING SUM(Years) > 15;
Type
SUM(Years)
Education
19
Home
30
Explanation: GROUP BY Type makes 3 groups (Car, Education, Home); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Years) is more than 15. SUM adds the values.
(iii)
SELECT CName, Officer FROM LOAN, LOANTYPE WHERE LOAN.Type = LOANTYPE.Type;
CName
Officer
Divya
Mr. Lal
Sachin
Mr. Sethi
Naveen
Ms. Vohra
Sandeep
Ms. Vohra
Umesh
Mr. Sethi
Ritu
Mr. Sethi
Explanation: The two tables LOAN and LOANTYPE are joined: only the row pairs where LOAN.Type = LOANTYPE.Type are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT CName, Years, MaxYears FROM LOAN, LOANTYPE WHERE LOAN.Type = LOANTYPE.Type AND Years > 10;
CName
Years
MaxYears
Divya
19
10
Naveen
12
7
Ritu
17
20
Explanation: The two tables LOAN and LOANTYPE are joined: only the row pairs where LOAN.Type = LOANTYPE.Type are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Years is more than 10.
D2.30Practice4 marks
Consider the tables LOAN and LOANTYPE given below. Write the output of the following queries.
Table: LOAN
LNo
CName
Type
Years
Rate
StartDate
1
Divya
Education
19
11.17
2020-11-18
2
Sachin
Home
3
9.02
2022-04-01
3
Naveen
Car
12
9.46
2023-07-07
4
Sandeep
Car
2
9.92
2026-03-01
5
Umesh
Home
10
10.25
2021-02-05
6
Ritu
Home
17
8.62
2025-08-06
Table: LOANTYPE
Type
Officer
MaxYears
Home
Mr. Sethi
20
Car
Ms. Vohra
7
Education
Mr. Lal
10
(i) SELECT Type, COUNT(*) FROM LOAN GROUP BY Type HAVING COUNT(*) > 1;
(ii) SELECT Type, MAX(Years) FROM LOAN GROUP BY Type ORDER BY MAX(Years) DESC;
(iii) SELECT CName, Years, MaxYears FROM LOAN, LOANTYPE WHERE LOAN.Type = LOANTYPE.Type AND Years > 10;
(iv) SELECT CName, Officer FROM LOAN, LOANTYPE WHERE LOAN.Type = LOANTYPE.Type AND Officer = 'Mr. Sethi';
Answer
(i)
Type
COUNT(*)
Car
2
Home
3
Explanation: GROUP BY Type makes 3 groups (Car, Education, Home); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Type
MAX(Years)
Education
19
Home
17
Car
12
Explanation: GROUP BY Type makes 3 groups (Car, Education, Home); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Years) arranges the result in descending (largest first) order.
(iii)
CName
Years
MaxYears
Divya
19
10
Naveen
12
7
Ritu
17
20
Explanation: The two tables LOAN and LOANTYPE are joined: only the row pairs where LOAN.Type = LOANTYPE.Type are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Years is more than 10.
(iv)
CName
Officer
Sachin
Mr. Sethi
Umesh
Mr. Sethi
Ritu
Mr. Sethi
Explanation: The two tables LOAN and LOANTYPE are joined: only the row pairs where LOAN.Type = LOANTYPE.Type are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Officer is 'Mr. Sethi'.
D2.31Practice4 marks
Consider the tables STAFF and POST given below. Write SQL queries to display:
The Post that have more than one row
Each Post with its highest Periods, in descending order of the highest Periods
The SName of each row with the PayLevel of its Post, using both the tables
The SName, Periods and Vacancy of the rows where Periods is more than 25, using both the tables.
Table: STAFF
SNo
SName
Post
Periods
Allowance
DOJ
1
Rachna
TGT
21
6326.05
2023-07-03
2
Meenal
PGT
31
5316.67
2023-02-03
3
Sandeep
PGT
18
3601.57
2015-03-06
4
Yash
PGT
25
6358.03
2011-05-26
5
Ritu
PRT
30
5793.03
2022-08-12
6
Farhan
TGT
33
5942.38
2014-11-17
Table: POST
Post
PayLevel
Vacancy
PGT
L8
2
TGT
L7
4
PRT
L6
3
Answer
(i)
SELECT Post, COUNT(*) FROM STAFF GROUP BY Post HAVING COUNT(*) > 1;
Post
COUNT(*)
PGT
3
TGT
2
Explanation: GROUP BY Post makes 3 groups (PGT, PRT, TGT); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Post, MAX(Periods) FROM STAFF GROUP BY Post ORDER BY MAX(Periods) DESC;
Post
MAX(Periods)
TGT
33
PGT
31
PRT
30
Explanation: GROUP BY Post makes 3 groups (PGT, PRT, TGT); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Periods) arranges the result in descending (largest first) order.
(iii)
SELECT SName, PayLevel FROM STAFF, POST WHERE STAFF.Post = POST.Post;
SName
PayLevel
Rachna
L7
Meenal
L8
Sandeep
L8
Yash
L8
Ritu
L6
Farhan
L7
Explanation: The two tables STAFF and POST are joined: only the row pairs where STAFF.Post = POST.Post are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT SName, Periods, Vacancy FROM STAFF, POST WHERE STAFF.Post = POST.Post AND Periods > 25;
SName
Periods
Vacancy
Meenal
31
2
Ritu
30
3
Farhan
33
4
Explanation: The two tables STAFF and POST are joined: only the row pairs where STAFF.Post = POST.Post are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Periods is more than 25.
D2.32Practice4 marks
Consider the tables STAFF and POST given below. Write the output of the following queries.
Table: STAFF
SNo
SName
Post
Periods
Allowance
DOJ
1
Rachna
TGT
21
6326.05
2023-07-03
2
Meenal
PGT
31
5316.67
2023-02-03
3
Sandeep
PGT
18
3601.57
2015-03-06
4
Yash
PGT
25
6358.03
2011-05-26
5
Ritu
PRT
30
5793.03
2022-08-12
6
Farhan
TGT
33
5942.38
2014-11-17
Table: POST
Post
PayLevel
Vacancy
PGT
L8
2
TGT
L7
4
PRT
L6
3
(i) SELECT Post, SUM(Periods) FROM STAFF GROUP BY Post HAVING SUM(Periods) > 50;
(ii) SELECT Post, COUNT(*) FROM STAFF GROUP BY Post;
(iii) SELECT SName, Periods, Vacancy FROM STAFF, POST WHERE STAFF.Post = POST.Post AND Periods > 25;
(iv) SELECT SName, PayLevel FROM STAFF, POST WHERE STAFF.Post = POST.Post AND PayLevel = 'L8';
Answer
(i)
Post
SUM(Periods)
PGT
74
TGT
54
Explanation: GROUP BY Post makes 3 groups (PGT, PRT, TGT); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Periods) is more than 50. SUM adds the values.
(ii)
Post
COUNT(*)
PGT
3
PRT
1
TGT
2
Explanation: GROUP BY Post makes 3 groups (PGT, PRT, TGT); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
SName
Periods
Vacancy
Meenal
31
2
Ritu
30
3
Farhan
33
4
Explanation: The two tables STAFF and POST are joined: only the row pairs where STAFF.Post = POST.Post are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Periods is more than 25.
(iv)
SName
PayLevel
Meenal
L8
Sandeep
L8
Yash
L8
Explanation: The two tables STAFF and POST are joined: only the row pairs where STAFF.Post = POST.Post are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: PayLevel is 'L8'.
D2.33Practice4 marks
Consider the tables GARMENT and FABRIC given below. Write SQL queries to display:
Each Fabric and the number of rows in it
Each Fabric and its total Stock, only for the groups whose total Stock is more than 40
The GName of each row with the Mill of its Fabric, using both the tables
The GName, Stock and Rate of the rows where Stock is more than 15, using both the tables.
Table: GARMENT
GCode
GName
Fabric
Stock
Price
Launch
10
Shirt
Cotton
15
1434.77
2025-06-21
11
Jeans
Silk
25
3035.63
2025-11-15
12
Kurta
Denim
5
2149.33
2026-03-28
13
Jacket
Cotton
10
1170.28
2025-10-06
14
Saree
Denim
35
787.83
2025-11-07
15
Frock
Cotton
45
1436.34
2025-09-11
Table: FABRIC
Fabric
Mill
Rate
Cotton
Arvind
120
Denim
Raymond
250
Silk
Mysore
600
Answer
(i)
SELECT Fabric, COUNT(*) FROM GARMENT GROUP BY Fabric;
Fabric
COUNT(*)
Cotton
3
Denim
2
Silk
1
Explanation: GROUP BY Fabric makes 3 groups (Cotton, Denim, Silk); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Fabric, SUM(Stock) FROM GARMENT GROUP BY Fabric HAVING SUM(Stock) > 40;
Fabric
SUM(Stock)
Cotton
70
Explanation: GROUP BY Fabric makes 3 groups (Cotton, Denim, Silk); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Stock) is more than 40. SUM adds the values.
(iii)
SELECT GName, Mill FROM GARMENT, FABRIC WHERE GARMENT.Fabric = FABRIC.Fabric;
GName
Mill
Shirt
Arvind
Jeans
Mysore
Kurta
Raymond
Jacket
Arvind
Saree
Raymond
Frock
Arvind
Explanation: The two tables GARMENT and FABRIC are joined: only the row pairs where GARMENT.Fabric = FABRIC.Fabric are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT GName, Stock, Rate FROM GARMENT, FABRIC WHERE GARMENT.Fabric = FABRIC.Fabric AND Stock > 15;
GName
Stock
Rate
Jeans
25
600
Saree
35
250
Frock
45
120
Explanation: The two tables GARMENT and FABRIC are joined: only the row pairs where GARMENT.Fabric = FABRIC.Fabric are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Stock is more than 15.
D2.34Practice4 marks
Consider the tables GARMENT and FABRIC given below. Write the output of the following queries.
Table: GARMENT
GCode
GName
Fabric
Stock
Price
Launch
10
Shirt
Cotton
15
1434.77
2025-06-21
11
Jeans
Silk
25
3035.63
2025-11-15
12
Kurta
Denim
5
2149.33
2026-03-28
13
Jacket
Cotton
10
1170.28
2025-10-06
14
Saree
Denim
35
787.83
2025-11-07
15
Frock
Cotton
45
1436.34
2025-09-11
Table: FABRIC
Fabric
Mill
Rate
Cotton
Arvind
120
Denim
Raymond
250
Silk
Mysore
600
(i) SELECT Fabric, COUNT(*) FROM GARMENT GROUP BY Fabric HAVING COUNT(*) > 1;
(ii) SELECT Fabric, MAX(Stock) FROM GARMENT GROUP BY Fabric ORDER BY MAX(Stock) DESC;
(iii) SELECT GName, Stock, Rate FROM GARMENT, FABRIC WHERE GARMENT.Fabric = FABRIC.Fabric AND Stock > 15;
(iv) SELECT GName, Mill FROM GARMENT, FABRIC WHERE GARMENT.Fabric = FABRIC.Fabric AND Mill = 'Arvind';
Answer
(i)
Fabric
COUNT(*)
Cotton
3
Denim
2
Explanation: GROUP BY Fabric makes 3 groups (Cotton, Denim, Silk); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Fabric
MAX(Stock)
Cotton
45
Denim
35
Silk
25
Explanation: GROUP BY Fabric makes 3 groups (Cotton, Denim, Silk); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Stock) arranges the result in descending (largest first) order.
(iii)
GName
Stock
Rate
Jeans
25
600
Saree
35
250
Frock
45
120
Explanation: The two tables GARMENT and FABRIC are joined: only the row pairs where GARMENT.Fabric = FABRIC.Fabric are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Stock is more than 15.
(iv)
GName
Mill
Shirt
Arvind
Jacket
Arvind
Frock
Arvind
Explanation: The two tables GARMENT and FABRIC are joined: only the row pairs where GARMENT.Fabric = FABRIC.Fabric are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Mill is 'Arvind'.
D2.35Practice4 marks
Consider the tables EVENT and HOUSE given below. Write SQL queries to display:
The House that have more than one row
Each House with its highest Points, in descending order of the highest Points
The EName of each row with the Captain of its House, using both the tables
The EName, Points and Members of the rows where Points is more than 60, using both the tables.
Table: EVENT
ENo
EName
House
Points
Prize
EDate
1
Debate
Shivaji
30
2874.63
2026-07-02
2
Quiz
Raman
100
2924.74
2026-07-15
3
Dance
Shivaji
60
2767.11
2026-02-14
4
Drama
Raman
55
2300.04
2026-12-19
5
Painting
Shivaji
95
4017.09
2026-08-25
6
Singing
Tagore
75
1901.59
2026-10-04
Table: HOUSE
House
Captain
Members
Shivaji
Rhea
120
Tagore
Kabir
115
Raman
Mitali
125
Answer
(i)
SELECT House, COUNT(*) FROM EVENT GROUP BY House HAVING COUNT(*) > 1;
House
COUNT(*)
Raman
2
Shivaji
3
Explanation: GROUP BY House makes 3 groups (Raman, Shivaji, Tagore); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT House, MAX(Points) FROM EVENT GROUP BY House ORDER BY MAX(Points) DESC;
House
MAX(Points)
Raman
100
Shivaji
95
Tagore
75
Explanation: GROUP BY House makes 3 groups (Raman, Shivaji, Tagore); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Points) arranges the result in descending (largest first) order.
(iii)
SELECT EName, Captain FROM EVENT, HOUSE WHERE EVENT.House = HOUSE.House;
EName
Captain
Debate
Rhea
Quiz
Mitali
Dance
Rhea
Drama
Mitali
Painting
Rhea
Singing
Kabir
Explanation: The two tables EVENT and HOUSE are joined: only the row pairs where EVENT.House = HOUSE.House are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT EName, Points, Members FROM EVENT, HOUSE WHERE EVENT.House = HOUSE.House AND Points > 60;
EName
Points
Members
Quiz
100
125
Painting
95
120
Singing
75
115
Explanation: The two tables EVENT and HOUSE are joined: only the row pairs where EVENT.House = HOUSE.House are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Points is more than 60.
D2.36Practice4 marks
Consider the tables EVENT and HOUSE given below. Write the output of the following queries.
Table: EVENT
ENo
EName
House
Points
Prize
EDate
1
Debate
Shivaji
30
2874.63
2026-07-02
2
Quiz
Raman
100
2924.74
2026-07-15
3
Dance
Shivaji
60
2767.11
2026-02-14
4
Drama
Raman
55
2300.04
2026-12-19
5
Painting
Shivaji
95
4017.09
2026-08-25
6
Singing
Tagore
75
1901.59
2026-10-04
Table: HOUSE
House
Captain
Members
Shivaji
Rhea
120
Tagore
Kabir
115
Raman
Mitali
125
(i) SELECT House, SUM(Points) FROM EVENT GROUP BY House HAVING SUM(Points) > 155;
(ii) SELECT House, COUNT(*) FROM EVENT GROUP BY House;
(iii) SELECT EName, Points, Members FROM EVENT, HOUSE WHERE EVENT.House = HOUSE.House AND Points > 60;
(iv) SELECT EName, Captain FROM EVENT, HOUSE WHERE EVENT.House = HOUSE.House AND Captain = 'Rhea';
Answer
(i)
House
SUM(Points)
Shivaji
185
Explanation: GROUP BY House makes 3 groups (Raman, Shivaji, Tagore); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Points) is more than 155. SUM adds the values.
(ii)
House
COUNT(*)
Raman
2
Shivaji
3
Tagore
1
Explanation: GROUP BY House makes 3 groups (Raman, Shivaji, Tagore); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
EName
Points
Members
Quiz
100
125
Painting
95
120
Singing
75
115
Explanation: The two tables EVENT and HOUSE are joined: only the row pairs where EVENT.House = HOUSE.House are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Points is more than 60.
(iv)
EName
Captain
Debate
Rhea
Dance
Rhea
Painting
Rhea
Explanation: The two tables EVENT and HOUSE are joined: only the row pairs where EVENT.House = HOUSE.House are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Captain is 'Rhea'.
D2.37Practice4 marks
Consider the tables TRAIN and ZONE given below. Write SQL queries to display:
Each Zone and the number of rows in it
Each Zone and its total Coaches, only for the groups whose total Coaches is more than 30
The TName of each row with the HQ of its Zone, using both the tables
The TName, Coaches and Divisions of the rows where Coaches is more than 17, using both the tables.
Table: TRAIN
TNo
TName
Zone
Coaches
Fare
StartDate
12001
Rajdhani
Northern
17
2750.73
2017-02-22
12002
Shatabdi
Southern
24
2125.09
2024-03-03
12003
Duronto
Northern
13
2277.83
2024-03-16
12004
Garib Rath
Southern
10
3012.73
2021-04-10
12005
Tejas
Western
18
2091.89
2015-02-17
12006
Vande Bharat
Northern
20
1399.69
2020-04-10
Table: ZONE
Zone
HQ
Divisions
Northern
New Delhi
5
Western
Mumbai
6
Southern
Chennai
6
Answer
(i)
SELECT Zone, COUNT(*) FROM TRAIN GROUP BY Zone;
Zone
COUNT(*)
Northern
3
Southern
2
Western
1
Explanation: GROUP BY Zone makes 3 groups (Northern, Southern, Western); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Zone, SUM(Coaches) FROM TRAIN GROUP BY Zone HAVING SUM(Coaches) > 30;
Zone
SUM(Coaches)
Northern
50
Southern
34
Explanation: GROUP BY Zone makes 3 groups (Northern, Southern, Western); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Coaches) is more than 30. SUM adds the values.
(iii)
SELECT TName, HQ FROM TRAIN, ZONE WHERE TRAIN.Zone = ZONE.Zone;
TName
HQ
Rajdhani
New Delhi
Shatabdi
Chennai
Duronto
New Delhi
Garib Rath
Chennai
Tejas
Mumbai
Vande Bharat
New Delhi
Explanation: The two tables TRAIN and ZONE are joined: only the row pairs where TRAIN.Zone = ZONE.Zone are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT TName, Coaches, Divisions FROM TRAIN, ZONE WHERE TRAIN.Zone = ZONE.Zone AND Coaches > 17;
TName
Coaches
Divisions
Shatabdi
24
6
Tejas
18
6
Vande Bharat
20
5
Explanation: The two tables TRAIN and ZONE are joined: only the row pairs where TRAIN.Zone = ZONE.Zone are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Coaches is more than 17.
D2.38Practice4 marks
Consider the tables TRAIN and ZONE given below. Write the output of the following queries.
Table: TRAIN
TNo
TName
Zone
Coaches
Fare
StartDate
12001
Rajdhani
Northern
17
2750.73
2017-02-22
12002
Shatabdi
Southern
24
2125.09
2024-03-03
12003
Duronto
Northern
13
2277.83
2024-03-16
12004
Garib Rath
Southern
10
3012.73
2021-04-10
12005
Tejas
Western
18
2091.89
2015-02-17
12006
Vande Bharat
Northern
20
1399.69
2020-04-10
Table: ZONE
Zone
HQ
Divisions
Northern
New Delhi
5
Western
Mumbai
6
Southern
Chennai
6
(i) SELECT Zone, COUNT(*) FROM TRAIN GROUP BY Zone HAVING COUNT(*) > 1;
(ii) SELECT Zone, MAX(Coaches) FROM TRAIN GROUP BY Zone ORDER BY MAX(Coaches) DESC;
(iii) SELECT TName, Coaches, Divisions FROM TRAIN, ZONE WHERE TRAIN.Zone = ZONE.Zone AND Coaches > 17;
(iv) SELECT TName, HQ FROM TRAIN, ZONE WHERE TRAIN.Zone = ZONE.Zone AND HQ = 'New Delhi';
Answer
(i)
Zone
COUNT(*)
Northern
3
Southern
2
Explanation: GROUP BY Zone makes 3 groups (Northern, Southern, Western); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Zone
MAX(Coaches)
Southern
24
Northern
20
Western
18
Explanation: GROUP BY Zone makes 3 groups (Northern, Southern, Western); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Coaches) arranges the result in descending (largest first) order.
(iii)
TName
Coaches
Divisions
Shatabdi
24
6
Tejas
18
6
Vande Bharat
20
5
Explanation: The two tables TRAIN and ZONE are joined: only the row pairs where TRAIN.Zone = ZONE.Zone are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Coaches is more than 17.
(iv)
TName
HQ
Rajdhani
New Delhi
Duronto
New Delhi
Vande Bharat
New Delhi
Explanation: The two tables TRAIN and ZONE are joined: only the row pairs where TRAIN.Zone = ZONE.Zone are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: HQ is 'New Delhi'.
D2.39Practice4 marks
Consider the tables LAPTOP and BRAND given below. Write SQL queries to display:
The Brand that have more than one row
Each Brand with its highest RAM, in descending order of the highest RAM
The Model of each row with the Country of its Brand, using both the tables
The Model, RAM and Warranty of the rows where RAM is more than 16, using both the tables.
Table: LAPTOP
LNo
Model
Brand
RAM
Price
Launch
1
Astra 5
Orbit
16
86696.75
2026-11-10
2
Bolt X
Zenit
28
84541.93
2025-10-22
3
Comet Pro
Zenit
32
84965.49
2026-03-21
4
Dyna Air
Zenit
24
70706.77
2025-05-13
5
Eon Lite
Orbit
12
41551.16
2026-07-03
6
Flex 14
Nova
4
42044.12
2026-11-12
Table: BRAND
Brand
Country
Warranty
Zenit
India
2
Orbit
Japan
1
Nova
Korea
3
Answer
(i)
SELECT Brand, COUNT(*) FROM LAPTOP GROUP BY Brand HAVING COUNT(*) > 1;
Brand
COUNT(*)
Orbit
2
Zenit
3
Explanation: GROUP BY Brand makes 3 groups (Nova, Orbit, Zenit); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Brand, MAX(RAM) FROM LAPTOP GROUP BY Brand ORDER BY MAX(RAM) DESC;
Brand
MAX(RAM)
Zenit
32
Orbit
16
Nova
4
Explanation: GROUP BY Brand makes 3 groups (Nova, Orbit, Zenit); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(RAM) arranges the result in descending (largest first) order.
(iii)
SELECT Model, Country FROM LAPTOP, BRAND WHERE LAPTOP.Brand = BRAND.Brand;
Model
Country
Astra 5
Japan
Bolt X
India
Comet Pro
India
Dyna Air
India
Eon Lite
Japan
Flex 14
Korea
Explanation: The two tables LAPTOP and BRAND are joined: only the row pairs where LAPTOP.Brand = BRAND.Brand are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT Model, RAM, Warranty FROM LAPTOP, BRAND WHERE LAPTOP.Brand = BRAND.Brand AND RAM > 16;
Model
RAM
Warranty
Bolt X
28
2
Comet Pro
32
2
Dyna Air
24
2
Explanation: The two tables LAPTOP and BRAND are joined: only the row pairs where LAPTOP.Brand = BRAND.Brand are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: RAM is more than 16.
D2.40Practice4 marks
Consider the tables LAPTOP and BRAND given below. Write the output of the following queries.
Table: LAPTOP
LNo
Model
Brand
RAM
Price
Launch
1
Astra 5
Orbit
16
86696.75
2026-11-10
2
Bolt X
Zenit
28
84541.93
2025-10-22
3
Comet Pro
Zenit
32
84965.49
2026-03-21
4
Dyna Air
Zenit
24
70706.77
2025-05-13
5
Eon Lite
Orbit
12
41551.16
2026-07-03
6
Flex 14
Nova
4
42044.12
2026-11-12
Table: BRAND
Brand
Country
Warranty
Zenit
India
2
Orbit
Japan
1
Nova
Korea
3
(i) SELECT Brand, SUM(RAM) FROM LAPTOP GROUP BY Brand HAVING SUM(RAM) > 25;
(ii) SELECT Brand, COUNT(*) FROM LAPTOP GROUP BY Brand;
(iii) SELECT Model, RAM, Warranty FROM LAPTOP, BRAND WHERE LAPTOP.Brand = BRAND.Brand AND RAM > 16;
(iv) SELECT Model, Country FROM LAPTOP, BRAND WHERE LAPTOP.Brand = BRAND.Brand AND Country = 'India';
Answer
(i)
Brand
SUM(RAM)
Orbit
28
Zenit
84
Explanation: GROUP BY Brand makes 3 groups (Nova, Orbit, Zenit); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(RAM) is more than 25. SUM adds the values.
(ii)
Brand
COUNT(*)
Nova
1
Orbit
2
Zenit
3
Explanation: GROUP BY Brand makes 3 groups (Nova, Orbit, Zenit); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
Model
RAM
Warranty
Bolt X
28
2
Comet Pro
32
2
Dyna Air
24
2
Explanation: The two tables LAPTOP and BRAND are joined: only the row pairs where LAPTOP.Brand = BRAND.Brand are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: RAM is more than 16.
(iv)
Model
Country
Bolt X
India
Comet Pro
India
Dyna Air
India
Explanation: The two tables LAPTOP and BRAND are joined: only the row pairs where LAPTOP.Brand = BRAND.Brand are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Country is 'India'.
D2.41Practice4 marks
Consider the tables CLUB and ACTIVITY given below. Write SQL queries to display:
Each Activity and the number of rows in it
Each Activity and its total Age, only for the groups whose total Age is more than 40
The MName of each row with the Trainer of its Activity, using both the tables
The MName, Age and Days of the rows where Age is more than 27, using both the tables.
Table: CLUB
CNo
MName
Activity
Age
Fee
DOJ
1
Farhan
Tennis
27
1058.82
2026-12-05
2
Bhavna
Swimming
42
2296.53
2023-02-14
3
Lokesh
Yoga
16
805.04
2023-11-02
4
Simran
Yoga
36
1759.99
2026-03-27
5
Sachin
Tennis
17
3396.68
2026-04-14
6
Mohit
Yoga
56
1552.63
2023-06-09
Table: ACTIVITY
Activity
Trainer
Days
Yoga
Ms. Uma
6
Swimming
Mr. Zaid
5
Tennis
Ms. Tara
3
Answer
(i)
SELECT Activity, COUNT(*) FROM CLUB GROUP BY Activity;
Activity
COUNT(*)
Swimming
1
Tennis
2
Yoga
3
Explanation: GROUP BY Activity makes 3 groups (Swimming, Tennis, Yoga); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(ii)
SELECT Activity, SUM(Age) FROM CLUB GROUP BY Activity HAVING SUM(Age) > 40;
Activity
SUM(Age)
Swimming
42
Tennis
44
Yoga
108
Explanation: GROUP BY Activity makes 3 groups (Swimming, Tennis, Yoga); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Age) is more than 40. SUM adds the values.
(iii)
SELECT MName, Trainer FROM CLUB, ACTIVITY WHERE CLUB.Activity = ACTIVITY.Activity;
MName
Trainer
Farhan
Ms. Tara
Bhavna
Mr. Zaid
Lokesh
Ms. Uma
Simran
Ms. Uma
Sachin
Ms. Tara
Mohit
Ms. Uma
Explanation: The two tables CLUB and ACTIVITY are joined: only the row pairs where CLUB.Activity = ACTIVITY.Activity are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT MName, Age, Days FROM CLUB, ACTIVITY WHERE CLUB.Activity = ACTIVITY.Activity AND Age > 27;
MName
Age
Days
Bhavna
42
5
Simran
36
6
Mohit
56
6
Explanation: The two tables CLUB and ACTIVITY are joined: only the row pairs where CLUB.Activity = ACTIVITY.Activity are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Age is more than 27.
D2.42Practice4 marks
Consider the tables CLUB and ACTIVITY given below. Write the output of the following queries.
Table: CLUB
CNo
MName
Activity
Age
Fee
DOJ
1
Farhan
Tennis
27
1058.82
2026-12-05
2
Bhavna
Swimming
42
2296.53
2023-02-14
3
Lokesh
Yoga
16
805.04
2023-11-02
4
Simran
Yoga
36
1759.99
2026-03-27
5
Sachin
Tennis
17
3396.68
2026-04-14
6
Mohit
Yoga
56
1552.63
2023-06-09
Table: ACTIVITY
Activity
Trainer
Days
Yoga
Ms. Uma
6
Swimming
Mr. Zaid
5
Tennis
Ms. Tara
3
(i) SELECT Activity, COUNT(*) FROM CLUB GROUP BY Activity HAVING COUNT(*) > 1;
(ii) SELECT Activity, MAX(Age) FROM CLUB GROUP BY Activity ORDER BY MAX(Age) DESC;
(iii) SELECT MName, Age, Days FROM CLUB, ACTIVITY WHERE CLUB.Activity = ACTIVITY.Activity AND Age > 27;
(iv) SELECT MName, Trainer FROM CLUB, ACTIVITY WHERE CLUB.Activity = ACTIVITY.Activity AND Trainer = 'Ms. Uma';
Answer
(i)
Activity
COUNT(*)
Tennis
2
Yoga
3
Explanation: GROUP BY Activity makes 3 groups (Swimming, Tennis, Yoga); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
Activity
MAX(Age)
Yoga
56
Swimming
42
Tennis
27
Explanation: GROUP BY Activity makes 3 groups (Swimming, Tennis, Yoga); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Age) arranges the result in descending (largest first) order.
(iii)
MName
Age
Days
Bhavna
42
5
Simran
36
6
Mohit
56
6
Explanation: The two tables CLUB and ACTIVITY are joined: only the row pairs where CLUB.Activity = ACTIVITY.Activity are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Age is more than 27.
(iv)
MName
Trainer
Lokesh
Ms. Uma
Simran
Ms. Uma
Mohit
Ms. Uma
Explanation: The two tables CLUB and ACTIVITY are joined: only the row pairs where CLUB.Activity = ACTIVITY.Activity are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Trainer is 'Ms. Uma'.
D2.43Practice4 marks
Consider the tables FARM and CROP given below. Write SQL queries to display:
The Crop that have more than one row
Each Crop with its highest Acres, in descending order of the highest Acres
The Farmer of each row with the Season of its Crop, using both the tables
The Farmer, Acres and Days of the rows where Acres is more than 11, using both the tables.
Table: FARM
FNo
Farmer
Crop
Acres
Yield
SowDate
1
Arjun
Maize
39
34.42
2026-12-19
2
Anita
Wheat
9
40.16
2025-07-19
3
Isha
Rice
11
24.93
2026-02-23
4
Sonal
Wheat
16
46.04
2025-06-25
5
Vandana
Rice
6
41.02
2026-10-11
6
Harish
Wheat
23
23.82
2025-11-28
Table: CROP
Crop
Season
Days
Wheat
Rabi
120
Rice
Kharif
150
Maize
Zaid
100
Answer
(i)
SELECT Crop, COUNT(*) FROM FARM GROUP BY Crop HAVING COUNT(*) > 1;
Crop
COUNT(*)
Rice
2
Wheat
3
Explanation: GROUP BY Crop makes 3 groups (Maize, Rice, Wheat); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where COUNT(*) is more than 1. COUNT(*) counts the rows.
(ii)
SELECT Crop, MAX(Acres) FROM FARM GROUP BY Crop ORDER BY MAX(Acres) DESC;
Crop
MAX(Acres)
Maize
39
Wheat
23
Rice
11
Explanation: GROUP BY Crop makes 3 groups (Maize, Rice, Wheat); the aggregate function is worked out separately for each group. MAX gives the largest value. ORDER BY MAX(Acres) arranges the result in descending (largest first) order.
(iii)
SELECT Farmer, Season FROM FARM, CROP WHERE FARM.Crop = CROP.Crop;
Farmer
Season
Arjun
Zaid
Anita
Rabi
Isha
Kharif
Sonal
Rabi
Vandana
Kharif
Harish
Rabi
Explanation: The two tables FARM and CROP are joined: only the row pairs where FARM.Crop = CROP.Crop are kept (an equi-join). The join gives 6 rows.
(iv)
SELECT Farmer, Acres, Days FROM FARM, CROP WHERE FARM.Crop = CROP.Crop AND Acres > 11;
Farmer
Acres
Days
Arjun
39
100
Sonal
16
120
Harish
23
120
Explanation: The two tables FARM and CROP are joined: only the row pairs where FARM.Crop = CROP.Crop are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Acres is more than 11.
D2.44Practice4 marks
Consider the tables FARM and CROP given below. Write the output of the following queries.
Table: FARM
FNo
Farmer
Crop
Acres
Yield
SowDate
1
Arjun
Maize
39
34.42
2026-12-19
2
Anita
Wheat
9
40.16
2025-07-19
3
Isha
Rice
11
24.93
2026-02-23
4
Sonal
Wheat
16
46.04
2025-06-25
5
Vandana
Rice
6
41.02
2026-10-11
6
Harish
Wheat
23
23.82
2025-11-28
Table: CROP
Crop
Season
Days
Wheat
Rabi
120
Rice
Kharif
150
Maize
Zaid
100
(i) SELECT Crop, SUM(Acres) FROM FARM GROUP BY Crop HAVING SUM(Acres) > 35;
(ii) SELECT Crop, COUNT(*) FROM FARM GROUP BY Crop;
(iii) SELECT Farmer, Acres, Days FROM FARM, CROP WHERE FARM.Crop = CROP.Crop AND Acres > 11;
(iv) SELECT Farmer, Season FROM FARM, CROP WHERE FARM.Crop = CROP.Crop AND Season = 'Rabi';
Answer
(i)
Crop
SUM(Acres)
Maize
39
Wheat
48
Explanation: GROUP BY Crop makes 3 groups (Maize, Rice, Wheat); the aggregate function is worked out separately for each group. HAVING then keeps only the groups where SUM(Acres) is more than 35. SUM adds the values.
(ii)
Crop
COUNT(*)
Maize
1
Rice
2
Wheat
3
Explanation: GROUP BY Crop makes 3 groups (Maize, Rice, Wheat); the aggregate function is worked out separately for each group. COUNT(*) counts the rows.
(iii)
Farmer
Acres
Days
Arjun
39
100
Sonal
16
120
Harish
23
120
Explanation: The two tables FARM and CROP are joined: only the row pairs where FARM.Crop = CROP.Crop are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Acres is more than 11.
(iv)
Farmer
Season
Anita
Rabi
Sonal
Rabi
Harish
Rabi
Explanation: The two tables FARM and CROP are joined: only the row pairs where FARM.Crop = CROP.Crop are kept (an equi-join). Of the 6 joined rows, 3 match the other condition: Season is 'Rabi'.
Section E · 5 marks each
E1Network case study5 marks · 24 questions
E1.1Practice5 marks
Vidya Public School, Nagpur. Vidya Public School in Nagpur is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
ADMIN
215
LIBRARY
210
SCIENCE
95
HOSTEL
40
Distance between blocks
From
To
Distance
ADMIN
LIBRARY
60 m
ADMIN
SCIENCE
140 m
ADMIN
HOSTEL
55 m
LIBRARY
SCIENCE
40 m
LIBRARY
HOSTEL
65 m
SCIENCE
HOSTEL
35 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants a website on which each user logs in and sees his or her own details. Should the web pages be static or dynamic? Give a reason.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
ADMIN block, because it has the largest number of computers (215). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (ADMIN, LIBRARY, SCIENCE, HOSTEL). It sends the data only to the computer it is meant for.
Dynamic. The content changes for each user and comes from a database. A static page shows the same content to everyone.
Between ADMIN and SCIENCE (140 m), because the cable is longer than 100 m and the signal becomes weak. The other links are shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.2Practice5 marks
Sunrise Textiles, Surat. Sunrise Textiles in Surat is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
HR
180
SALES
190
PRODUCTION
25
STORE
60
Distance between blocks
From
To
Distance
HR
SALES
80 m
HR
PRODUCTION
150 m
HR
STORE
60 m
SALES
PRODUCTION
40 m
SALES
STORE
150 m
PRODUCTION
STORE
115 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation has one more office in Kolkata. Which type of network (PAN, LAN, MAN or WAN) will be formed when the two offices are connected?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
SALES block, because it has the largest number of computers (190). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (HR, SALES, PRODUCTION, STORE). It sends the data only to the computer it is meant for.
WAN (Wide Area Network), because the two offices are in different cities, far from each other.
Between SALES and STORE (150 m), because the cable is longer than 100 m and the signal becomes weak. The other links are shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.3Practice5 marks
Lifeline Hospital, Patna. Lifeline Hospital in Patna is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
OPD
195
LAB
80
WARD
185
PHARMACY
155
Distance between blocks
From
To
Distance
OPD
LAB
30 m
OPD
WARD
135 m
OPD
PHARMACY
135 m
LAB
WARD
100 m
LAB
PHARMACY
75 m
WARD
PHARMACY
170 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The staff wants to make low-cost voice calls to the office in Chennai through the Internet. Name the technology that makes this possible.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
OPD block, because it has the largest number of computers (195). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (OPD, LAB, WARD, PHARMACY). It sends the data only to the computer it is meant for.
VoIP (Voice over Internet Protocol). It carries the voice as data over the Internet, so the calls are very cheap.
Between OPD and WARD (135 m) and between OPD and PHARMACY (135 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.4Practice5 marks
TechNova Institute, Hyderabad. TechNova Institute in Hyderabad is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
RECEPTION
80
TRAINING
230
DATA CENTRE
25
CANTEEN
120
Distance between blocks
From
To
Distance
RECEPTION
TRAINING
145 m
RECEPTION
DATA CENTRE
60 m
RECEPTION
CANTEEN
30 m
TRAINING
DATA CENTRE
80 m
TRAINING
CANTEEN
115 m
DATA CENTRE
CANTEEN
100 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
Which device will be needed to connect the network of this campus to the Internet? Where should it be placed?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
TRAINING block, because it has the largest number of computers (230). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (RECEPTION, TRAINING, DATA CENTRE, CANTEEN). It sends the data only to the computer it is meant for.
A modem (with a router). It should be placed in the TRAINING block, where the server is.
Between TRAINING and RECEPTION (145 m) and between TRAINING and CANTEEN (115 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.5Practice5 marks
Green Valley Polytechnic, Dehradun. Green Valley Polytechnic in Dehradun is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
MAIN
55
ANNEXE
125
WORKSHOP
165
GUEST HOUSE
115
Distance between blocks
From
To
Distance
MAIN
ANNEXE
140 m
MAIN
WORKSHOP
115 m
MAIN
GUEST HOUSE
90 m
ANNEXE
WORKSHOP
120 m
ANNEXE
GUEST HOUSE
165 m
WORKSHOP
GUEST HOUSE
65 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants its website to be available on the Internet all the time. What is this service called, and on which kind of computer are the files of the website kept?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
WORKSHOP block, because it has the largest number of computers (165). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (MAIN, ANNEXE, WORKSHOP, GUEST HOUSE). It sends the data only to the computer it is meant for.
Web hosting. The files are kept on a web server, which is connected to the Internet all the time.
Between WORKSHOP and MAIN (115 m) and between WORKSHOP and ANNEXE (120 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.6Practice5 marks
Daily Times Press, Bhopal. Daily Times Press in Bhopal is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
EDITORIAL
120
PRINTING
110
MARKETING
60
DISPATCH
140
Distance between blocks
From
To
Distance
EDITORIAL
PRINTING
135 m
EDITORIAL
MARKETING
135 m
EDITORIAL
DISPATCH
75 m
PRINTING
MARKETING
165 m
PRINTING
DISPATCH
140 m
MARKETING
DISPATCH
155 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants a website on which each user logs in and sees his or her own details. Should the web pages be static or dynamic? Give a reason.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
DISPATCH block, because it has the largest number of computers (140). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (EDITORIAL, PRINTING, MARKETING, DISPATCH). It sends the data only to the computer it is meant for.
Dynamic. The content changes for each user and comes from a database. A static page shows the same content to everyone.
Between DISPATCH and PRINTING (140 m) and between DISPATCH and MARKETING (155 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.7Practice5 marks
Himalaya Sports School, Gangtok. Himalaya Sports School in Gangtok is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
JUNIOR
250
SENIOR
200
SPORTS
45
OFFICE
15
Distance between blocks
From
To
Distance
JUNIOR
SENIOR
155 m
JUNIOR
SPORTS
145 m
JUNIOR
OFFICE
65 m
SENIOR
SPORTS
75 m
SENIOR
OFFICE
110 m
SPORTS
OFFICE
145 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation has one more office in Kolkata. Which type of network (PAN, LAN, MAN or WAN) will be formed when the two offices are connected?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
JUNIOR block, because it has the largest number of computers (250). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (JUNIOR, SENIOR, SPORTS, OFFICE). It sends the data only to the computer it is meant for.
WAN (Wide Area Network), because the two offices are in different cities, far from each other.
Between JUNIOR and SENIOR (155 m) and between JUNIOR and SPORTS (145 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.8Practice5 marks
Orbit Labs, Bengaluru. Orbit Labs in Bengaluru is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
RESEARCH
195
DESIGN
100
TESTING
230
ACCOUNTS
85
Distance between blocks
From
To
Distance
RESEARCH
DESIGN
155 m
RESEARCH
TESTING
45 m
RESEARCH
ACCOUNTS
165 m
DESIGN
TESTING
170 m
DESIGN
ACCOUNTS
90 m
TESTING
ACCOUNTS
35 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The staff wants to make low-cost voice calls to the office in Chennai through the Internet. Name the technology that makes this possible.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
TESTING block, because it has the largest number of computers (230). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (RESEARCH, DESIGN, TESTING, ACCOUNTS). It sends the data only to the computer it is meant for.
VoIP (Voice over Internet Protocol). It carries the voice as data over the Internet, so the calls are very cheap.
Between TESTING and DESIGN (170 m), because the cable is longer than 100 m and the signal becomes weak. The other links are shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.9Practice5 marks
City Degree College, Kanpur. City Degree College in Kanpur is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
ARTS
85
COMMERCE
140
SCIENCE
125
ADMIN
215
Distance between blocks
From
To
Distance
ARTS
COMMERCE
65 m
ARTS
SCIENCE
30 m
ARTS
ADMIN
105 m
COMMERCE
SCIENCE
155 m
COMMERCE
ADMIN
120 m
SCIENCE
ADMIN
90 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
Which device will be needed to connect the network of this campus to the Internet? Where should it be placed?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
ADMIN block, because it has the largest number of computers (215). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (ARTS, COMMERCE, SCIENCE, ADMIN). It sends the data only to the computer it is meant for.
A modem (with a router). It should be placed in the ADMIN block, where the server is.
Between ADMIN and ARTS (105 m) and between ADMIN and COMMERCE (120 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.10Practice5 marks
QuickKart Logistics, Noida. QuickKart Logistics in Noida is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
BILLING
185
CUSTOMER CARE
20
WAREHOUSE
225
IT
240
Distance between blocks
From
To
Distance
BILLING
CUSTOMER CARE
165 m
BILLING
WAREHOUSE
90 m
BILLING
IT
130 m
CUSTOMER CARE
WAREHOUSE
80 m
CUSTOMER CARE
IT
50 m
WAREHOUSE
IT
180 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants its website to be available on the Internet all the time. What is this service called, and on which kind of computer are the files of the website kept?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
IT block, because it has the largest number of computers (240). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (BILLING, CUSTOMER CARE, WAREHOUSE, IT). It sends the data only to the computer it is meant for.
Web hosting. The files are kept on a web server, which is connected to the Internet all the time.
Between IT and BILLING (130 m) and between IT and WAREHOUSE (180 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.11Practice5 marks
Saraswati Vidya Mandir, Ranchi. Saraswati Vidya Mandir in Ranchi is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
PRIMARY
230
SECONDARY
20
LAB
55
OFFICE
100
Distance between blocks
From
To
Distance
PRIMARY
SECONDARY
110 m
PRIMARY
LAB
40 m
PRIMARY
OFFICE
50 m
SECONDARY
LAB
55 m
SECONDARY
OFFICE
105 m
LAB
OFFICE
115 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants a website on which each user logs in and sees his or her own details. Should the web pages be static or dynamic? Give a reason.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
PRIMARY block, because it has the largest number of computers (230). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (PRIMARY, SECONDARY, LAB, OFFICE). It sends the data only to the computer it is meant for.
Dynamic. The content changes for each user and comes from a database. A static page shows the same content to everyone.
Between PRIMARY and SECONDARY (110 m), because the cable is longer than 100 m and the signal becomes weak. The other links are shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.12Practice5 marks
Bharat Auto Parts, Pune. Bharat Auto Parts in Pune is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
DESIGN
170
ASSEMBLY
55
PAINT
20
DISPATCH
205
Distance between blocks
From
To
Distance
DESIGN
ASSEMBLY
175 m
DESIGN
PAINT
110 m
DESIGN
DISPATCH
180 m
ASSEMBLY
PAINT
150 m
ASSEMBLY
DISPATCH
170 m
PAINT
DISPATCH
65 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation has one more office in Kolkata. Which type of network (PAN, LAN, MAN or WAN) will be formed when the two offices are connected?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
DISPATCH block, because it has the largest number of computers (205). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (DESIGN, ASSEMBLY, PAINT, DISPATCH). It sends the data only to the computer it is meant for.
WAN (Wide Area Network), because the two offices are in different cities, far from each other.
Between DISPATCH and DESIGN (180 m) and between DISPATCH and ASSEMBLY (170 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.13Practice5 marks
Arogya Medical Centre, Kochi. Arogya Medical Centre in Kochi is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
EMERGENCY
120
OPD
105
RECORDS
15
ADMIN
125
Distance between blocks
From
To
Distance
EMERGENCY
OPD
180 m
EMERGENCY
RECORDS
165 m
EMERGENCY
ADMIN
160 m
OPD
RECORDS
165 m
OPD
ADMIN
35 m
RECORDS
ADMIN
60 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The staff wants to make low-cost voice calls to the office in Chennai through the Internet. Name the technology that makes this possible.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
ADMIN block, because it has the largest number of computers (125). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (EMERGENCY, OPD, RECORDS, ADMIN). It sends the data only to the computer it is meant for.
VoIP (Voice over Internet Protocol). It carries the voice as data over the Internet, so the calls are very cheap.
Between ADMIN and EMERGENCY (160 m), because the cable is longer than 100 m and the signal becomes weak. The other links are shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.14Practice5 marks
SkillUp Academy, Indore. SkillUp Academy in Indore is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
BLOCK A
135
BLOCK B
220
BLOCK C
80
BLOCK D
185
Distance between blocks
From
To
Distance
BLOCK A
BLOCK B
60 m
BLOCK A
BLOCK C
180 m
BLOCK A
BLOCK D
155 m
BLOCK B
BLOCK C
155 m
BLOCK B
BLOCK D
175 m
BLOCK C
BLOCK D
140 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
Which device will be needed to connect the network of this campus to the Internet? Where should it be placed?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
BLOCK B block, because it has the largest number of computers (220). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (BLOCK A, BLOCK B, BLOCK C, BLOCK D). It sends the data only to the computer it is meant for.
A modem (with a router). It should be placed in the BLOCK B block, where the server is.
Between BLOCK B and BLOCK C (155 m) and between BLOCK B and BLOCK D (175 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.15Practice5 marks
Ganga Engineering Works, Varanasi. Ganga Engineering Works in Varanasi is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
OFFICE
100
FOUNDRY
50
MACHINE SHOP
180
STORE
155
Distance between blocks
From
To
Distance
OFFICE
FOUNDRY
140 m
OFFICE
MACHINE SHOP
140 m
OFFICE
STORE
100 m
FOUNDRY
MACHINE SHOP
35 m
FOUNDRY
STORE
165 m
MACHINE SHOP
STORE
105 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants its website to be available on the Internet all the time. What is this service called, and on which kind of computer are the files of the website kept?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
MACHINE SHOP block, because it has the largest number of computers (180). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (OFFICE, FOUNDRY, MACHINE SHOP, STORE). It sends the data only to the computer it is meant for.
Web hosting. The files are kept on a web server, which is connected to the Internet all the time.
Between MACHINE SHOP and OFFICE (140 m) and between MACHINE SHOP and STORE (105 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.16Practice5 marks
Navyug Publications, Chandigarh. Navyug Publications in Chandigarh is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
EDITING
120
DESIGN
200
PRESS
80
SALES
250
Distance between blocks
From
To
Distance
EDITING
DESIGN
40 m
EDITING
PRESS
175 m
EDITING
SALES
140 m
DESIGN
PRESS
40 m
DESIGN
SALES
55 m
PRESS
SALES
95 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants a website on which each user logs in and sees his or her own details. Should the web pages be static or dynamic? Give a reason.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
SALES block, because it has the largest number of computers (250). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (EDITING, DESIGN, PRESS, SALES). It sends the data only to the computer it is meant for.
Dynamic. The content changes for each user and comes from a database. A static page shows the same content to everyone.
Between SALES and EDITING (140 m), because the cable is longer than 100 m and the signal becomes weak. The other links are shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.17Practice5 marks
Delhi Model School, Delhi. Delhi Model School in Delhi is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
JUNIOR WING
200
SENIOR WING
160
COMPUTER LAB
245
ADMIN
215
Distance between blocks
From
To
Distance
JUNIOR WING
SENIOR WING
175 m
JUNIOR WING
COMPUTER LAB
150 m
JUNIOR WING
ADMIN
55 m
SENIOR WING
COMPUTER LAB
175 m
SENIOR WING
ADMIN
170 m
COMPUTER LAB
ADMIN
40 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation has one more office in Kolkata. Which type of network (PAN, LAN, MAN or WAN) will be formed when the two offices are connected?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
COMPUTER LAB block, because it has the largest number of computers (245). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (JUNIOR WING, SENIOR WING, COMPUTER LAB, ADMIN). It sends the data only to the computer it is meant for.
WAN (Wide Area Network), because the two offices are in different cities, far from each other.
Between COMPUTER LAB and JUNIOR WING (150 m) and between COMPUTER LAB and SENIOR WING (175 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.18Practice5 marks
Pixel Design Studio, Mumbai. Pixel Design Studio in Mumbai is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
STUDIO
15
EDIT ROOM
130
ACCOUNTS
195
RECEPTION
240
Distance between blocks
From
To
Distance
STUDIO
EDIT ROOM
135 m
STUDIO
ACCOUNTS
160 m
STUDIO
RECEPTION
160 m
EDIT ROOM
ACCOUNTS
165 m
EDIT ROOM
RECEPTION
155 m
ACCOUNTS
RECEPTION
65 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The staff wants to make low-cost voice calls to the office in Guwahati through the Internet. Name the technology that makes this possible.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
RECEPTION block, because it has the largest number of computers (240). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (STUDIO, EDIT ROOM, ACCOUNTS, RECEPTION). It sends the data only to the computer it is meant for.
VoIP (Voice over Internet Protocol). It carries the voice as data over the Internet, so the calls are very cheap.
Between RECEPTION and STUDIO (160 m) and between RECEPTION and EDIT ROOM (155 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.19Practice5 marks
National Commerce College, Jaipur. National Commerce College in Jaipur is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
BLOCK P
40
BLOCK Q
100
BLOCK R
65
BLOCK S
85
Distance between blocks
From
To
Distance
BLOCK P
BLOCK Q
160 m
BLOCK P
BLOCK R
55 m
BLOCK P
BLOCK S
55 m
BLOCK Q
BLOCK R
35 m
BLOCK Q
BLOCK S
175 m
BLOCK R
BLOCK S
115 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
Which device will be needed to connect the network of this campus to the Internet? Where should it be placed?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
BLOCK Q block, because it has the largest number of computers (100). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (BLOCK P, BLOCK Q, BLOCK R, BLOCK S). It sends the data only to the computer it is meant for.
A modem (with a router). It should be placed in the BLOCK Q block, where the server is.
Between BLOCK Q and BLOCK P (160 m) and between BLOCK Q and BLOCK S (175 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.20Practice5 marks
FreshCart Retail, Lucknow. FreshCart Retail in Lucknow is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
BILLING
150
GODOWN
125
OFFICE
135
DELIVERY
120
Distance between blocks
From
To
Distance
BILLING
GODOWN
170 m
BILLING
OFFICE
60 m
BILLING
DELIVERY
160 m
GODOWN
OFFICE
175 m
GODOWN
DELIVERY
65 m
OFFICE
DELIVERY
100 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants its website to be available on the Internet all the time. What is this service called, and on which kind of computer are the files of the website kept?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
BILLING block, because it has the largest number of computers (150). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (BILLING, GODOWN, OFFICE, DELIVERY). It sends the data only to the computer it is meant for.
Web hosting. The files are kept on a web server, which is connected to the Internet all the time.
Between BILLING and GODOWN (170 m) and between BILLING and DELIVERY (160 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.21Practice5 marks
Gyan Deep School, Raipur. Gyan Deep School in Raipur is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
NORTH
195
SOUTH
70
EAST
150
WEST
90
Distance between blocks
From
To
Distance
NORTH
SOUTH
130 m
NORTH
EAST
45 m
NORTH
WEST
145 m
SOUTH
EAST
110 m
SOUTH
WEST
85 m
EAST
WEST
170 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation wants a website on which each user logs in and sees his or her own details. Should the web pages be static or dynamic? Give a reason.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
NORTH block, because it has the largest number of computers (195). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (NORTH, SOUTH, EAST, WEST). It sends the data only to the computer it is meant for.
Dynamic. The content changes for each user and comes from a database. A static page shows the same content to everyone.
Between NORTH and SOUTH (130 m) and between NORTH and WEST (145 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.22Practice5 marks
Coastal Foods, Visakhapatnam. Coastal Foods in Visakhapatnam is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
PACKING
70
COLD STORE
75
OFFICE
165
QUALITY
105
Distance between blocks
From
To
Distance
PACKING
COLD STORE
175 m
PACKING
OFFICE
170 m
PACKING
QUALITY
165 m
COLD STORE
OFFICE
65 m
COLD STORE
QUALITY
115 m
OFFICE
QUALITY
175 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The organisation has one more office in Kolkata. Which type of network (PAN, LAN, MAN or WAN) will be formed when the two offices are connected?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
OFFICE block, because it has the largest number of computers (165). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (PACKING, COLD STORE, OFFICE, QUALITY). It sends the data only to the computer it is meant for.
WAN (Wide Area Network), because the two offices are in different cities, far from each other.
Between OFFICE and PACKING (170 m) and between OFFICE and QUALITY (175 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.23Practice5 marks
Care Plus Hospital, Ahmedabad. Care Plus Hospital in Ahmedabad is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
OPD
120
ICU
100
LAB
55
BILLING
220
Distance between blocks
From
To
Distance
OPD
ICU
75 m
OPD
LAB
110 m
OPD
BILLING
165 m
ICU
LAB
155 m
ICU
BILLING
155 m
LAB
BILLING
95 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
The staff wants to make low-cost voice calls to the office in Chennai through the Internet. Name the technology that makes this possible.
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
BILLING block, because it has the largest number of computers (220). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (OPD, ICU, LAB, BILLING). It sends the data only to the computer it is meant for.
VoIP (Voice over Internet Protocol). It carries the voice as data over the Internet, so the calls are very cheap.
Between BILLING and OPD (165 m) and between BILLING and ICU (155 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E1.24Practice5 marks
Future Minds Institute, Chennai. Future Minds Institute in Chennai is setting up a computer network in its campus. It has four blocks, as shown in the layout.
Layout of the blocks
Number of computers
Block
Computers
TOWER 1
250
TOWER 2
25
TOWER 3
50
TOWER 4
180
Distance between blocks
From
To
Distance
TOWER 1
TOWER 2
115 m
TOWER 1
TOWER 3
90 m
TOWER 1
TOWER 4
115 m
TOWER 2
TOWER 3
115 m
TOWER 2
TOWER 4
115 m
TOWER 3
TOWER 4
135 m
Which block is the most suitable place for the server? Give a reason.
Which type of network (PAN, LAN, MAN or WAN) is formed when the four blocks are connected? Give a reason.
Which device should be placed in every block to connect the computers of that block?
Which device will be needed to connect the network of this campus to the Internet? Where should it be placed?
Between which blocks should a repeater be placed, if the cables are laid from the server block to the other three blocks? Give a reason.
Answer
TOWER 1 block, because it has the largest number of computers (250). Most of the data traffic then stays inside one block.
LAN (Local Area Network), because all the blocks are inside one campus, within a small area.
A switch in every block (TOWER 1, TOWER 2, TOWER 3, TOWER 4). It sends the data only to the computer it is meant for.
A modem (with a router). It should be placed in the TOWER 1 block, where the server is.
Between TOWER 1 and TOWER 2 (115 m) and between TOWER 1 and TOWER 4 (115 m), because the cable is longer than 100 m and the signal becomes weak. The other link is shorter than 100 m.
Suggested cable layout (star). R marks a repeater.
E2DataFrame program5 marks · 24 questions
E2.1Practice5 marks
The DataFrame Stock stores the items of a stationery shop.
Write a Python program to create the DataFrame Stock given below from a dictionary of lists, and display it. (3 marks)
Write a statement to add a new row with the label S5: Item Ink, Price 90 and Qty 30. (1 mark)
Write a statement to display only the column Item. (1 mark)
E3SQL commands and queries in five parts5 marks · 44 questions
E3.1Practice5 marks
Consider the table PATIENT given below. Write SQL commands to:
Add a new row with the values 107, 'Aman', 'Cardiology', 3, 5994.18, '2026-12-15'
Increase the Days by 5 for the rows where Dept is 'Cardiology'
Delete the rows where Days is less than 4
Add a new column Remarks of type VARCHAR(30)
Remove the table PATIENT from the database.
Table: PATIENT
PNo
PName
Dept
Days
Bill
DOA
101
Yash
Cardiology
2
5000.32
2026-03-11
102
Chetan
Cardiology
15
5983.68
2026-03-01
103
Zeenat
Cardiology
4
8922.89
2026-07-02
104
Swati
Ortho
7
6492.81
2026-04-01
105
Pankaj
ENT
14
8701.77
2026-03-13
106
Mohit
ENT
13
5473.26
2026-02-19
Answer
(i)
INSERT INTO PATIENT VALUES (107, 'Aman', 'Cardiology', 3, 5994.18, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE PATIENT SET Days = Days + 5 WHERE Dept = 'Cardiology';
Rows affected: 3
Explanation: SET Days = Days + 5 changes the value; WHERE limits the change to the rows where Dept is 'Cardiology': 3 rows changed.
(iii)
DELETE FROM PATIENT WHERE Days < 4;
Rows affected: 1
Explanation: WHERE picks the rows where Days is less than 4: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE PATIENT ADD Remarks VARCHAR(30);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE PATIENT;
Explanation: DROP removes the whole object with its data.
E3.2Practice5 marks
Consider the table PATIENT given below. Write SQL queries to display:
Each PName and its Bill rounded to one decimal place
The PName that end with the letter 'n'
The PName and Days of the rows where Days is 7 or less
The total Days of the rows where Dept is 'Cardiology'
The first three characters of each PName.
Table: PATIENT
PNo
PName
Dept
Days
Bill
DOA
101
Yash
Cardiology
2
5000.32
2026-03-11
102
Chetan
Cardiology
15
5983.68
2026-03-01
103
Zeenat
Cardiology
4
8922.89
2026-07-02
104
Swati
Ortho
7
6492.81
2026-04-01
105
Pankaj
ENT
14
8701.77
2026-03-13
106
Mohit
ENT
13
5473.26
2026-02-19
Answer
(i)
SELECT PName, ROUND(Bill, 1) FROM PATIENT;
PName
ROUND(Bill, 1)
Yash
5000.3
Chetan
5983.7
Zeenat
8922.9
Swati
6492.8
Pankaj
8701.8
Mohit
5473.3
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT PName FROM PATIENT WHERE PName LIKE '%n';
PName
Chetan
Explanation: WHERE keeps only the rows where PName matches the pattern '%n': 1 of the 6 rows matches (Chetan). '%n' means the value ends with 'n'.
(iii)
SELECT PName, Days FROM PATIENT WHERE Days <= 7;
PName
Days
Yash
2
Zeenat
4
Swati
7
Explanation: WHERE keeps only the rows where Days is at most 7: 3 of the 6 rows match (Yash, Zeenat, Swati).
(iv)
SELECT SUM(Days) FROM PATIENT WHERE Dept = 'Cardiology';
SUM(Days)
21
Explanation: WHERE keeps only the rows where Dept is 'Cardiology': 3 of the 6 rows match (Yash, Chetan, Zeenat). SUM adds the values of the matching rows.
(v)
SELECT LEFT(PName, 3) FROM PATIENT;
LEFT(PName, 3)
Yas
Che
Zee
Swa
Pan
Moh
Explanation: The function LEFT is worked out for every row that is shown.
E3.3Practice5 marks
Consider the table EMPLOYEE given below. Write SQL commands to:
Add a new row with the values 17, 'Bhavna', 'Sales', 43001, 1735.52, '2025-12-15'
Increase the Salary by 500 for the rows where Dept is 'Sales'
Delete the rows where Salary is less than 31000
Add a new column Email of type VARCHAR(40)
Remove the table EMPLOYEE from the database.
Table: EMPLOYEE
ENo
EName
Dept
Salary
Bonus
DOJ
11
Isha
HR
43000
3522.37
2023-02-02
12
Yash
Sales
40000
1725.02
2025-08-02
13
Suman
HR
44000
3550.14
2019-09-25
14
Jatin
Sales
45000
1269.74
2025-03-19
15
Nikhil
Sales
25000
3263.38
2022-09-09
16
Sachin
Accounts
31000
3064.28
2021-05-17
Answer
(i)
INSERT INTO EMPLOYEE VALUES (17, 'Bhavna', 'Sales', 43001, 1735.52, '2025-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE EMPLOYEE SET Salary = Salary + 500 WHERE Dept = 'Sales';
Rows affected: 3
Explanation: SET Salary = Salary + 500 changes the value; WHERE limits the change to the rows where Dept is 'Sales': 3 rows changed.
(iii)
DELETE FROM EMPLOYEE WHERE Salary < 31000;
Rows affected: 1
Explanation: WHERE picks the rows where Salary is less than 31000: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE EMPLOYEE ADD Email VARCHAR(40);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE EMPLOYEE;
Explanation: DROP removes the whole object with its data.
E3.4Practice5 marks
Consider the table EMPLOYEE given below. Write SQL queries to display:
Each EName and its Bonus rounded to the nearest whole number
The rows where EName starts with the letter 'I'
The EName and Salary of the rows where Salary is 40000 or less
The highest and the lowest Bonus
The EName in capital letters.
Table: EMPLOYEE
ENo
EName
Dept
Salary
Bonus
DOJ
11
Isha
HR
43000
3522.37
2023-02-02
12
Yash
Sales
40000
1725.02
2025-08-02
13
Suman
HR
44000
3550.14
2019-09-25
14
Jatin
Sales
45000
1269.74
2025-03-19
15
Nikhil
Sales
25000
3263.38
2022-09-09
16
Sachin
Accounts
31000
3064.28
2021-05-17
Answer
(i)
SELECT EName, ROUND(Bonus) FROM EMPLOYEE;
EName
ROUND(Bonus)
Isha
3522
Yash
1725
Suman
3550
Jatin
1270
Nikhil
3263
Sachin
3064
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM EMPLOYEE WHERE EName LIKE 'I%';
ENo
EName
Dept
Salary
Bonus
DOJ
11
Isha
HR
43000
3522.37
2023-02-02
Explanation: WHERE keeps only the rows where EName matches the pattern 'I%': 1 of the 6 rows matches (Isha). 'I%' means the value starts with 'I'.
(iii)
SELECT EName, Salary FROM EMPLOYEE WHERE Salary <= 40000;
EName
Salary
Yash
40000
Nikhil
25000
Sachin
31000
Explanation: WHERE keeps only the rows where Salary is at most 40000: 3 of the 6 rows match (Yash, Nikhil, Sachin).
(iv)
SELECT MAX(Bonus), MIN(Bonus) FROM EMPLOYEE;
MAX(Bonus)
MIN(Bonus)
3550.14
1269.74
Explanation: MAX gives the largest value of all the rows. MIN gives the smallest value.
(v)
SELECT UCASE(EName) FROM EMPLOYEE;
UCASE(EName)
ISHA
YASH
SUMAN
JATIN
NIKHIL
SACHIN
Explanation: The function UCASE is worked out for every row that is shown.
E3.5Practice5 marks
Consider the table BOOK given below. Write SQL commands to:
Add a new row with the values 7, 'New Wings', 'Fiction', 121, 347.53, '2025-12-15'
Increase the Pages by 2 for the rows where Genre is 'Fiction'
Delete the rows where Pages is less than 150
Add a new column Grade of type CHAR(1)
Remove the table BOOK from the database.
Table: BOOK
BNo
Title
Genre
Pages
Price
DOP
1
Wings of Fire
Fiction
120
342.44
2022-06-18
2
Malgudi Days
Fiction
290
337.03
2025-06-20
3
Panchatantra
Biography
150
339.91
2021-07-27
4
Godan
Poetry
320
195.34
2024-05-13
5
Gitanjali
Biography
440
520.87
2024-10-12
6
Train to Pakistan
Fiction
330
359.45
2021-10-21
Answer
(i)
INSERT INTO BOOK VALUES (7, 'New Wings', 'Fiction', 121, 347.53, '2025-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE BOOK SET Pages = Pages + 2 WHERE Genre = 'Fiction';
Rows affected: 3
Explanation: SET Pages = Pages + 2 changes the value; WHERE limits the change to the rows where Genre is 'Fiction': 3 rows changed.
(iii)
DELETE FROM BOOK WHERE Pages < 150;
Rows affected: 1
Explanation: WHERE picks the rows where Pages is less than 150: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE BOOK ADD Grade CHAR(1);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE BOOK;
Explanation: DROP removes the whole object with its data.
E3.6Practice5 marks
Consider the table BOOK given below. Write SQL queries to display:
Each Title and its Price rounded to one decimal place
The Title that end with the letter 's'
The Title and Pages of the rows where Pages is 290 or less
The number of rows where Genre is 'Fiction'
Each Title and the number of characters in it.
Table: BOOK
BNo
Title
Genre
Pages
Price
DOP
1
Wings of Fire
Fiction
120
342.44
2022-06-18
2
Malgudi Days
Fiction
290
337.03
2025-06-20
3
Panchatantra
Biography
150
339.91
2021-07-27
4
Godan
Poetry
320
195.34
2024-05-13
5
Gitanjali
Biography
440
520.87
2024-10-12
6
Train to Pakistan
Fiction
330
359.45
2021-10-21
Answer
(i)
SELECT Title, ROUND(Price, 1) FROM BOOK;
Title
ROUND(Price, 1)
Wings of Fire
342.4
Malgudi Days
337.0
Panchatantra
339.9
Godan
195.3
Gitanjali
520.9
Train to Pakistan
359.5
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT Title FROM BOOK WHERE Title LIKE '%s';
Title
Malgudi Days
Explanation: WHERE keeps only the rows where Title matches the pattern '%s': 1 of the 6 rows matches (Malgudi Days). '%s' means the value ends with 's'.
(iii)
SELECT Title, Pages FROM BOOK WHERE Pages <= 290;
Title
Pages
Wings of Fire
120
Malgudi Days
290
Panchatantra
150
Explanation: WHERE keeps only the rows where Pages is at most 290: 3 of the 6 rows match (Wings of Fire, Malgudi Days, Panchatantra).
(iv)
SELECT COUNT(*) FROM BOOK WHERE Genre = 'Fiction';
COUNT(*)
3
Explanation: WHERE keeps only the rows where Genre is 'Fiction': 3 of the 6 rows match (Wings of Fire, Malgudi Days, Train to Pakistan). COUNT(*) counts the rows of the matching rows.
(v)
SELECT Title, LENGTH(Title) FROM BOOK;
Title
LENGTH(Title)
Wings of Fire
13
Malgudi Days
12
Panchatantra
12
Godan
5
Gitanjali
9
Train to Pakistan
17
Explanation: The function LENGTH is worked out for every row that is shown.
E3.7Practice5 marks
Consider the table STUDENT given below. Write SQL commands to:
Add a new row with the values 7, 'Divya', 'Science', 72, 3809.87, '2010-12-15'
Increase the Marks by 100 for the rows where Stream is 'Science'
Delete the rows where Marks is less than 63
Add a new column City of type VARCHAR(20)
Remove the table STUDENT from the database.
Table: STUDENT
RNo
SName
Stream
Marks
Fees
DOB
1
Isha
Science
71
6193.93
2008-08-26
2
Deepak
Science
60
3799.37
2008-11-04
3
Geeta
Science
88
3372.65
2010-03-11
4
Tanvi
Humanities
76
4392.13
2009-02-04
5
Rohan
Commerce
63
3443.29
2008-05-08
6
Umesh
Commerce
85
2597.32
2010-06-25
Answer
(i)
INSERT INTO STUDENT VALUES (7, 'Divya', 'Science', 72, 3809.87, '2010-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE STUDENT SET Marks = Marks + 100 WHERE Stream = 'Science';
Rows affected: 3
Explanation: SET Marks = Marks + 100 changes the value; WHERE limits the change to the rows where Stream is 'Science': 3 rows changed.
(iii)
DELETE FROM STUDENT WHERE Marks < 63;
Rows affected: 1
Explanation: WHERE picks the rows where Marks is less than 63: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE STUDENT ADD City VARCHAR(20);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE STUDENT;
Explanation: DROP removes the whole object with its data.
E3.8Practice5 marks
Consider the table STUDENT given below. Write SQL queries to display:
Each SName and its Fees rounded to the nearest whole number
The rows where SName starts with the letter 'I'
The SName and Marks of the rows where Marks is 71 or less
The total Marks of the rows where Stream is 'Science'
Each SName and the name of the month of DOB.
Table: STUDENT
RNo
SName
Stream
Marks
Fees
DOB
1
Isha
Science
71
6193.93
2008-08-26
2
Deepak
Science
60
3799.37
2008-11-04
3
Geeta
Science
88
3372.65
2010-03-11
4
Tanvi
Humanities
76
4392.13
2009-02-04
5
Rohan
Commerce
63
3443.29
2008-05-08
6
Umesh
Commerce
85
2597.32
2010-06-25
Answer
(i)
SELECT SName, ROUND(Fees) FROM STUDENT;
SName
ROUND(Fees)
Isha
6194
Deepak
3799
Geeta
3373
Tanvi
4392
Rohan
3443
Umesh
2597
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM STUDENT WHERE SName LIKE 'I%';
RNo
SName
Stream
Marks
Fees
DOB
1
Isha
Science
71
6193.93
2008-08-26
Explanation: WHERE keeps only the rows where SName matches the pattern 'I%': 1 of the 6 rows matches (Isha). 'I%' means the value starts with 'I'.
(iii)
SELECT SName, Marks FROM STUDENT WHERE Marks <= 71;
SName
Marks
Isha
71
Deepak
60
Rohan
63
Explanation: WHERE keeps only the rows where Marks is at most 71: 3 of the 6 rows match (Isha, Deepak, Rohan).
(iv)
SELECT SUM(Marks) FROM STUDENT WHERE Stream = 'Science';
SUM(Marks)
219
Explanation: WHERE keeps only the rows where Stream is 'Science': 3 of the 6 rows match (Isha, Deepak, Geeta). SUM adds the values of the matching rows.
(v)
SELECT SName, MONTHNAME(DOB) FROM STUDENT;
SName
MONTHNAME(DOB)
Isha
August
Deepak
November
Geeta
March
Tanvi
February
Rohan
May
Umesh
June
Explanation: The function MONTHNAME is worked out for every row that is shown.
E3.9Practice5 marks
Consider the table PRODUCT given below. Write SQL commands to:
Add a new row with the values 507, 'New Soap', 'Sai Mart', 131, 397.66, '2026-12-15'
Increase the Stock by 5 for the rows where Company is 'Sai Mart'
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE PRODUCT SET Stock = Stock + 5 WHERE Company = 'Sai Mart';
Rows affected: 1
Explanation: SET Stock = Stock + 5 changes the value; WHERE limits the change to the rows where Company is 'Sai Mart': 1 row changed.
(iii)
DELETE FROM PRODUCT WHERE Stock < 40;
Rows affected: 1
Explanation: WHERE picks the rows where Stock is less than 40: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE PRODUCT ADD Remarks VARCHAR(30);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE PRODUCT;
Explanation: DROP removes the whole object with its data.
E3.10Practice5 marks
Consider the table PRODUCT given below. Write SQL queries to display:
Each PName and its Price rounded to one decimal place
The PName that end with the letter 'o'
The PName and Stock of the rows where Stock is 110 or less
The highest and the lowest Price
Each PName and the name of the week day of MfgDate.
Table: PRODUCT
PCode
PName
Company
Stock
Price
MfgDate
501
Soap
Neha Foods
130
114.82
2026-04-27
502
Shampoo
Sai Mart
40
387.16
2026-05-15
503
Biscuit
Neha Foods
110
187.06
2026-07-05
504
Toothpaste
Om Traders
30
275.28
2026-11-16
505
Juice
Neha Foods
120
111.88
2026-11-04
506
Butter
Om Traders
180
293.32
2026-04-27
Answer
(i)
SELECT PName, ROUND(Price, 1) FROM PRODUCT;
PName
ROUND(Price, 1)
Soap
114.8
Shampoo
387.2
Biscuit
187.1
Toothpaste
275.3
Juice
111.9
Butter
293.3
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT PName FROM PRODUCT WHERE PName LIKE '%o';
PName
Shampoo
Explanation: WHERE keeps only the rows where PName matches the pattern '%o': 1 of the 6 rows matches (Shampoo). '%o' means the value ends with 'o'.
(iii)
SELECT PName, Stock FROM PRODUCT WHERE Stock <= 110;
PName
Stock
Shampoo
40
Biscuit
110
Toothpaste
30
Explanation: WHERE keeps only the rows where Stock is at most 110: 3 of the 6 rows match (Shampoo, Biscuit, Toothpaste).
(iv)
SELECT MAX(Price), MIN(Price) FROM PRODUCT;
MAX(Price)
MIN(Price)
387.16
111.88
Explanation: MAX gives the largest value of all the rows. MIN gives the smallest value.
(v)
SELECT PName, DAYNAME(MfgDate) FROM PRODUCT;
PName
DAYNAME(MfgDate)
Soap
Monday
Shampoo
Friday
Biscuit
Sunday
Toothpaste
Monday
Juice
Wednesday
Butter
Monday
Explanation: The function DAYNAME is worked out for every row that is shown.
E3.11Practice5 marks
Consider the table MEMBER given below. Write SQL commands to:
Add a new row with the values 7, 'Isha', 'Gold', 4, 1691.26, '2026-12-15'
Increase the Months by 10 for the rows where Plan is 'Gold'
Delete the rows where Months is less than 4
Add a new column Email of type VARCHAR(40)
Remove the table MEMBER from the database.
Table: MEMBER
MNo
MName
Plan
Months
Fee
JoinDate
1
Mohit
Gold
3
2755.29
2026-07-09
2
Vikas
Gold
9
1680.76
2025-04-25
3
Tanvi
Silver
12
2149.51
2025-01-03
4
Pallavi
Gold
4
1398.78
2026-05-02
5
Divya
Silver
6
2568.09
2025-06-13
6
Aman
Basic
8
2546.01
2026-06-19
Answer
(i)
INSERT INTO MEMBER VALUES (7, 'Isha', 'Gold', 4, 1691.26, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE MEMBER SET Months = Months + 10 WHERE Plan = 'Gold';
Rows affected: 3
Explanation: SET Months = Months + 10 changes the value; WHERE limits the change to the rows where Plan is 'Gold': 3 rows changed.
(iii)
DELETE FROM MEMBER WHERE Months < 4;
Rows affected: 1
Explanation: WHERE picks the rows where Months is less than 4: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE MEMBER ADD Email VARCHAR(40);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE MEMBER;
Explanation: DROP removes the whole object with its data.
E3.12Practice5 marks
Consider the table MEMBER given below. Write SQL queries to display:
Each MName and its Fee rounded to the nearest whole number
The rows where MName starts with the letter 'M'
The MName and Months of the rows where Months is 6 or less
The number of rows where Plan is 'Gold'
The last two characters of each MName.
Table: MEMBER
MNo
MName
Plan
Months
Fee
JoinDate
1
Mohit
Gold
3
2755.29
2026-07-09
2
Vikas
Gold
9
1680.76
2025-04-25
3
Tanvi
Silver
12
2149.51
2025-01-03
4
Pallavi
Gold
4
1398.78
2026-05-02
5
Divya
Silver
6
2568.09
2025-06-13
6
Aman
Basic
8
2546.01
2026-06-19
Answer
(i)
SELECT MName, ROUND(Fee) FROM MEMBER;
MName
ROUND(Fee)
Mohit
2755
Vikas
1681
Tanvi
2150
Pallavi
1399
Divya
2568
Aman
2546
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM MEMBER WHERE MName LIKE 'M%';
MNo
MName
Plan
Months
Fee
JoinDate
1
Mohit
Gold
3
2755.29
2026-07-09
Explanation: WHERE keeps only the rows where MName matches the pattern 'M%': 1 of the 6 rows matches (Mohit). 'M%' means the value starts with 'M'.
(iii)
SELECT MName, Months FROM MEMBER WHERE Months <= 6;
MName
Months
Mohit
3
Pallavi
4
Divya
6
Explanation: WHERE keeps only the rows where Months is at most 6: 3 of the 6 rows match (Mohit, Pallavi, Divya).
(iv)
SELECT COUNT(*) FROM MEMBER WHERE Plan = 'Gold';
COUNT(*)
3
Explanation: WHERE keeps only the rows where Plan is 'Gold': 3 of the 6 rows match (Mohit, Vikas, Pallavi). COUNT(*) counts the rows of the matching rows.
(v)
SELECT RIGHT(MName, 2) FROM MEMBER;
RIGHT(MName, 2)
it
as
vi
vi
ya
an
Explanation: The function RIGHT is worked out for every row that is shown.
E3.13Practice5 marks
Consider the table TICKET given below. Write SQL commands to:
Add a new row with the values 307, 'Kavita', 'Goa', 4, 6838.96, '2027-12-15'
Increase the Seats by 2 for the rows where Dest is 'Goa'
Delete the rows where Seats is less than 3
Add a new column Grade of type CHAR(1)
Remove the table TICKET from the database.
Table: TICKET
TNo
Passenger
Dest
Seats
Fare
TravelDate
301
Anita
Goa
3
9384.04
2026-01-28
302
Bhavna
Goa
3
6828.46
2026-03-11
303
Simran
Kochi
6
8802.73
2026-04-28
304
Aman
Kochi
4
6806.37
2026-10-14
305
Jatin
Goa
2
4173.89
2027-05-03
306
Sonal
Leh
5
9385.63
2026-12-18
Answer
(i)
INSERT INTO TICKET VALUES (307, 'Kavita', 'Goa', 4, 6838.96, '2027-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE TICKET SET Seats = Seats + 2 WHERE Dest = 'Goa';
Rows affected: 3
Explanation: SET Seats = Seats + 2 changes the value; WHERE limits the change to the rows where Dest is 'Goa': 3 rows changed.
(iii)
DELETE FROM TICKET WHERE Seats < 3;
Rows affected: 1
Explanation: WHERE picks the rows where Seats is less than 3: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE TICKET ADD Grade CHAR(1);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE TICKET;
Explanation: DROP removes the whole object with its data.
E3.14Practice5 marks
Consider the table TICKET given below. Write SQL queries to display:
Each Passenger and its Fare rounded to one decimal place
The Passenger that end with the letter 'a'
The Passenger and Seats of the rows where Seats is 3 or less
The total Seats of the rows where Dest is 'Goa'
The first three characters of each Passenger.
Table: TICKET
TNo
Passenger
Dest
Seats
Fare
TravelDate
301
Anita
Goa
3
9384.04
2026-01-28
302
Bhavna
Goa
3
6828.46
2026-03-11
303
Simran
Kochi
6
8802.73
2026-04-28
304
Aman
Kochi
4
6806.37
2026-10-14
305
Jatin
Goa
2
4173.89
2027-05-03
306
Sonal
Leh
5
9385.63
2026-12-18
Answer
(i)
SELECT Passenger, ROUND(Fare, 1) FROM TICKET;
Passenger
ROUND(Fare, 1)
Anita
9384.0
Bhavna
6828.5
Simran
8802.7
Aman
6806.4
Jatin
4173.9
Sonal
9385.6
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT Passenger FROM TICKET WHERE Passenger LIKE '%a';
Passenger
Anita
Bhavna
Explanation: WHERE keeps only the rows where Passenger matches the pattern '%a': 2 of the 6 rows match (Anita, Bhavna). '%a' means the value ends with 'a'.
(iii)
SELECT Passenger, Seats FROM TICKET WHERE Seats <= 3;
Passenger
Seats
Anita
3
Bhavna
3
Jatin
2
Explanation: WHERE keeps only the rows where Seats is at most 3: 3 of the 6 rows match (Anita, Bhavna, Jatin).
(iv)
SELECT SUM(Seats) FROM TICKET WHERE Dest = 'Goa';
SUM(Seats)
8
Explanation: WHERE keeps only the rows where Dest is 'Goa': 3 of the 6 rows match (Anita, Bhavna, Jatin). SUM adds the values of the matching rows.
(v)
SELECT LEFT(Passenger, 3) FROM TICKET;
LEFT(Passenger, 3)
Ani
Bha
Sim
Ama
Jat
Son
Explanation: The function LEFT is worked out for every row that is shown.
E3.15Practice5 marks
Consider the table MOVIE given below. Write SQL commands to:
Add a new row with the values 7, 'New Udaan', 'Comedy', 171, 18.02, '2026-12-15'
Increase the Minutes by 100 for the rows where Genre is 'Comedy'
Delete the rows where Minutes is less than 115
Add a new column City of type VARCHAR(20)
Remove the table MOVIE from the database.
Table: MOVIE
MNo
Title
Genre
Minutes
Rating
RelDate
1
Udaan
Comedy
170
8.54
2026-03-24
2
Safar
Comedy
145
7.52
2024-08-10
3
Dosti
Drama
125
6.87
2023-12-27
4
Rangoli
Comedy
130
5.11
2023-10-16
5
Khel
Action
105
6.83
2024-12-18
6
Sapna
Action
115
5.33
2024-12-07
Answer
(i)
INSERT INTO MOVIE VALUES (7, 'New Udaan', 'Comedy', 171, 18.02, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE MOVIE SET Minutes = Minutes + 100 WHERE Genre = 'Comedy';
Rows affected: 3
Explanation: SET Minutes = Minutes + 100 changes the value; WHERE limits the change to the rows where Genre is 'Comedy': 3 rows changed.
(iii)
DELETE FROM MOVIE WHERE Minutes < 115;
Rows affected: 1
Explanation: WHERE picks the rows where Minutes is less than 115: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE MOVIE ADD City VARCHAR(20);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE MOVIE;
Explanation: DROP removes the whole object with its data.
E3.16Practice5 marks
Consider the table MOVIE given below. Write SQL queries to display:
Each Title and its Rating rounded to the nearest whole number
The rows where Title starts with the letter 'U'
The Title and Minutes of the rows where Minutes is 125 or less
The highest and the lowest Rating
The Title in capital letters.
Table: MOVIE
MNo
Title
Genre
Minutes
Rating
RelDate
1
Udaan
Comedy
170
8.54
2026-03-24
2
Safar
Comedy
145
7.52
2024-08-10
3
Dosti
Drama
125
6.87
2023-12-27
4
Rangoli
Comedy
130
5.11
2023-10-16
5
Khel
Action
105
6.83
2024-12-18
6
Sapna
Action
115
5.33
2024-12-07
Answer
(i)
SELECT Title, ROUND(Rating) FROM MOVIE;
Title
ROUND(Rating)
Udaan
9
Safar
8
Dosti
7
Rangoli
5
Khel
7
Sapna
5
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM MOVIE WHERE Title LIKE 'U%';
MNo
Title
Genre
Minutes
Rating
RelDate
1
Udaan
Comedy
170
8.54
2026-03-24
Explanation: WHERE keeps only the rows where Title matches the pattern 'U%': 1 of the 6 rows matches (Udaan). 'U%' means the value starts with 'U'.
(iii)
SELECT Title, Minutes FROM MOVIE WHERE Minutes <= 125;
Title
Minutes
Dosti
125
Khel
105
Sapna
115
Explanation: WHERE keeps only the rows where Minutes is at most 125: 3 of the 6 rows match (Dosti, Khel, Sapna).
(iv)
SELECT MAX(Rating), MIN(Rating) FROM MOVIE;
MAX(Rating)
MIN(Rating)
8.54
5.11
Explanation: MAX gives the largest value of all the rows. MIN gives the smallest value.
(v)
SELECT UCASE(Title) FROM MOVIE;
UCASE(Title)
UDAAN
SAFAR
DOSTI
RANGOLI
KHEL
SAPNA
Explanation: The function UCASE is worked out for every row that is shown.
E3.17Practice5 marks
Consider the table COURSE given below. Write SQL commands to:
Add a new row with the values 27, 'New Python', 'Offline', 7, 3030.63, '2027-12-15'
Increase the Weeks by 5 for the rows where Mode is 'Offline'
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE COURSE SET Weeks = Weeks + 5 WHERE Mode = 'Offline';
Rows affected: 1
Explanation: SET Weeks = Weeks + 5 changes the value; WHERE limits the change to the rows where Mode is 'Offline': 1 row changed.
(iii)
DELETE FROM COURSE WHERE Weeks < 6;
Rows affected: 1
Explanation: WHERE picks the rows where Weeks is less than 6: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE COURSE ADD Remarks VARCHAR(30);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE COURSE;
Explanation: DROP removes the whole object with its data.
E3.18Practice5 marks
Consider the table COURSE given below. Write SQL queries to display:
Each CName and its Fee rounded to one decimal place
The CName that end with the letter 'n'
The CName and Weeks of the rows where Weeks is 8 or less
The number of rows where Mode is 'Online'
Each CName and the number of characters in it.
Table: COURSE
CNo
CName
Mode
Weeks
Fee
StartDate
21
Python
Online
6
8375.41
2026-06-06
22
Web Design
Offline
8
3020.13
2026-10-13
23
Tally
Online
10
4826.35
2027-03-23
24
Animation
Hybrid
22
8778.76
2026-11-11
25
Robotics
Hybrid
4
6911.58
2026-09-27
26
Data Entry
Online
24
9871.53
2027-11-05
Answer
(i)
SELECT CName, ROUND(Fee, 1) FROM COURSE;
CName
ROUND(Fee, 1)
Python
8375.4
Web Design
3020.1
Tally
4826.4
Animation
8778.8
Robotics
6911.6
Data Entry
9871.5
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT CName FROM COURSE WHERE CName LIKE '%n';
CName
Python
Web Design
Animation
Explanation: WHERE keeps only the rows where CName matches the pattern '%n': 3 of the 6 rows match (Python, Web Design, Animation). '%n' means the value ends with 'n'.
(iii)
SELECT CName, Weeks FROM COURSE WHERE Weeks <= 8;
CName
Weeks
Python
6
Web Design
8
Robotics
4
Explanation: WHERE keeps only the rows where Weeks is at most 8: 3 of the 6 rows match (Python, Web Design, Robotics).
(iv)
SELECT COUNT(*) FROM COURSE WHERE Mode = 'Online';
COUNT(*)
3
Explanation: WHERE keeps only the rows where Mode is 'Online': 3 of the 6 rows match (Python, Tally, Data Entry). COUNT(*) counts the rows of the matching rows.
(v)
SELECT CName, LENGTH(CName) FROM COURSE;
CName
LENGTH(CName)
Python
6
Web Design
10
Tally
5
Animation
9
Robotics
8
Data Entry
10
Explanation: The function LENGTH is worked out for every row that is shown.
E3.19Practice5 marks
Consider the table VEHICLE given below. Write SQL commands to:
Add a new row with the values 707, 'Lokesh', 'Van', 14501, 2232.57, '2025-12-15'
Increase the Km by 500 for the rows where Type is 'Van'
Delete the rows where Km is less than 15500
Add a new column Email of type VARCHAR(40)
Remove the table VEHICLE from the database.
Table: VEHICLE
VNo
Owner
Type
Km
Tax
RegDate
701
Yash
Bike
14500
2852.03
2019-01-09
702
Shreya
Van
59000
2222.07
2023-01-21
703
Simran
Car
27500
2206.18
2018-07-13
704
Swati
Van
25500
1253.91
2020-12-12
705
Sandeep
Car
54000
2275.81
2025-01-14
706
Aman
Car
15500
1981.68
2018-12-01
Answer
(i)
INSERT INTO VEHICLE VALUES (707, 'Lokesh', 'Van', 14501, 2232.57, '2025-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE VEHICLE SET Km = Km + 500 WHERE Type = 'Van';
Rows affected: 2
Explanation: SET Km = Km + 500 changes the value; WHERE limits the change to the rows where Type is 'Van': 2 rows changed.
(iii)
DELETE FROM VEHICLE WHERE Km < 15500;
Rows affected: 1
Explanation: WHERE picks the rows where Km is less than 15500: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE VEHICLE ADD Email VARCHAR(40);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE VEHICLE;
Explanation: DROP removes the whole object with its data.
E3.20Practice5 marks
Consider the table VEHICLE given below. Write SQL queries to display:
Each Owner and its Tax rounded to the nearest whole number
The rows where Owner starts with the letter 'Y'
The Owner and Km of the rows where Km is 25500 or less
The total Km of the rows where Type is 'Bike'
Each Owner and the name of the month of RegDate.
Table: VEHICLE
VNo
Owner
Type
Km
Tax
RegDate
701
Yash
Bike
14500
2852.03
2019-01-09
702
Shreya
Van
59000
2222.07
2023-01-21
703
Simran
Car
27500
2206.18
2018-07-13
704
Swati
Van
25500
1253.91
2020-12-12
705
Sandeep
Car
54000
2275.81
2025-01-14
706
Aman
Car
15500
1981.68
2018-12-01
Answer
(i)
SELECT Owner, ROUND(Tax) FROM VEHICLE;
Owner
ROUND(Tax)
Yash
2852
Shreya
2222
Simran
2206
Swati
1254
Sandeep
2276
Aman
1982
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM VEHICLE WHERE Owner LIKE 'Y%';
VNo
Owner
Type
Km
Tax
RegDate
701
Yash
Bike
14500
2852.03
2019-01-09
Explanation: WHERE keeps only the rows where Owner matches the pattern 'Y%': 1 of the 6 rows matches (Yash). 'Y%' means the value starts with 'Y'.
(iii)
SELECT Owner, Km FROM VEHICLE WHERE Km <= 25500;
Owner
Km
Yash
14500
Swati
25500
Aman
15500
Explanation: WHERE keeps only the rows where Km is at most 25500: 3 of the 6 rows match (Yash, Swati, Aman).
(iv)
SELECT SUM(Km) FROM VEHICLE WHERE Type = 'Bike';
SUM(Km)
14500
Explanation: WHERE keeps only the rows where Type is 'Bike': 1 of the 6 rows matches (Yash). SUM adds the values of the matching rows.
(v)
SELECT Owner, MONTHNAME(RegDate) FROM VEHICLE;
Owner
MONTHNAME(RegDate)
Yash
January
Shreya
January
Simran
July
Swati
December
Sandeep
January
Aman
December
Explanation: The function MONTHNAME is worked out for every row that is shown.
E3.21Practice5 marks
Consider the table ORDERS given below. Write SQL commands to:
Add a new row with the values 9007, 'Naveen', 'Agra', 6, 7672.53, '2026-12-15'
Increase the Qty by 2 for the rows where City is 'Agra'
Delete the rows where Qty is less than 5
Add a new column Grade of type CHAR(1)
Remove the table ORDERS from the database.
Table: ORDERS
ONo
Customer
City
Qty
Amount
ODate
9001
Harish
Delhi
5
6729.59
2026-06-22
9002
Pallavi
Agra
3
7662.03
2026-10-28
9003
Yash
Pune
11
561.13
2026-11-22
9004
Arjun
Pune
12
4746.24
2026-04-01
9005
Nikhil
Delhi
13
3876.23
2026-04-20
9006
Farhan
Delhi
6
6568.18
2026-03-14
Answer
(i)
INSERT INTO ORDERS VALUES (9007, 'Naveen', 'Agra', 6, 7672.53, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE ORDERS SET Qty = Qty + 2 WHERE City = 'Agra';
Rows affected: 1
Explanation: SET Qty = Qty + 2 changes the value; WHERE limits the change to the rows where City is 'Agra': 1 row changed.
(iii)
DELETE FROM ORDERS WHERE Qty < 5;
Rows affected: 1
Explanation: WHERE picks the rows where Qty is less than 5: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE ORDERS ADD Grade CHAR(1);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE ORDERS;
Explanation: DROP removes the whole object with its data.
E3.22Practice5 marks
Consider the table ORDERS given below. Write SQL queries to display:
Each Customer and its Amount rounded to one decimal place
The Customer that end with the letter 'i'
The Customer and Qty of the rows where Qty is 6 or less
The highest and the lowest Amount
Each Customer and the name of the week day of ODate.
Table: ORDERS
ONo
Customer
City
Qty
Amount
ODate
9001
Harish
Delhi
5
6729.59
2026-06-22
9002
Pallavi
Agra
3
7662.03
2026-10-28
9003
Yash
Pune
11
561.13
2026-11-22
9004
Arjun
Pune
12
4746.24
2026-04-01
9005
Nikhil
Delhi
13
3876.23
2026-04-20
9006
Farhan
Delhi
6
6568.18
2026-03-14
Answer
(i)
SELECT Customer, ROUND(Amount, 1) FROM ORDERS;
Customer
ROUND(Amount, 1)
Harish
6729.6
Pallavi
7662.0
Yash
561.1
Arjun
4746.2
Nikhil
3876.2
Farhan
6568.2
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT Customer FROM ORDERS WHERE Customer LIKE '%i';
Customer
Pallavi
Explanation: WHERE keeps only the rows where Customer matches the pattern '%i': 1 of the 6 rows matches (Pallavi). '%i' means the value ends with 'i'.
(iii)
SELECT Customer, Qty FROM ORDERS WHERE Qty <= 6;
Customer
Qty
Harish
5
Pallavi
3
Farhan
6
Explanation: WHERE keeps only the rows where Qty is at most 6: 3 of the 6 rows match (Harish, Pallavi, Farhan).
(iv)
SELECT MAX(Amount), MIN(Amount) FROM ORDERS;
MAX(Amount)
MIN(Amount)
7662.03
561.13
Explanation: MAX gives the largest value of all the rows. MIN gives the smallest value.
(v)
SELECT Customer, DAYNAME(ODate) FROM ORDERS;
Customer
DAYNAME(ODate)
Harish
Monday
Pallavi
Wednesday
Yash
Sunday
Arjun
Wednesday
Nikhil
Monday
Farhan
Saturday
Explanation: The function DAYNAME is worked out for every row that is shown.
E3.23Practice5 marks
Consider the table DOCTOR given below. Write SQL commands to:
Add a new row with the values 7, 'Pankaj', 'Skin', 6, 1061.59, '2022-12-15'
Increase the Exp by 100 for the rows where Spec is 'Skin'
Delete the rows where Exp is less than 5
Add a new column City of type VARCHAR(20)
Remove the table DOCTOR from the database.
Table: DOCTOR
DNo
DName
Spec
Exp
Fee
DOJ
1
Anita
Dental
5
436.84
2022-09-22
2
Ojasvi
Skin
23
1051.09
2012-07-22
3
Nikhil
Eye
2
1178.34
2021-05-22
4
Meenal
Skin
14
1100.17
2020-08-28
5
Naveen
Dental
12
1207.47
2014-01-06
6
Vikas
Skin
6
435.16
2017-06-04
Answer
(i)
INSERT INTO DOCTOR VALUES (7, 'Pankaj', 'Skin', 6, 1061.59, '2022-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE DOCTOR SET Exp = Exp + 100 WHERE Spec = 'Skin';
Rows affected: 3
Explanation: SET Exp = Exp + 100 changes the value; WHERE limits the change to the rows where Spec is 'Skin': 3 rows changed.
(iii)
DELETE FROM DOCTOR WHERE Exp < 5;
Rows affected: 1
Explanation: WHERE picks the rows where Exp is less than 5: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE DOCTOR ADD City VARCHAR(20);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE DOCTOR;
Explanation: DROP removes the whole object with its data.
E3.24Practice5 marks
Consider the table DOCTOR given below. Write SQL queries to display:
Each DName and its Fee rounded to the nearest whole number
The rows where DName starts with the letter 'A'
The DName and Exp of the rows where Exp is 6 or less
The number of rows where Spec is 'Dental'
The last two characters of each DName.
Table: DOCTOR
DNo
DName
Spec
Exp
Fee
DOJ
1
Anita
Dental
5
436.84
2022-09-22
2
Ojasvi
Skin
23
1051.09
2012-07-22
3
Nikhil
Eye
2
1178.34
2021-05-22
4
Meenal
Skin
14
1100.17
2020-08-28
5
Naveen
Dental
12
1207.47
2014-01-06
6
Vikas
Skin
6
435.16
2017-06-04
Answer
(i)
SELECT DName, ROUND(Fee) FROM DOCTOR;
DName
ROUND(Fee)
Anita
437
Ojasvi
1051
Nikhil
1178
Meenal
1100
Naveen
1207
Vikas
435
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM DOCTOR WHERE DName LIKE 'A%';
DNo
DName
Spec
Exp
Fee
DOJ
1
Anita
Dental
5
436.84
2022-09-22
Explanation: WHERE keeps only the rows where DName matches the pattern 'A%': 1 of the 6 rows matches (Anita). 'A%' means the value starts with 'A'.
(iii)
SELECT DName, Exp FROM DOCTOR WHERE Exp <= 6;
DName
Exp
Anita
5
Nikhil
2
Vikas
6
Explanation: WHERE keeps only the rows where Exp is at most 6: 3 of the 6 rows match (Anita, Nikhil, Vikas).
(iv)
SELECT COUNT(*) FROM DOCTOR WHERE Spec = 'Dental';
COUNT(*)
2
Explanation: WHERE keeps only the rows where Spec is 'Dental': 2 of the 6 rows match (Anita, Naveen). COUNT(*) counts the rows of the matching rows.
(v)
SELECT RIGHT(DName, 2) FROM DOCTOR;
RIGHT(DName, 2)
ta
vi
il
al
en
as
Explanation: The function RIGHT is worked out for every row that is shown.
E3.25Practice5 marks
Consider the table PLAYER given below. Write SQL commands to:
Add a new row with the values 7, 'Pankaj', 'Chess', 36, 58.99, '2010-12-15'
Increase the Matches by 5 for the rows where Game is 'Chess'
Delete the rows where Matches is less than 24
Add a new column Remarks of type VARCHAR(30)
Remove the table PLAYER from the database.
Table: PLAYER
PNo
PName
Game
Matches
Average
DOB
1
Nisha
Cricket
35
39.93
2007-12-23
2
Rachna
Chess
44
48.49
2009-10-21
3
Meenal
Cricket
19
62.94
2010-04-10
4
Nikhil
Cricket
51
40.51
2006-12-17
5
Harish
Hockey
24
31.15
2010-08-13
6
Zeenat
Hockey
36
29.33
2009-07-23
Answer
(i)
INSERT INTO PLAYER VALUES (7, 'Pankaj', 'Chess', 36, 58.99, '2010-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE PLAYER SET Matches = Matches + 5 WHERE Game = 'Chess';
Rows affected: 1
Explanation: SET Matches = Matches + 5 changes the value; WHERE limits the change to the rows where Game is 'Chess': 1 row changed.
(iii)
DELETE FROM PLAYER WHERE Matches < 24;
Rows affected: 1
Explanation: WHERE picks the rows where Matches is less than 24: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE PLAYER ADD Remarks VARCHAR(30);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE PLAYER;
Explanation: DROP removes the whole object with its data.
E3.26Practice5 marks
Consider the table PLAYER given below. Write SQL queries to display:
Each PName and its Average rounded to one decimal place
The PName that end with the letter 'a'
The PName and Matches of the rows where Matches is 35 or less
The total Matches of the rows where Game is 'Cricket'
The first three characters of each PName.
Table: PLAYER
PNo
PName
Game
Matches
Average
DOB
1
Nisha
Cricket
35
39.93
2007-12-23
2
Rachna
Chess
44
48.49
2009-10-21
3
Meenal
Cricket
19
62.94
2010-04-10
4
Nikhil
Cricket
51
40.51
2006-12-17
5
Harish
Hockey
24
31.15
2010-08-13
6
Zeenat
Hockey
36
29.33
2009-07-23
Answer
(i)
SELECT PName, ROUND(Average, 1) FROM PLAYER;
PName
ROUND(Average, 1)
Nisha
39.9
Rachna
48.5
Meenal
62.9
Nikhil
40.5
Harish
31.2
Zeenat
29.3
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT PName FROM PLAYER WHERE PName LIKE '%a';
PName
Nisha
Rachna
Explanation: WHERE keeps only the rows where PName matches the pattern '%a': 2 of the 6 rows match (Nisha, Rachna). '%a' means the value ends with 'a'.
(iii)
SELECT PName, Matches FROM PLAYER WHERE Matches <= 35;
PName
Matches
Nisha
35
Meenal
19
Harish
24
Explanation: WHERE keeps only the rows where Matches is at most 35: 3 of the 6 rows match (Nisha, Meenal, Harish).
(iv)
SELECT SUM(Matches) FROM PLAYER WHERE Game = 'Cricket';
SUM(Matches)
105
Explanation: WHERE keeps only the rows where Game is 'Cricket': 3 of the 6 rows match (Nisha, Meenal, Nikhil). SUM adds the values of the matching rows.
(v)
SELECT LEFT(PName, 3) FROM PLAYER;
LEFT(PName, 3)
Nis
Rac
Mee
Nik
Har
Zee
Explanation: The function LEFT is worked out for every row that is shown.
E3.27Practice5 marks
Consider the table HOSTEL given below. Write SQL commands to:
Add a new row with the values 7, 'Tanvi', 'Ganga', 165, 2324.76, '2026-12-15'
Increase the Room by 10 for the rows where Block is 'Ganga'
Delete the rows where Room is less than 111
Add a new column Email of type VARCHAR(40)
Remove the table HOSTEL from the database.
Table: HOSTEL
HNo
SName
Block
Room
Mess
DOA
1
Chetan
Yamuna
164
3027.92
2026-06-19
2
Rohan
Ganga
134
2314.26
2026-12-15
3
Swati
Kaveri
279
2306.82
2025-09-22
4
Harish
Ganga
250
1867.61
2025-10-10
5
Naveen
Yamuna
111
2282.33
2025-06-13
6
Aman
Ganga
101
2423.74
2026-07-10
Answer
(i)
INSERT INTO HOSTEL VALUES (7, 'Tanvi', 'Ganga', 165, 2324.76, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE HOSTEL SET Room = Room + 10 WHERE Block = 'Ganga';
Rows affected: 3
Explanation: SET Room = Room + 10 changes the value; WHERE limits the change to the rows where Block is 'Ganga': 3 rows changed.
(iii)
DELETE FROM HOSTEL WHERE Room < 111;
Rows affected: 1
Explanation: WHERE picks the rows where Room is less than 111: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE HOSTEL ADD Email VARCHAR(40);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE HOSTEL;
Explanation: DROP removes the whole object with its data.
E3.28Practice5 marks
Consider the table HOSTEL given below. Write SQL queries to display:
Each SName and its Mess rounded to the nearest whole number
The rows where SName starts with the letter 'C'
The SName and Room of the rows where Room is 134 or less
The highest and the lowest Mess
The SName in capital letters.
Table: HOSTEL
HNo
SName
Block
Room
Mess
DOA
1
Chetan
Yamuna
164
3027.92
2026-06-19
2
Rohan
Ganga
134
2314.26
2026-12-15
3
Swati
Kaveri
279
2306.82
2025-09-22
4
Harish
Ganga
250
1867.61
2025-10-10
5
Naveen
Yamuna
111
2282.33
2025-06-13
6
Aman
Ganga
101
2423.74
2026-07-10
Answer
(i)
SELECT SName, ROUND(Mess) FROM HOSTEL;
SName
ROUND(Mess)
Chetan
3028
Rohan
2314
Swati
2307
Harish
1868
Naveen
2282
Aman
2424
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM HOSTEL WHERE SName LIKE 'C%';
HNo
SName
Block
Room
Mess
DOA
1
Chetan
Yamuna
164
3027.92
2026-06-19
Explanation: WHERE keeps only the rows where SName matches the pattern 'C%': 1 of the 6 rows matches (Chetan). 'C%' means the value starts with 'C'.
(iii)
SELECT SName, Room FROM HOSTEL WHERE Room <= 134;
SName
Room
Rohan
134
Naveen
111
Aman
101
Explanation: WHERE keeps only the rows where Room is at most 134: 3 of the 6 rows match (Rohan, Naveen, Aman).
(iv)
SELECT MAX(Mess), MIN(Mess) FROM HOSTEL;
MAX(Mess)
MIN(Mess)
3027.92
1867.61
Explanation: MAX gives the largest value of all the rows. MIN gives the smallest value.
(v)
SELECT UCASE(SName) FROM HOSTEL;
UCASE(SName)
CHETAN
ROHAN
SWATI
HARISH
NAVEEN
AMAN
Explanation: The function UCASE is worked out for every row that is shown.
E3.29Practice5 marks
Consider the table LOAN given below. Write SQL commands to:
Add a new row with the values 7, 'Tanvi', 'Home', 20, 19.52, '2026-12-15'
Increase the Years by 2 for the rows where Type is 'Home'
Delete the rows where Years is less than 3
Add a new column Grade of type CHAR(1)
Remove the table LOAN from the database.
Table: LOAN
LNo
CName
Type
Years
Rate
StartDate
1
Divya
Education
19
11.17
2020-11-18
2
Sachin
Home
3
9.02
2022-04-01
3
Naveen
Car
12
9.46
2023-07-07
4
Sandeep
Car
2
9.92
2026-03-01
5
Umesh
Home
10
10.25
2021-02-05
6
Ritu
Home
17
8.62
2025-08-06
Answer
(i)
INSERT INTO LOAN VALUES (7, 'Tanvi', 'Home', 20, 19.52, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE LOAN SET Years = Years + 2 WHERE Type = 'Home';
Rows affected: 3
Explanation: SET Years = Years + 2 changes the value; WHERE limits the change to the rows where Type is 'Home': 3 rows changed.
(iii)
DELETE FROM LOAN WHERE Years < 3;
Rows affected: 1
Explanation: WHERE picks the rows where Years is less than 3: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE LOAN ADD Grade CHAR(1);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE LOAN;
Explanation: DROP removes the whole object with its data.
E3.30Practice5 marks
Consider the table LOAN given below. Write SQL queries to display:
Each CName and its Rate rounded to one decimal place
The CName that end with the letter 'n'
The CName and Years of the rows where Years is 10 or less
The number of rows where Type is 'Education'
Each CName and the number of characters in it.
Table: LOAN
LNo
CName
Type
Years
Rate
StartDate
1
Divya
Education
19
11.17
2020-11-18
2
Sachin
Home
3
9.02
2022-04-01
3
Naveen
Car
12
9.46
2023-07-07
4
Sandeep
Car
2
9.92
2026-03-01
5
Umesh
Home
10
10.25
2021-02-05
6
Ritu
Home
17
8.62
2025-08-06
Answer
(i)
SELECT CName, ROUND(Rate, 1) FROM LOAN;
CName
ROUND(Rate, 1)
Divya
11.2
Sachin
9.0
Naveen
9.5
Sandeep
9.9
Umesh
10.3
Ritu
8.6
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT CName FROM LOAN WHERE CName LIKE '%n';
CName
Sachin
Naveen
Explanation: WHERE keeps only the rows where CName matches the pattern '%n': 2 of the 6 rows match (Sachin, Naveen). '%n' means the value ends with 'n'.
(iii)
SELECT CName, Years FROM LOAN WHERE Years <= 10;
CName
Years
Sachin
3
Sandeep
2
Umesh
10
Explanation: WHERE keeps only the rows where Years is at most 10: 3 of the 6 rows match (Sachin, Sandeep, Umesh).
(iv)
SELECT COUNT(*) FROM LOAN WHERE Type = 'Education';
COUNT(*)
1
Explanation: WHERE keeps only the rows where Type is 'Education': 1 of the 6 rows matches (Divya). COUNT(*) counts the rows of the matching rows.
(v)
SELECT CName, LENGTH(CName) FROM LOAN;
CName
LENGTH(CName)
Divya
5
Sachin
6
Naveen
6
Sandeep
7
Umesh
5
Ritu
4
Explanation: The function LENGTH is worked out for every row that is shown.
E3.31Practice5 marks
Consider the table STAFF given below. Write SQL commands to:
Add a new row with the values 7, 'Vandana', 'PGT', 22, 5327.17, '2023-12-15'
Increase the Periods by 100 for the rows where Post is 'PGT'
Delete the rows where Periods is less than 21
Add a new column City of type VARCHAR(20)
Remove the table STAFF from the database.
Table: STAFF
SNo
SName
Post
Periods
Allowance
DOJ
1
Rachna
TGT
21
6326.05
2023-07-03
2
Meenal
PGT
31
5316.67
2023-02-03
3
Sandeep
PGT
18
3601.57
2015-03-06
4
Yash
PGT
25
6358.03
2011-05-26
5
Ritu
PRT
30
5793.03
2022-08-12
6
Farhan
TGT
33
5942.38
2014-11-17
Answer
(i)
INSERT INTO STAFF VALUES (7, 'Vandana', 'PGT', 22, 5327.17, '2023-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE STAFF SET Periods = Periods + 100 WHERE Post = 'PGT';
Rows affected: 3
Explanation: SET Periods = Periods + 100 changes the value; WHERE limits the change to the rows where Post is 'PGT': 3 rows changed.
(iii)
DELETE FROM STAFF WHERE Periods < 21;
Rows affected: 1
Explanation: WHERE picks the rows where Periods is less than 21: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE STAFF ADD City VARCHAR(20);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE STAFF;
Explanation: DROP removes the whole object with its data.
E3.32Practice5 marks
Consider the table STAFF given below. Write SQL queries to display:
Each SName and its Allowance rounded to the nearest whole number
The rows where SName starts with the letter 'R'
The SName and Periods of the rows where Periods is 25 or less
The total Periods of the rows where Post is 'TGT'
Each SName and the name of the month of DOJ.
Table: STAFF
SNo
SName
Post
Periods
Allowance
DOJ
1
Rachna
TGT
21
6326.05
2023-07-03
2
Meenal
PGT
31
5316.67
2023-02-03
3
Sandeep
PGT
18
3601.57
2015-03-06
4
Yash
PGT
25
6358.03
2011-05-26
5
Ritu
PRT
30
5793.03
2022-08-12
6
Farhan
TGT
33
5942.38
2014-11-17
Answer
(i)
SELECT SName, ROUND(Allowance) FROM STAFF;
SName
ROUND(Allowance)
Rachna
6326
Meenal
5317
Sandeep
3602
Yash
6358
Ritu
5793
Farhan
5942
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM STAFF WHERE SName LIKE 'R%';
SNo
SName
Post
Periods
Allowance
DOJ
1
Rachna
TGT
21
6326.05
2023-07-03
5
Ritu
PRT
30
5793.03
2022-08-12
Explanation: WHERE keeps only the rows where SName matches the pattern 'R%': 2 of the 6 rows match (Rachna, Ritu). 'R%' means the value starts with 'R'.
(iii)
SELECT SName, Periods FROM STAFF WHERE Periods <= 25;
SName
Periods
Rachna
21
Sandeep
18
Yash
25
Explanation: WHERE keeps only the rows where Periods is at most 25: 3 of the 6 rows match (Rachna, Sandeep, Yash).
(iv)
SELECT SUM(Periods) FROM STAFF WHERE Post = 'TGT';
SUM(Periods)
54
Explanation: WHERE keeps only the rows where Post is 'TGT': 2 of the 6 rows match (Rachna, Farhan). SUM adds the values of the matching rows.
(v)
SELECT SName, MONTHNAME(DOJ) FROM STAFF;
SName
MONTHNAME(DOJ)
Rachna
July
Meenal
February
Sandeep
March
Yash
May
Ritu
August
Farhan
November
Explanation: The function MONTHNAME is worked out for every row that is shown.
E3.33Practice5 marks
Consider the table GARMENT given below. Write SQL commands to:
Add a new row with the values 16, 'New Shirt', 'Silk', 16, 3046.13, '2026-12-15'
Increase the Stock by 5 for the rows where Fabric is 'Silk'
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE EVENT SET Points = Points + 10 WHERE House = 'Raman';
Rows affected: 2
Explanation: SET Points = Points + 10 changes the value; WHERE limits the change to the rows where House is 'Raman': 2 rows changed.
(iii)
DELETE FROM EVENT WHERE Points < 55;
Rows affected: 1
Explanation: WHERE picks the rows where Points is less than 55: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE EVENT ADD Email VARCHAR(40);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE EVENT;
Explanation: DROP removes the whole object with its data.
E3.36Practice5 marks
Consider the table EVENT given below. Write SQL queries to display:
Each EName and its Prize rounded to the nearest whole number
The rows where EName starts with the letter 'D'
The EName and Points of the rows where Points is 60 or less
The number of rows where House is 'Shivaji'
The last two characters of each EName.
Table: EVENT
ENo
EName
House
Points
Prize
EDate
1
Debate
Shivaji
30
2874.63
2026-07-02
2
Quiz
Raman
100
2924.74
2026-07-15
3
Dance
Shivaji
60
2767.11
2026-02-14
4
Drama
Raman
55
2300.04
2026-12-19
5
Painting
Shivaji
95
4017.09
2026-08-25
6
Singing
Tagore
75
1901.59
2026-10-04
Answer
(i)
SELECT EName, ROUND(Prize) FROM EVENT;
EName
ROUND(Prize)
Debate
2875
Quiz
2925
Dance
2767
Drama
2300
Painting
4017
Singing
1902
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM EVENT WHERE EName LIKE 'D%';
ENo
EName
House
Points
Prize
EDate
1
Debate
Shivaji
30
2874.63
2026-07-02
3
Dance
Shivaji
60
2767.11
2026-02-14
4
Drama
Raman
55
2300.04
2026-12-19
Explanation: WHERE keeps only the rows where EName matches the pattern 'D%': 3 of the 6 rows match (Debate, Dance, Drama). 'D%' means the value starts with 'D'.
(iii)
SELECT EName, Points FROM EVENT WHERE Points <= 60;
EName
Points
Debate
30
Dance
60
Drama
55
Explanation: WHERE keeps only the rows where Points is at most 60: 3 of the 6 rows match (Debate, Dance, Drama).
(iv)
SELECT COUNT(*) FROM EVENT WHERE House = 'Shivaji';
COUNT(*)
3
Explanation: WHERE keeps only the rows where House is 'Shivaji': 3 of the 6 rows match (Debate, Dance, Painting). COUNT(*) counts the rows of the matching rows.
(v)
SELECT RIGHT(EName, 2) FROM EVENT;
RIGHT(EName, 2)
te
iz
ce
ma
ng
ng
Explanation: The function RIGHT is worked out for every row that is shown.
E3.37Practice5 marks
Consider the table TRAIN given below. Write SQL commands to:
Add a new row with the values 12007, 'New Rajdhani', 'Southern', 18, 2135.59, '2024-12-15'
Increase the Coaches by 2 for the rows where Zone is 'Southern'
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE TRAIN SET Coaches = Coaches + 2 WHERE Zone = 'Southern';
Rows affected: 2
Explanation: SET Coaches = Coaches + 2 changes the value; WHERE limits the change to the rows where Zone is 'Southern': 2 rows changed.
(iii)
DELETE FROM TRAIN WHERE Coaches < 13;
Rows affected: 1
Explanation: WHERE picks the rows where Coaches is less than 13: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE TRAIN ADD Grade CHAR(1);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE TRAIN;
Explanation: DROP removes the whole object with its data.
E3.38Practice5 marks
Consider the table TRAIN given below. Write SQL queries to display:
Each TName and its Fare rounded to one decimal place
The TName that end with the letter 'i'
The TName and Coaches of the rows where Coaches is 17 or less
The total Coaches of the rows where Zone is 'Northern'
The first three characters of each TName.
Table: TRAIN
TNo
TName
Zone
Coaches
Fare
StartDate
12001
Rajdhani
Northern
17
2750.73
2017-02-22
12002
Shatabdi
Southern
24
2125.09
2024-03-03
12003
Duronto
Northern
13
2277.83
2024-03-16
12004
Garib Rath
Southern
10
3012.73
2021-04-10
12005
Tejas
Western
18
2091.89
2015-02-17
12006
Vande Bharat
Northern
20
1399.69
2020-04-10
Answer
(i)
SELECT TName, ROUND(Fare, 1) FROM TRAIN;
TName
ROUND(Fare, 1)
Rajdhani
2750.7
Shatabdi
2125.1
Duronto
2277.8
Garib Rath
3012.7
Tejas
2091.9
Vande Bharat
1399.7
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT TName FROM TRAIN WHERE TName LIKE '%i';
TName
Rajdhani
Shatabdi
Explanation: WHERE keeps only the rows where TName matches the pattern '%i': 2 of the 6 rows match (Rajdhani, Shatabdi). '%i' means the value ends with 'i'.
(iii)
SELECT TName, Coaches FROM TRAIN WHERE Coaches <= 17;
TName
Coaches
Rajdhani
17
Duronto
13
Garib Rath
10
Explanation: WHERE keeps only the rows where Coaches is at most 17: 3 of the 6 rows match (Rajdhani, Duronto, Garib Rath).
(iv)
SELECT SUM(Coaches) FROM TRAIN WHERE Zone = 'Northern';
SUM(Coaches)
50
Explanation: WHERE keeps only the rows where Zone is 'Northern': 3 of the 6 rows match (Rajdhani, Duronto, Vande Bharat). SUM adds the values of the matching rows.
(v)
SELECT LEFT(TName, 3) FROM TRAIN;
LEFT(TName, 3)
Raj
Sha
Dur
Gar
Tej
Van
Explanation: The function LEFT is worked out for every row that is shown.
E3.39Practice5 marks
Consider the table LAPTOP given below. Write SQL commands to:
Add a new row with the values 7, 'New Astra', 'Zenit', 17, 84552.43, '2026-12-15'
Increase the RAM by 100 for the rows where Brand is 'Zenit'
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE LAPTOP SET RAM = RAM + 100 WHERE Brand = 'Zenit';
Rows affected: 3
Explanation: SET RAM = RAM + 100 changes the value; WHERE limits the change to the rows where Brand is 'Zenit': 3 rows changed.
(iii)
DELETE FROM LAPTOP WHERE RAM < 12;
Rows affected: 1
Explanation: WHERE picks the rows where RAM is less than 12: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE LAPTOP ADD City VARCHAR(20);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE LAPTOP;
Explanation: DROP removes the whole object with its data.
E3.40Practice5 marks
Consider the table LAPTOP given below. Write SQL queries to display:
Each Model and its Price rounded to the nearest whole number
The rows where Model starts with the letter 'A'
The Model and RAM of the rows where RAM is 16 or less
The highest and the lowest Price
The Model in capital letters.
Table: LAPTOP
LNo
Model
Brand
RAM
Price
Launch
1
Astra 5
Orbit
16
86696.75
2026-11-10
2
Bolt X
Zenit
28
84541.93
2025-10-22
3
Comet Pro
Zenit
32
84965.49
2026-03-21
4
Dyna Air
Zenit
24
70706.77
2025-05-13
5
Eon Lite
Orbit
12
41551.16
2026-07-03
6
Flex 14
Nova
4
42044.12
2026-11-12
Answer
(i)
SELECT Model, ROUND(Price) FROM LAPTOP;
Model
ROUND(Price)
Astra 5
86697
Bolt X
84542
Comet Pro
84965
Dyna Air
70707
Eon Lite
41551
Flex 14
42044
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM LAPTOP WHERE Model LIKE 'A%';
LNo
Model
Brand
RAM
Price
Launch
1
Astra 5
Orbit
16
86696.75
2026-11-10
Explanation: WHERE keeps only the rows where Model matches the pattern 'A%': 1 of the 6 rows matches (Astra 5). 'A%' means the value starts with 'A'.
(iii)
SELECT Model, RAM FROM LAPTOP WHERE RAM <= 16;
Model
RAM
Astra 5
16
Eon Lite
12
Flex 14
4
Explanation: WHERE keeps only the rows where RAM is at most 16: 3 of the 6 rows match (Astra 5, Eon Lite, Flex 14).
(iv)
SELECT MAX(Price), MIN(Price) FROM LAPTOP;
MAX(Price)
MIN(Price)
86696.75
41551.16
Explanation: MAX gives the largest value of all the rows. MIN gives the smallest value.
(v)
SELECT UCASE(Model) FROM LAPTOP;
UCASE(Model)
ASTRA 5
BOLT X
COMET PRO
DYNA AIR
EON LITE
FLEX 14
Explanation: The function UCASE is worked out for every row that is shown.
E3.41Practice5 marks
Consider the table CLUB given below. Write SQL commands to:
Add a new row with the values 7, 'Suman', 'Swimming', 28, 2307.03, '2026-12-15'
Increase the Age by 5 for the rows where Activity is 'Swimming'
Delete the rows where Age is less than 17
Add a new column Remarks of type VARCHAR(30)
Remove the table CLUB from the database.
Table: CLUB
CNo
MName
Activity
Age
Fee
DOJ
1
Farhan
Tennis
27
1058.82
2026-12-05
2
Bhavna
Swimming
42
2296.53
2023-02-14
3
Lokesh
Yoga
16
805.04
2023-11-02
4
Simran
Yoga
36
1759.99
2026-03-27
5
Sachin
Tennis
17
3396.68
2026-04-14
6
Mohit
Yoga
56
1552.63
2023-06-09
Answer
(i)
INSERT INTO CLUB VALUES (7, 'Suman', 'Swimming', 28, 2307.03, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE CLUB SET Age = Age + 5 WHERE Activity = 'Swimming';
Rows affected: 1
Explanation: SET Age = Age + 5 changes the value; WHERE limits the change to the rows where Activity is 'Swimming': 1 row changed.
(iii)
DELETE FROM CLUB WHERE Age < 17;
Rows affected: 1
Explanation: WHERE picks the rows where Age is less than 17: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE CLUB ADD Remarks VARCHAR(30);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE CLUB;
Explanation: DROP removes the whole object with its data.
E3.42Practice5 marks
Consider the table CLUB given below. Write SQL queries to display:
Each MName and its Fee rounded to one decimal place
The MName that end with the letter 'a'
The MName and Age of the rows where Age is 27 or less
The number of rows where Activity is 'Tennis'
Each MName and the number of characters in it.
Table: CLUB
CNo
MName
Activity
Age
Fee
DOJ
1
Farhan
Tennis
27
1058.82
2026-12-05
2
Bhavna
Swimming
42
2296.53
2023-02-14
3
Lokesh
Yoga
16
805.04
2023-11-02
4
Simran
Yoga
36
1759.99
2026-03-27
5
Sachin
Tennis
17
3396.68
2026-04-14
6
Mohit
Yoga
56
1552.63
2023-06-09
Answer
(i)
SELECT MName, ROUND(Fee, 1) FROM CLUB;
MName
ROUND(Fee, 1)
Farhan
1058.8
Bhavna
2296.5
Lokesh
805.0
Simran
1760.0
Sachin
3396.7
Mohit
1552.6
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT MName FROM CLUB WHERE MName LIKE '%a';
MName
Bhavna
Explanation: WHERE keeps only the rows where MName matches the pattern '%a': 1 of the 6 rows matches (Bhavna). '%a' means the value ends with 'a'.
(iii)
SELECT MName, Age FROM CLUB WHERE Age <= 27;
MName
Age
Farhan
27
Lokesh
16
Sachin
17
Explanation: WHERE keeps only the rows where Age is at most 27: 3 of the 6 rows match (Farhan, Lokesh, Sachin).
(iv)
SELECT COUNT(*) FROM CLUB WHERE Activity = 'Tennis';
COUNT(*)
2
Explanation: WHERE keeps only the rows where Activity is 'Tennis': 2 of the 6 rows match (Farhan, Sachin). COUNT(*) counts the rows of the matching rows.
(v)
SELECT MName, LENGTH(MName) FROM CLUB;
MName
LENGTH(MName)
Farhan
6
Bhavna
6
Lokesh
6
Simran
6
Sachin
6
Mohit
5
Explanation: The function LENGTH is worked out for every row that is shown.
E3.43Practice5 marks
Consider the table FARM given below. Write SQL commands to:
Add a new row with the values 7, 'Simran', 'Wheat', 40, 50.66, '2026-12-15'
Increase the Acres by 10 for the rows where Crop is 'Wheat'
Delete the rows where Acres is less than 9
Add a new column Email of type VARCHAR(40)
Remove the table FARM from the database.
Table: FARM
FNo
Farmer
Crop
Acres
Yield
SowDate
1
Arjun
Maize
39
34.42
2026-12-19
2
Anita
Wheat
9
40.16
2025-07-19
3
Isha
Rice
11
24.93
2026-02-23
4
Sonal
Wheat
16
46.04
2025-06-25
5
Vandana
Rice
6
41.02
2026-10-11
6
Harish
Wheat
23
23.82
2025-11-28
Answer
(i)
INSERT INTO FARM VALUES (7, 'Simran', 'Wheat', 40, 50.66, '2026-12-15');
Rows affected: 1
Explanation: INSERT adds a new row; values are given in the order of the columns, text and dates in quotes.
(ii)
UPDATE FARM SET Acres = Acres + 10 WHERE Crop = 'Wheat';
Rows affected: 3
Explanation: SET Acres = Acres + 10 changes the value; WHERE limits the change to the rows where Crop is 'Wheat': 3 rows changed.
(iii)
DELETE FROM FARM WHERE Acres < 9;
Rows affected: 1
Explanation: WHERE picks the rows where Acres is less than 9: 1 row is deleted; the table and the other rows remain.
(iv)
ALTER TABLE FARM ADD Email VARCHAR(40);
Explanation: ALTER TABLE changes the structure (columns or keys) of an existing table; the data stays.
(v)
DROP TABLE FARM;
Explanation: DROP removes the whole object with its data.
E3.44Practice5 marks
Consider the table FARM given below. Write SQL queries to display:
Each Farmer and its Yield rounded to the nearest whole number
The rows where Farmer starts with the letter 'A'
The Farmer and Acres of the rows where Acres is 11 or less
The total Acres of the rows where Crop is 'Maize'
Each Farmer and the name of the month of SowDate.
Table: FARM
FNo
Farmer
Crop
Acres
Yield
SowDate
1
Arjun
Maize
39
34.42
2026-12-19
2
Anita
Wheat
9
40.16
2025-07-19
3
Isha
Rice
11
24.93
2026-02-23
4
Sonal
Wheat
16
46.04
2025-06-25
5
Vandana
Rice
6
41.02
2026-10-11
6
Harish
Wheat
23
23.82
2025-11-28
Answer
(i)
SELECT Farmer, ROUND(Yield) FROM FARM;
Farmer
ROUND(Yield)
Arjun
34
Anita
40
Isha
25
Sonal
46
Vandana
41
Harish
24
Explanation: The function ROUND is worked out for every row that is shown.
(ii)
SELECT * FROM FARM WHERE Farmer LIKE 'A%';
FNo
Farmer
Crop
Acres
Yield
SowDate
1
Arjun
Maize
39
34.42
2026-12-19
2
Anita
Wheat
9
40.16
2025-07-19
Explanation: WHERE keeps only the rows where Farmer matches the pattern 'A%': 2 of the 6 rows match (Arjun, Anita). 'A%' means the value starts with 'A'.
(iii)
SELECT Farmer, Acres FROM FARM WHERE Acres <= 11;
Farmer
Acres
Anita
9
Isha
11
Vandana
6
Explanation: WHERE keeps only the rows where Acres is at most 11: 3 of the 6 rows match (Anita, Isha, Vandana).
(iv)
SELECT SUM(Acres) FROM FARM WHERE Crop = 'Maize';
SUM(Acres)
39
Explanation: WHERE keeps only the rows where Crop is 'Maize': 1 of the 6 rows matches (Arjun). SUM adds the values of the matching rows.
(v)
SELECT Farmer, MONTHNAME(SowDate) FROM FARM;
Farmer
MONTHNAME(SowDate)
Arjun
December
Anita
July
Isha
February
Sonal
June
Vandana
October
Harish
November
Explanation: The function MONTHNAME is worked out for every row that is shown.
11
Flashcards for one-mark questions
Tap an option to check your answer at once; your score is saved
Quick quiz: 10 MCQs
Ten multiple-choice questions picked at random. Tap an option to answer. You get your score at the end.
12
Practice question papers
Twenty ready papers with blueprints and a random paper maker, all on the design of the CBSE Sample Question Paper 2026-27
Twenty ready practice papers
Each paper has 37 questions for 70 marks in Sections A to E, with internal choices (OR) in Q22, Q25, Q28, Q30, Q32, Q34 and Q37, as in the CBSE Sample Question Paper 2026-27. Unit marks are kept as in the syllabus: Pandas and data visualization 25, SQL 25, Networks 10, Societal Impacts 10. Every paper opens with its chapter-wise blueprint. No question is repeated: the twenty papers use 880 different questions.
Or make a fresh random paper
Marking scheme, download and timer
Blueprint only:
Downloads and printing work when this page is opened as an HTML file in a browser.
03:00:00
Choose Paper 1 to Paper 20, or make a random paper. The blueprint and the paper open here.
13
Last-day checklist
Read this the evening before and again at the exam centre gate
Before the paper
Write once from memory: a Series program, a DataFrame program, a line chart program, and the five SQL commands.
Revise the device table, the four topologies and the six case-study rules.