Introduction to Structured Query Language (SQL) — NCERT Solutions
CBSE · Class 11 · Informatics Practices
NCERT question answers for Introduction to Structured Query Language (SQL), CBSE Class 11 Informatics Practices: 15 textbook questions solved step by step.
Interactive on Super Tutor
Studying Introduction to Structured Query Language (SQL)? Get the full interactive chapter.
Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for NCERT solutions and more.
Free trial, no card needed.
The first 8 solutions are open to read. The other 7 are free with a Super Tutor account. Unlock all 15 free in Super Tutor
Exercise
1Match the following clauses with their respective functions.ALTER Insert the values in a table UPDATE Restrictions on columns DELETE Table definition INSERT INTO Change the name of a column CONSTRAINTS Update existing information in a table DESC Delete an existing row from a table CREATE Create a database
Show solution
| ALTER | Insert the values in a table |
|---|---|
| UPDATE | Restrictions on columns |
| DELETE | Table definition |
| INSERT INTO | Change the name of a column |
| CONSTRAINTS | Update existing information in a table |
| DESC | Delete an existing row from a table |
| CREATE | Create a database |
- ALTER → Change the name of a column
- UPDATE → Update existing information in a table
- DELETE → Delete an existing row from a table
- INSERT INTO → Insert the values in a table
- CONSTRAINTS → Restrictions on columns
- DESC → Table definition
- CREATE → Create a database
Not sure why a step works? check your working in Super Tutor
2(a)What will be the degree of student table?CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) 30
- ii) 1
- iii) 3
- iv) 4
Show solution
CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) 30
- ii) 1
- iii) 3
- iv) 4
The table has 3 attributes/columns: name, student_id, and gender. So the degree of the table is 3.
Not sure why a step works? check your working in Super Tutor
2(b)What does 'name' represent in the above code snippet?CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) a table
- ii) a row
- iii) a column
- iv) a database
Show solution
CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) a table
- ii) a row
- iii) a column
- iv) a database
In CREATE TABLE student (...), name is an attribute/column name of the table.
Not sure why a step works? check your working in Super Tutor
2(c)What is true about the following SQL statement?
Select * FROM student;CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) Displays contents of table 'student'
- ii) Displays column names and contents of table 'student'
- iii) Results in error as improper case has been used
- iv) Displays only the column names of table 'student'
Show solution
CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) Displays contents of table 'student'
- ii) Displays column names and contents of table 'student'
- iii) Results in error as improper case has been used
- iv) Displays only the column names of table 'student'
SELECT * FROM student; uses * to display all columns and all records of the table student. SQL is case insensitive, so Select is valid.
Not sure why a step works? check your working in Super Tutor
2(d)What will be the output of following query?
INSERT INTO student
VALUES ("Suhana", 109, 'F'),
VALUES ("Rivaan", 102, 'M'),
VALUES ("Athary", 103, 'M'),
VALUES ("Rishika", 105, 'F'),
VALUES ("Garvit", 104, 'M'),
VALUES ("Shaurya", 109, 'M');CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) Error
- ii) No Error
- iii) Depends on compiler
- iv) Successful completion of the query
Show solution
CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) Error
- ii) No Error
- iii) Depends on compiler
- iv) Successful completion of the query
The statement is invalid because INSERT INTO does not take multiple VALUES clauses written separately like this. For inserting multiple rows, the format shown in the chapter is not this one. So the query results in an error.
Not sure why a step works? check your working in Super Tutor
2(e)In the following query how many rows will be deleted?
DELETE student
WHERE student_id=109;CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) 1 row
- ii) All the rows where student ID is equal to 109
- iii) No row will be deleted
- iv) 2 rows
Show solution
CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
- i) 1 row
- ii) All the rows where student ID is equal to 109
- iii) No row will be deleted
- iv) 2 rows
Without WHERE, deletion is not selective, but here the condition is student_id = 109, so all rows matching that student ID will be deleted. If more than one row had 109, all such rows would be removed.
Not sure why a step works? check your working in Super Tutor
3(a)__________ declares that an index in one table is related to that in another table.- i) Primary Key
- ii) Foreign Key
- iii) Composite Key
- iv) Secondary Key
Show solution
- i) Primary Key
- ii) Foreign Key
- iii) Composite Key
- iv) Secondary Key
A foreign key declares that an attribute in one table is related to an attribute in another table.
Not sure why a step works? check your working in Super Tutor
3(b)The symbol Asterisk (*) in a select query retrieves __________.- i) All data from the table
- ii) Data of primary key only
- iii) NULL data
- iv) None of the mentioned
Show solution
- i) All data from the table
- ii) Data of primary key only
- iii) NULL data
- iv) None of the mentioned
The asterisk * in a SELECT query retrieves all columns, i.e. all data from the table.
Not sure why a step works? check your working in Super Tutor
a) Retrieve movies information without mentioning their column names.
b) List business done by the movies showing only MovieID, MovieName and BusinessCost.
c) List the different categories of movies.
d) Find the net profit of each movie showing its ID, Name and Net Profit.
(Hint: Net Profit = BusinessCost - ProductionCost)
Make sure that the new column name is labelled as NetProfit. Is this column now a part of the MOVIE relation. If no, then what name is coined for such columns? What can you say about the profit of a movie which has not yet released? Does your query result show profit as zero?
e) List all movies with ProductionCost greater than 80,000 and less than 1,25,000 showing ID, Name and ProductionCost.
f) List all movies which fall in the category of Comedy or Action.
g) List the movies which have not been released yet.
| MovieID | MovieName | Category | ReleaseDate | ProductionCost | BusinessCost |
|---|---|---|---|---|---|
| 001 | Hindi_Movie | Musical | 2018-04-23 | 124500 | 130000 |
| 002 | Tamil_Movie | Action | 2016-05-17 | 112000 | 118000 |
| 003 | English_Movie | Horror | 2017-08-06 | 245000 | 360000 |
| 004 | Bengali_Movie | Adventure | 2017-01-04 | 72000 | 100000 |
| 005 | Telugu_Movie | Action | - | 100000 | - |
| 006 | Punjabi_Movie | Comedy | - | 30500 | - |
Free with a Super Tutor account
a) Create a database “Sports”.
b) Create a table “TEAM” with following considerations:
i) It should have a column TeamID for storing an integer value between 1 to 9, which refers to unique identification of a team.
ii) Each TeamID should have its associated name (TeamName), which should be a string of length not less than 10 characters.
c) Using table level constraint, make TeamID as primary key.
d) Show the structure of the table TEAM using SQL command.
e) As per the preferences of the students four teams were formed as given below. Insert these four rows in TEAM table:
Row 1: (1, Team Titan)
Row 2: (2, Team Rockers)
Row 3: (3, Team Magnet)
Row 4: (4, Team Hurricane)
f) Show the contents of the table TEAM.
g) Now create another table below. MATCH_DETAILS and insert data as shown in table. Choose appropriate domains and constraints for each attribute.
h) Use the foreign key constraint in the MATCH_DETAILS table with reference to TEAM table so that MATCH_DETAILS table records score of teams existing in the TEAM table only.
Table: MATCH_DETAILS
| MatchID | MatchDate | FirstTeamID | SecondTeamID | FirstTeamScore | SecondTeamScore |
|---|---|---|---|---|---|
| M1 | 2018-07-17 | 1 | 2 | 90 | 86 |
| M2 | 2018-07-18 | 3 | 4 | 45 | 48 |
| M3 | 2018-07-19 | 1 | 3 | 78 | 56 |
| M4 | 2018-07-19 | 2 | 4 | 56 | 67 |
| M5 | 2018-07-20 | 1 | 4 | 32 | 87 |
| M6 | 2018-07-21 | 2 | 3 | 67 | 51 |
Free with a Super Tutor account
a) Retrieve the MatchID of all those matches where both the teams have scored > 70.
b) Retrieve the MatchID of all those matches where FirstTeam has scored < 70 but SecondTeam has scored > 70.
c) Find out the MatchID and date of matches played by Team 1 and won by it.
d) Find out the MatchID of matches played by Team 2 and not won by it.
e) In the TEAM relation, change the name of the relation to T_DATA. Also change the attributes TeamID and TeamName to T_ID and T_NAME respectively.
Free with a Super Tutor account
a) ALTER and UPDATE
b) DELETE and DROP
Free with a Super Tutor account
Table: STUDENT
| RollNo | Name | Stream | Section | RegistrationID |
|---|---|---|---|---|
* The values in Stream column can be either Science, Commerce, or Humanities.
* The values in Section column can be either I or II.
Table: PROJECT_ASSIGNED
| RegistrationID | ProjectID | AssignDate |
|---|---|---|
Table: PROJECT
| ProjectID | ProjectName | SubmissionDate | TeamSize | GuideTeacher |
|---|---|---|---|---|
- a) Populate these tables with appropriate data.
- b) Write SQL queries for the following.
- c) Find the names of students in Science Stream.
- d) What will be the primary keys of the three tables?
- e) What are the foreign keys of the three relations?
- f) Finds names of all the students studying in class 'Commerce stream' and are guided by same teacher, even if they are assigned different projects.
Free with a Super Tutor account
EMPLOYEE(AadhaarNo, Name, Address, Department, EmpID)
DEPENDENT(EmpID, DependentName, Relationship)
Use the EMP-DEPENDENT database to answer the following SQL queries:
- a) Find the names of employees with their dependent names.
- b) Find employee details working in a department, say, 'PRODUCTION'.
- c) Find employee names having no dependent
- d) Find names of employees working in a department, say, 'SALES' and having exactly two dependents.
Free with a Super Tutor account
a) The PRICE relation has an attribute named Price. In order to avoid confusion, write SQL query to change the name of the relation PRICE to COST.
b) M/S Wonderful Garments also keeps handkerchiefs of red color, medium size of ₹100 each. Insert this record in COST table.
c) When you used the above query to insert data, you were able to enter the values for handkerchief without entering its details in the UNIFORM relation. Make a provision so that the data can be entered in COST table only if it is already there in UNIFROM table.
d) Further, you should be able to assign a new UCode to an item only if it has a valid UName. Write a query to add appropriate constraint to the SCHOOL_UNIFORM database.
e) ALTER table to add the constraint that price of an item is always greater than zero.
UNIFORM
| UCode | UName | UColor |
|---|---|---|
| 1 | Shirt | White |
| 2 | Pant | Grey |
| 3 | Skirt | Grey |
| 4 | Tie | Blue |
| 5 | Socks | Blue |
| 6 | Belt | Blue |
PRICE
| UCode | Size | Price |
|---|---|---|
| 1 | M | 500 |
| 1 | L | 580 |
| 1 | XL | 620 |
| 2 | M | 810 |
| 2 | L | 890 |
| 2 | XL | 940 |
| 3 | M | 770 |
| 3 | L | 830 |
| 3 | XL | 910 |
| 4 | S | 150 |
| 4 | L | 170 |
| 5 | S | 180 |
| 5 | L | 210 |
| 6 | M | 110 |
| 6 | L | 140 |
| 6 | XL | 160 |
Free with a Super Tutor account
7 more solved questions in Introduction to Structured Query Language (SQL)
They are free with a Super Tutor account, along with practice quizzes and flashcards for this chapter. Free to start, no card needed.
Frequently Asked Questions
What are the important topics in Introduction to Structured Query Language (SQL) for CBSE Class 11 Informatics Practices?
Are these NCERT Solutions for Introduction to Structured Query Language (SQL) free?
How should I revise Introduction to Structured Query Language (SQL) for Class 11 exams?
Sources & Official References
- NCERT Official — ncert.nic.in
- CBSE Academic — cbseacademic.nic.in
- CBSE Official — cbse.gov.in
- National Education Policy 2020 — education.gov.in
Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.
More resources for Introduction to Structured Query Language (SQL)
Practice Quiz
Test yourself with a quick quiz
Important Questions
Exam-style questions with answers
Revision Notes
Key points for last-minute revision
Formula Sheet
The chapter's formulas in one place
Chapter Summary
Understand the chapter at a glance
Concept Maps
See how topics connect
Study Plan
Step-by-step plan for this chapter
Flashcards
Quick-fire cards for active recall
Syllabus
What topics to cover
For serious students
Get the full Introduction to Structured Query Language (SQL) chapter — start free.
Quizzes, flashcards, an AI doubt solver and a study plan for CBSE Class 11 Informatics Practices. Free to start, no card needed.