Worksheets › Class 11 › Introduction to Structured Query Language (SQL)
Class 11 · Informatics Practices worksheetIntroduction to Structured Query Language (SQL)
CBSE Informatics Practices. DDL, DML and DQL, MySQL data types, SELECT with WHERE, BETWEEN, IN, LIKE, IS NULL, DISTINCT and ORDER BY, UPDATE and DELETE on sample tables. Every sheet has 20 questions in three sections and an answer key, and the questions change every time.
Sample questions
Real questions from this chapter, as the app sets them. Tap Answer to see the answer and working.
Section A · multiple choice
- 1.
CREATE, ALTER and DROP are:
- DQL commands
- functions
- DML commands
- DDL commands
Answer
(d) DDL commands
- 2.
Table: STUDENT RollNo | Name | Gender | Section | Marks | DOB 20 | Pooja | F | A | 49 | 2009-02-15 21 | Manav | M | A | 97 | 2010-06-07 22 | Rahul | M | B | 67 | 2009-06-26 23 | Zoya | F | B | 44 | 2010-06-03 24 | Naina | F | C | 72 | 2009-08-05 25 | Uday | M | C | 74 | 2008-12-12 26 | Meera | F | B | 94 | 2009-02-13 27 | Harsh | M | C | 98 | 2008-07-17 28 | Aarav | M | C | 97 | 2009-09-09 SELECT * FROM STUDENT WHERE Section IN ('C', 'A') AND Marks BETWEEN 72 AND 97; How many rows does this query return?
- 4
- 5
- 3
- 9
Answer
(a) 4
check the WHERE condition on every row; a NULL never satisfies a comparison
- 3.
Table: ITEM ItemCode | IName | Category | Price | Qty I201 | Gel Pen | Stationery | 15 | 50 I203 | Glue Stick | Office | 35 | 35 I213 | Stapler | Office | 160 | 35 I218 | Water Bottle | Daily Use | 205 | 15 I219 | Torch | Daily Use | 180 | 55 I226 | School Bag | Daily Use | 1020 | 35 I228 | Paper Clips | Office | 40 | 60 I254 | File Folder | Office | 60 | 60 I257 | Umbrella | Daily Use | 285 | 40 SELECT IName FROM ITEM WHERE Category IN ('Office', 'Daily Use') ORDER BY Price; Which name is in the first row of the output?
- Umbrella
- File Folder
- Glue Stick
- Paper Clips
Answer
(c) Glue Stick
ascending: smallest first, NULL first; order: Glue Stick, Paper Clips, File Folder, Stapler, Torch, Water Bottle, Umbrella, School Bag
Section B · short answer
- 4.
Give two advantages of SQL.
Answer
It is easy to learn with English-like commands, and it works with almost every relational DBMS to create, change and query data.
- 5.
Table: EMPLOYEE EmpId | Ename | Dept | City | Salary | Bonus E102 | Lakshmi | Accounts | Agra | 35000 | 4000 E110 | Zoya | Sales | Pune | 26000 | 5500 E115 | Harsh | Accounts | Kochi | 53000 | NULL E117 | Manav | Transport | Patna | 39000 | 3500 E126 | Sana | Accounts | Agra | 58000 | 4500 E135 | Uday | Accounts | Nagpur | 61000 | 2000 E136 | Deepa | Stores | Pune | 68000 | NULL E140 | Farhan | Sales | Pune | 73000 | NULL SELECT Ename FROM EMPLOYEE WHERE Bonus >= 3500 ORDER BY Salary; Write the output, names separated by commas, in order.
Answer
Zoya, Lakshmi, Manav, Sana
kept rows sorted by Salary from smallest
Section C · long answer
- 6.
Write SQL statements to create a table STUDENT with RollNo (primary key), Name, Section, Marks and DOB, and insert one row.
Answer
CREATE TABLE STUDENT (RollNo INT PRIMARY KEY, Name VARCHAR(20) NOT NULL, Section CHAR(1), Marks INT, DOB DATE); INSERT INTO STUDENT VALUES (1, "Asha", "A", 78, "2009-04-12");
Fresh sheets for your child
In the app, every Introduction to Structured Query Language (SQL) sheet is new: the app remembers the questions your child has already had and leaves them out. Print the sheet as a PDF, or use notebook mode and write the answers in a notebook.
Coming soon for Android and iPhone.