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

4149136-Xii Ip - WS - SQL (2022-23)

The document provides a worksheet for Class XII Informatics Practices focusing on SQL functions, including tasks to create a Library table with specific records and execute various SQL queries. It also includes a section on a Furniture table with additional SQL commands and a Salesman table with queries related to salesmen data. Each section contains specific SQL operations to manipulate and retrieve data from the tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

4149136-Xii Ip - WS - SQL (2022-23)

The document provides a worksheet for Class XII Informatics Practices focusing on SQL functions, including tasks to create a Library table with specific records and execute various SQL queries. It also includes a section on a Furniture table with additional SQL commands and a Salesman table with queries related to salesmen data. Each section contains specific SQL operations to manipulate and retrieve data from the tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

INDIAN SCHOOL AL WADI AL KABIR

Class: XII SUB: INFORMATICS PRACTICES Date of Completion:


03/11/2022

Worksheet : 09 TOPIC : SQL – Single Row Functions & Note:


Aggregate Functions
1. Create the table Library and insert the following records.
Table Name: LIBRARY
BNO BTITLE BPUB ISSUEDATE PRICE
4002 C++ VIKAS PUB 03-NOV-2002 485
4072 JAVA TATA MCGRAW HILL 23-JUN-1997 750
3789 VB GALGOTIA PUB 12-SEP-2004 400
4821 ASP TATA MCGRAW HILL 17-MAY-2013 275
2901 PERL GALGOTIA PUB 21-APR-2012 600
3285 SQL VIKAS PUB 15-DEC-2005 180
5674 NETWORK HASSAN PUB 04-JAN-1989 1250
7200 OS TATA MCGRAW HILL 10-AUG-2008 370
1579 LINUX JEEVAN PUB 23-SEP-2011 860
9278 WINDOWS GALGOTIA PUB 18-OCT-2003 220
5729 SYBASE GALGOTIA PUB 06-JAN-2012 NULL
8005 MYSQL VIKAS PUB 28-MAR-1999 210
1058 MS OFFICE TATA MCGRAW HILL 12-NOV-2001 NULL
1685 INTRANET VIKAS PUB 15-MAR-2010 220

Write the following queries:


i. Display the first 3 characters of the book of TATA MCGRAW HILL publication.
ii. Display the length of the book title whose Prize is not given.
iii. Display last two characters of the Book Name Start with the title ‘M’.
iv. Display the concatenated test of book title and Book publisher of Books end with the Letter ‘L’.
v. Display the 3 characters from 4th position in Publisher name of the Books in which the Book
Name contains ‘IN’.
Write the Output of the following SQL Queries
vi. SELECT CONCAT(BTITLE, BPUB) FROM LIBRARY WHERE BTITLE LIKE “P%”;
vii. SELECT INSTR(BTITLE,”S”) FROM LIBRARY WHERE PRICE BETWEEN 300 AND 600.
viii. SELECT SUBSTR(BTILLE,2,2) FROM LIBRARY WHERE BPUB = “GALGOTIA PUB’;
ix. SELECT LOWER(BPUB) FROM LIBRARY WHERE PRICE > 800;
x. SELECT DAY(ISSUEDATE) FROM LIBRARY WHERE PRICE < 250;
xi. SELECT YEAR(ISSUEDATE) FROM LIBRARY WHERE BPUB IN (“VIKAS PUB”, “HASSAN PUB”);
xii. SELECT MONTH(ISSUEDATE) FROM LIBRARY WHERE BTITLE LIKE “%ET%”;
xiii. SELECT MIN(ISSUEDATE), MAX(ISSUEDATE) FROM LIBRARY;
xiv. SELECT BPUB, MAX(PRICE) FROM LIBRARY GROUP BY BPUB;
xv. SELECT BPUB, SUM(PRICE), AVG(PRICE) FROM LIBRARY GROUP BY BPUB;
xvi. SELECT COUNT(PRICE), COUNT(*) FROM LIBRARY;
1| 3 1 - 1 0 - 2 0 2 2 / P R E P A R E D B Y : M R . A . R A N J I T H K U M A R | I C T D e p t .
2. Write SQL Commands for (a) to (e) on the basis of table FURNITURE:

Table : FURNITURE
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 White Lotus Double Bed 2002-02-23 3000 25
2 Pink feathers Baby Cot 2001-01-29 7000 20
3 Dolphin Baby Cot 2002-02-19 9500 20
4 Decent Office Table 2002-02-01 25000 30
5 Comfort zone Double Bed 2001-02-12 25000 30
6 Donald Baby cot 2002-02-24 6500 15
7 Royal Finish Office Table 2002-02-20 18000 30
8 Royal tiger Sofa 2002-02-22 31000 30
9 Econo sitting Sofa 2001-12-13 9500 25
10 Eating Paradise Dinning Table 2002-12-19 11500 25
(a) SELECT LEFT(ITEMNAME,2) FROM FURNITURE WHERE TYPE=”SOFA”;
(b) SELECT RIGHT(ITEMNAME,3) FROM FURNITURE WHERE PRICE > 20000;
(c) SELECT SUBSTR(ITEMNAME, 4, 3) FROM FURNITURE WHERE DISCOUNT < 25;
(d) SELECT CONCAT(ITEMNAME, “ * “, TYPE) FROM FURNITURE WHERE YEAR(DATEOFSTOCK) = 2001;
(e) SELECT INSTR(ITEMNAME, “IN”) FROM FURNITURE WHERE TYPE IN (“OFFICE TABLE”, “SOFA”);
(f) SELECT LENGTH(ITEMNAME) FROM FURNITURE WHERE PRICE < 10000;
(g) SELECT UPPER(ITEMNAME) FROM FURNITURE WHERE DATEOFSTOCK > “2002-02-20”;
(h) SELECT LOWER(ITEMNAME) FROM FURNITURE WHERE PRICE BETWEEN 25000 AND 30000;
(i) SELECT UPPER(MID(ITEMNAME, 5,2)) FROM FURNITURE WHERE TYPE IN (“DOUBLE BED”,
“DININING TABLE”);
(j) SELECT MAX(LENGTH(ITEMNAME)), LENGTH(MAX(ITEMNME)) FROM FURNITURE;

3) Consider a table SALESMAN with the following data:


SNO SNAME SALARY BONUS DATEOFJOIN
A01 Beena Mehta 30000 45.23 29-10-2019
A02 K.L.Sahay 50000 25.34 13-03-2018
B03 Nisha Thakkar 30000 35.00 18-03-2017
B04 Leela Yadav 80000 NULL 31-12-2018
C05 Gautam Gola 20000 NULL 23-01-1989
C06 Trapti Garg 70000 12.37 15-06-1987
D07 Neena Sharma 50000 27.89 18-03-1999
Write SQL queries using SQL functions to perform the following operations:
a) Display salesman name and year of dateof join.
b) Display the position of occurrence of the string “ta” in salesman names.
c) Display only last four characters from salesman name.
d) Display the month name for the date of join of salesman.
e) Display the bonus rounded to nearest whole number of salesmen who joined in the
month of march.
f) Display the first 3 characters of name combined with last 2 characters of sno of all salesmen

2| 3 1 - 1 0 - 2 0 2 2 / P R E P A R E D B Y : M R . A . R A N J I T H K U M A R | I C T D e p t .

You might also like