Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers

Step-by-Step Textbook Solutions for Class 12 Computer Science Chapter 09 Structured Query Language

Review structured textbook solutions for Class 12 Computer Science Chapter 09 Structured Query Language. Built according to Kerala Board guidelines for the 2026-27 academic year, these downloadable answers support daily revision and problem-solving accuracy.

Download Chapter 09 Structured Query Language Textbook Solutions PDF

View or download the dedicated Chapter 09 Structured Query Language solution resource below. Engaging with these textbook answers under focused study conditions ensures continuous academic progress and mastery of the 2026-27 curriculum for Computer Science.

One Mark Questions and Answers

Question 1: ______ form of SQL is designed for use within general purpose programming languages such as COBOL, C, etc.

Answer:

Embedded SQL

Exam Tips:

a) SQL has two forms: interactive SQL (typed directly) and embedded SQL (written inside programs of a host language).

 

Question 2: What is TCL?

Answer:

TCL stands for Transaction Control Language. It is the component of SQL that includes commands for specifying and controlling transactions (for example, COMMIT and ROLLBACK).

Exam Tips:

a) Write the full form first; in one-mark questions the expansion itself often carries the mark.

 

Question 3: Data dictionary is a special file in a DBMS. What is it used for?

Answer:

It stores the details of the tables (the structure of the database), that is, data about data (metadata).

Exam Tips:

a) Use the word "metadata" (data about data) when describing a data dictionary.

 

Question 4: What does the following statement mean?
Name VARCHAR(30)

Answer:

It is a column definition. The field Name can store up to 30 characters (variable length).

Exam Tips:

a) The number inside the brackets of VARCHAR is the maximum number of characters the column can hold.

 

Question 5: Is there any data type available in SQL to store your date of birth?

Answer:

Yes, the DATE data type.

Exam Tips:

a) DATE stores dates in the format YYYY-MM-DD; do not store dates as CHAR.

 

Question 6: Pick the odd one out.
(DEC, NUMBER, INT, DATE)

Answer:

DATE. All the others are numeric data types.

Exam Tips:

a) In odd-one-out questions, add a short reason even if it is not asked.

 

Question 7: How do you ensure that the field 'name' will always have some value?

Answer:

By using the constraint NOT NULL.

Exam Tips:

a) NOT NULL means the column can never be left empty.

 

Question 8: How do you set the default value of the column District in a table to Thrissur?

Answer:

District VARCHAR(30) DEFAULT 'Thrissur'

Exam Tips:

a) The DEFAULT constraint is written after the data type in the column definition, and the text value is enclosed in quotes.

 

Question 9: ______ symbol is used as the substitution operator in SQL.

Answer:

& (ampersand)

Exam Tips:

a) Do not confuse the substitution operator & with the wildcard characters % and _ used with LIKE.

 

Question 10: Is there any method to find the strings starting with the letter 'a' in a field in SQL?

Answer:

Yes. Use the LIKE operator: LIKE 'a%'

Exam Tips:

a) % stands for any number of characters, so 'a%' matches every string that begins with a.

 

Question 11: How do you check whether a particular field contains null values or not?

Answer:

Use the operator IS NULL (or IS NOT NULL).

Exam Tips:

a) Never write "= NULL"; NULL values can be tested only with IS NULL.

 

Question 12: The ORDER BY clause is used for ______.

Answer:

Sorting the result of a query in ascending (ASC) or descending (DESC) order.

Exam Tips:

a) ASC is the default order; DESC must be written when descending order is needed.

 

Question 13: The built-in functions in SQL that return just a single value for a group of rows in a table are called ______.

Answer:

Summary functions or aggregate functions

Exam Tips:

a) Remember the five aggregate functions: SUM(), AVG(), MAX(), MIN() and COUNT().

 

Question 14: How do you find the number of values in a column of a table?

Answer:

By using the function COUNT().

Exam Tips:

a) COUNT(column) counts only the non-NULL values in that column, while COUNT(*) counts all rows.

 

Question 15: ______ is the clause in SQL used for categorisation.

Answer:

GROUP BY

Exam Tips:

a) GROUP BY puts rows with the same value in a column into one group, usually along with an aggregate function.

 

Question 16: Thomas wants to remove a table that he was using. How can you help him do this?

Answer:

By using the DROP TABLE command.

Exam Tips:

a) DROP TABLE removes the whole table (structure and data); DELETE removes only rows.

 

Question 17: Pick the odd one out.
(SELECT, UPDATE, DELETE, DROP TABLE)

Answer:

DROP TABLE. It is a DDL command, while the others are DML commands.

Exam Tips:

a) Classify commands as DDL (CREATE, ALTER, DROP) or DML (SELECT, INSERT, UPDATE, DELETE) to find the odd one.

 

Question 18: Name the aggregate function that can be used to find the total number of records.

Answer:

COUNT()

Exam Tips:

a) Do not write SUM(); SUM adds values in a column, it does not count rows.

 

Question 19: Which of the following is an essential clause used with the SELECT command?
(GROUP BY, ORDER BY, WHERE, FROM)

Answer:

FROM

Exam Tips:

a) Every SELECT query needs FROM to name the table; the other clauses are optional.

 

Question 20: Which of the following is not a column constraint?
(CHECK, DISTINCT, UNIQUE, DEFAULT)

Answer:

DISTINCT

Exam Tips:

a) DISTINCT is a keyword used with SELECT, not a constraint used with CREATE TABLE.

 

Question 21: Which of the following is a DDL command?
(SELECT, UPDATE, CREATE TABLE, INSERT INTO)

Answer:

CREATE TABLE

Exam Tips:

a) DDL commands work on the structure of a table; DML commands work on the data in it.

 

Question 22: What are the logical operators used in SQL?

Answer:

AND, OR and NOT

Exam Tips:

a) Logical operators are used to combine two or more conditions in the WHERE clause.

 

Question 23: The ______ operator of SQL is used to match a pattern with the help of %. (February 2009)
(a) BETWEEN
(b) AND
(c) LIKE
(d) OR

Answer:

(c) LIKE

Exam Tips:

a) LIKE is always used with the wildcard characters % (any number of characters) and _ (exactly one character).

 

Question 24: The structure of a table Book is given below.

FieldType
BookNoInteger
TitleVarchar(200)
AuthorVarchar(100)
PriceDec(5, 2)

Write an SQL query to insert an additional column PurchaseDate of date type into the Book table.

Answer:

ALTER TABLE Book ADD (PurchaseDate DATE);

Exam Tips:

a) Adding a column changes the structure of the table, so use ALTER TABLE with ADD, not INSERT.

 

Question 25: Suppose we want to include a column in a table in which serial numbers are to be stored automatically when new records are added. Which constraint should be used for that column during table creation?

Answer:

The AUTO_INCREMENT constraint.

Exam Tips:

a) Only one AUTO_INCREMENT column is allowed in a table, and it is usually the primary key.

 

Question 26: Which of the following cannot be used to name a table in SQL? Give the reason.
(a) Studnt50
(b) Table
(c) $Employee
(d) Stock_123

Answer:

(b) Table – it is a keyword (reserved word), so it cannot be used as a table name.
(c) $Employee – it begins with a special character; a table name must begin with a letter and the only special character allowed is the underscore.

Exam Tips:

a) Check each option against the naming rules: no keywords, must start with a letter, no spaces, and no special characters except underscore.

 

Question 27: Which of the following commands is used to view the structure of a table?
(a) SHOW TABLES
(b) DESC
(c) SELECT
(d) DISPLAY

Answer:

(b) DESC

Exam Tips:

a) SHOW TABLES lists the tables in a database, while DESC (DESCRIBE) shows the columns of one table.

 

Question 28: The command to eliminate the table CUSTOMER from a database is:
(a) REMOVE TABLE CUSTOMER
(b) DROP TABLE CUSTOMER
(c) DELETE TABLE CUSTOMER
(d) UPDATE TABLE CUSTOMER

Answer:

(b) DROP TABLE CUSTOMER

Exam Tips:

a) There is no REMOVE TABLE or DELETE TABLE command in SQL; a table is removed only with DROP TABLE.

 

Question 29: Which SQL command is used to open a database?
(a) OPEN
(b) SHOW
(c) USE
(d) CREATE

Answer:

(c) USE

Exam Tips:

a) Syntax: USE database_name; this makes the database the current (active) one.

 

Question 30: Which keyword is used with the SELECT command to avoid duplicate rows in the result?

Answer:

DISTINCT

Exam Tips:

a) DISTINCT is written immediately after SELECT, for example SELECT DISTINCT Batch FROM Student;

 

Question 31: Pick the odd one out and write the reason.
(a) WHERE
(b) ORDER BY
(c) UPDATE
(d) GROUP BY

Answer:

(c) UPDATE. It is a command, while the others are clauses.

Exam Tips:

a) A command starts an SQL statement; a clause is only a part of a statement.

 

Question 32: Which of the following clauses is not used with the SELECT command in SQL?
(a) GROUP BY
(b) WHERE
(c) SET
(d) ORDER BY

Answer:

(c) SET. This clause is used with the UPDATE command.

Exam Tips:

a) Remember: UPDATE table SET column = value; SET belongs only to UPDATE.

 

Question 33: ______ operator in SQL is used with wildcard characters for selection of records.
(a) LIKE
(b) IN
(c) NOT IN
(d) IN and NOT IN

Answer:

(a) LIKE

Exam Tips:

a) IN and NOT IN check against a list of values; only LIKE works with wildcards.

 

Two Mark Questions and Answers

Question 34: How is SQL different from other high-level computer languages?

Answer:

SQL stands for Structured Query Language. It is a relational database language, not a general programming language like other high-level languages. It provides facilities to create tables, insert data into a table, retrieve information from a table, modify the data in a table, etc.

Exam Tips:

a) Stress that SQL is a non-procedural language: you say what data you want, not how to get it.
b) List two or three things SQL can do to show its purpose.

 

Question 35: Distinguish between the SQL keywords UNIQUE and DISTINCT.

Answer:

1. UNIQUE – It is a constraint that ensures no two rows have the same value in a column while storing data. It is used with the CREATE TABLE command.
2. DISTINCT – It is a keyword used to avoid duplicate values in a column while retrieving data. It is used with the SELECT command.

Exam Tips:

a) Mention the command each one is used with: UNIQUE with CREATE TABLE, DISTINCT with SELECT.
b) Point out the key difference: UNIQUE works while storing data, DISTINCT works while displaying data.

 

Question 36: Identify the errors in the following SQL statement and rewrite it correctly. Underline the corrections.
CREATE student TABLE (admno PRIMARY KEY, roll no INT, name CHAR);

Answer:

The correct SQL statement is:
CREATE TABLE student (admno INT PRIMARY KEY, roll_no INT, name CHAR(30));
Errors corrected:
1. The keyword TABLE must come before the table name.
2. The column admno has no data type.
3. A column name cannot contain a space (roll no is changed to roll_no).
4. A size is given for CHAR so that a full name can be stored (CHAR without size holds only one character).

Exam Tips:

a) Every column in CREATE TABLE needs a name followed by a data type.
b) Underline each correction as asked; marks are given for identifying each error.

 

Question 37: Suppose a column named Fee does not contain any value for some records in the table named STUDENT. Write an SQL statement to fill these blanks with 1000.

Answer:

UPDATE STUDENT SET Fee = 1000 WHERE Fee IS NULL;

Exam Tips:

a) Use IS NULL in the condition, not = NULL.
b) Without the WHERE clause, the fee of every student would become 1000.

 

Question 38: Identify the errors in the following SQL statement and give the reason for each error.
SELECT FROM STUDENT ORDER BY Group WHERE Marks above 50;

Answer:

Errors:
1. No column list or * is given after SELECT.
2. Group is a keyword, so it cannot be used as a column name in ORDER BY.
3. The WHERE clause must come before the ORDER BY clause.
4. "above" is not an SQL operator; the relational operator > must be used.
The correct query is:
SELECT * FROM STUDENT WHERE Marks > 50 ORDER BY Marks;

Exam Tips:

a) Remember the order of clauses: SELECT – FROM – WHERE – GROUP BY – HAVING – ORDER BY.
b) List each error with its reason before writing the corrected query.

 

Question 39: Differentiate between the CHAR and VARCHAR data types of SQL.

Answer:

1. CHAR – It is used to store a fixed number of characters. It is declared as CHAR(size). The full size is always allocated, even if the value is shorter.
2. VARCHAR – It is used to store a variable number of characters. It is declared as VARCHAR(size) and uses only as much memory as the actual value needs.

Exam Tips:

a) Key words: CHAR is fixed length, VARCHAR is variable length.
b) Mention that VARCHAR saves memory when the lengths of values vary.

 

Question 40: Assume that CUSTOMER is a table with columns Cust_code, Cust_name, Mob_No and Email. Write an SQL statement to add the details of a customer who has no e-mail id.

Answer:

INSERT INTO CUSTOMER VALUES (1001, 'ALVIS', 9876543210, NULL);

Exam Tips:

a) Write the keyword NULL (without quotes) for a missing value; 'NULL' in quotes would be stored as text.
b) Give the values in the same order as the columns of the table.

 

Question 41: Find the correct clause from the second column for each SQL command in the first column.

CommandClause
1. INSERTa. SET
2. SELECTb. FROM
3. UPDATEc. INTO
4. ALTERd. ADD

Answer:

CommandClause
1. INSERTc. INTO
2. SELECTb. FROM
3. UPDATEa. SET
4. ALTERd. ADD

Exam Tips:

a) Recall full statements: INSERT INTO, SELECT ... FROM, UPDATE ... SET, ALTER TABLE ... ADD.

 

Question 42: Is ALL a keyword in SQL? Explain.

Answer:

Yes. ALL is a keyword used with SELECT. It retains all the duplicate values of a field in the result. It is the default, and it is the opposite of DISTINCT.

Exam Tips:

a) Compare ALL with DISTINCT: ALL keeps duplicates, DISTINCT removes them.

 

Question 43: Differentiate between LIKE 'a%' and LIKE 'a_'.

Answer:

% stands for any number of characters, while _ stands for exactly one character.
LIKE 'a%' retrieves all strings of any length that start with the letter 'a'.
LIKE 'a_' retrieves all two-letter strings that start with the letter 'a'.

Exam Tips:

a) Give an example of each: 'apple' matches 'a%', while 'an' matches 'a_'.

 

Question 44: Is multiple sorting possible using the ORDER BY clause? Explain.

Answer:

Yes. It is done by giving more than one field name, separated by commas, in the ORDER BY clause. The rows are sorted by the first field, and rows with the same value in the first field are sorted by the second field.
Example: SELECT * FROM Student ORDER BY Batch, Percent DESC;

Exam Tips:

a) An example query makes this answer complete; each field can have its own ASC or DESC.

 

Question 45: While inserting records into a table, Raju finds that it is not possible to give more than 20 characters in the 'name' field. How can you help Raju solve this problem?

Answer:

Using the ALTER TABLE command with MODIFY, he can increase the width of the field so that it can hold more than 20 characters.
Example: ALTER TABLE Student MODIFY (name VARCHAR(40));

Exam Tips:

a) Changing the size or type of an existing column is done with ALTER TABLE ... MODIFY; adding a new column uses ADD.

 

Question 46: After executing a query, Mohan gets a message like 'Table Altered'. What would he have done? Give the syntax.

Answer:

He would have used the ALTER TABLE command.
Syntax:
ALTER TABLE <table_name> ADD (<column_name> <data_type> [<constraint>]);
ALTER TABLE <table_name> MODIFY (<column_name> <data_type> [<constraint>]);

Exam Tips:

a) Write the syntax with the table name and column definition placeholders; a bare "ALTER TABLE ADD" will not get full marks.

 

Question 47: During a discussion, one student said that the DELETE and DROP TABLE commands are the same. Do you agree? Justify.

Answer:

No. DROP TABLE removes the table entirely (structure and data) from the database, whereas the DELETE command removes only the records (rows) from an existing table; the table structure remains.

Exam Tips:

a) Mention that DROP TABLE is a DDL command and DELETE is a DML command.
b) State clearly "No, I do not agree" before the justification.

 

Question 48:
1. Pick the odd one out.
DROP TABLE, DELETE, ALTER TABLE, CREATE VIEW
2. Justify your answer.

Answer:

1. DELETE
2. DELETE is a DML command; all the others are DDL commands.

Exam Tips:

a) CREATE VIEW is also DDL because it creates a database object.

 

Question 49: Consider the following SQL statement.
DELETE Name
FROM Student
WHERE name = 'Raju"
Find the error in the SQL, if any, and correct it.

Answer:

Errors: DELETE removes whole rows, so a column name cannot be given after DELETE; also the string 'Raju" is not closed with a matching quote and the statement has no semicolon.
Correct statement:
DELETE FROM Student WHERE name = 'Raju';

Exam Tips:

a) To clear only one column value, use UPDATE ... SET column = NULL; DELETE always works on complete rows.
b) Check that quotes around text values match.

 

Question 50: Consider the following query in SQL.
SELECT Department, AVG(Salary) FROM Employee WHERE Branch = 'Kannur' GROUP BY Department HAVING AVG(Salary) > 7000;
Compare the WHERE clause and the HAVING clause using the above query.

Answer:

The WHERE clause applies to individual rows, while the HAVING clause applies to groups.
In this query, WHERE Branch = 'Kannur' first selects only the rows of employees in the Kannur branch. These rows are then grouped by Department, and HAVING AVG(Salary) > 7000 selects only those departments (groups) whose average salary is more than 7000.

Exam Tips:

a) Aggregate functions like AVG() can be used in HAVING but not in WHERE.
b) Explain the order: WHERE filters rows before grouping, HAVING filters groups after grouping.

 

Question 51: Some constraints in SQL are called column constraints and some are called table constraints. How do they differ?

Answer:

Column constraints are specified along with the definition of each column, and they apply only to that column.
Table constraints are specified once for the entire table at the end of the table definition, and they can apply to a group of columns.

Exam Tips:

a) Give an example: a primary key made of two columns, such as PRIMARY KEY (RollNo, Batch), must be a table constraint.

 

Question 52:
1. Choose the odd one from the following.
Primary key, Unique, Distinct, Default, Check
2. Justify your choice.

Answer:

1. Distinct
2. Distinct is used with the SELECT command, while the others are column constraints used with the CREATE TABLE command.

Exam Tips:

a) Constraints are rules on the data stored in a column; DISTINCT only affects how results are displayed.

 

Question 53: Name the most appropriate SQL data type required to store the following data.
1. Name of a student
2. Date of birth of a student
3. Roll No. of a student (in the range 1 to 50)
4. Percentage of marks obtained

Answer:

1. VARCHAR(70)
2. DATE
3. SMALLINT or INTEGER or DECIMAL(2)
4. DEC(5, 2)

Exam Tips:

a) DEC(5, 2) allows values up to 999.99, which is enough for percentages like 100.00.
b) Use VARCHAR for names because their lengths vary.

 

Question 54:
1. From the list given below, select the names that cannot be used as a table name.
Adm_No, Date, Salary2006, Table, Column_Name, Address
2. Justify your selection.

Answer:

1. Date, Table
2. DATE is the name of a data type and TABLE is a keyword used in commands like CREATE TABLE. Keywords (reserved words) cannot be used as table names.

Exam Tips:

a) The other names are valid because they start with a letter and use only letters, digits and underscore.

 

Question 55: Classify the following SQL elements into two groups and give a proper title for each category.
NOT NULL, AVG, COUNT, CHECK, SUM, DEFAULT

Answer:

Aggregate functionsColumn constraints
AVGNOT NULL
COUNTCHECK
SUMDEFAULT

Exam Tips:

a) Give the titles exactly; the titles carry marks along with the grouping.

 

Three Mark Questions and Answers

Question 56: As part of your school project, you are asked to create a table Student with the fields RollNo, Name, Date of Birth and Score in IT. The constraints required are: RollNo is the primary key, and Name cannot be empty.

Answer:

CREATE TABLE Student (RollNo DECIMAL(2) NOT NULL PRIMARY KEY, Name VARCHAR(20) NOT NULL, DOB DATE, Score NUMBER(2));

Exam Tips:

a) Field names cannot have spaces, so "Date of Birth" is written as DOB and "Score in IT" as Score.
b) Put each constraint right after the data type of its column.

 

Question 57: A table Employee consists of the fields EmployeeNo, Name, Designation and Salary. You are forced to give access to this table to an engineer from another company, but for security reasons you need to hide the Salary from him.
1. Name the concept that lets this engineer work on this table without viewing the salary.
2. Write the SQL query for implementing it.

Answer:

1. View
2. CREATE VIEW Empview AS SELECT EmployeeNo, Name, Designation FROM Employee;

Exam Tips:

a) A view is a virtual table; leaving out the Salary column in the SELECT hides it from the user of the view.

 

Question 58: A table named Student is given below.

Roll NoNameBatchPercent
1HariCommerce80
2BinuScience85
3SarithaHumanities
4VimalaScience90
5SinduScience75
6BijuCommerce77
7VinodHumanities

Write answers to the following questions based on the above table.
1. SQL statement to display the different courses available without duplication.
2. SQL statement to display the Name and Batch of the students whose percentage has a null value.
3. Output of the query SELECT COUNT(Percent) FROM Student;

Answer:

1. SELECT DISTINCT Batch FROM Student;
2. SELECT Name, Batch FROM Student WHERE Percent IS NULL;
3. 5 (COUNT ignores the two NULL values of Saritha and Vinod.)

Exam Tips:

a) COUNT(column) does not count NULL values, so 7 rows give a count of 5.
b) Use DISTINCT to list each batch only once.

 

Question 59: Once a table is created, two changes can be made in the schema of the table. What are they? Give the syntax.

Answer:

The table can be altered in two ways:
1. A new column can be added to the existing table.
Syntax: ALTER TABLE <table_name> ADD (<column_name> <data_type> [<constraint>]);
2. An existing column can be changed (modified) in terms of type or size.
Syntax: ALTER TABLE <table_name> MODIFY (<column_name> <data_type> [<constraint>]);

Exam Tips:

a) Both changes use ALTER TABLE; only the keyword ADD or MODIFY is different.
b) Write an example of each if time permits, such as ALTER TABLE Student ADD (Phone CHAR(10));

 

Question 60: Explain how pattern matching can be done in SQL, with an example.

Answer:

Pattern matching is done using the LIKE operator in the condition. For example, to display the names of all students whose names begin with the letters 'ma', we can write:
SELECT name FROM STUDENT WHERE name LIKE 'ma%';
Here the character '%' stands for any number of characters in the value of the column. The other wildcard character, '_' (underscore), stands for exactly one character.

Exam Tips:

a) Explain both wildcards, % and _, with what each one replaces.
b) Always enclose the pattern in quotes.

 

Question 61: During a study discussion, your friend says that a table and a view are the same. How can you correct him?

Answer:

Tables and views are different. A view is a virtual table derived from one or more physically existing tables (base tables). When we access a view, we actually access the base tables.
All DML commands can be used with views, but care should be taken because the operations are actually carried out on the base tables.
The advantage of a view is that, without using extra storage space, the same table can be used as different virtual tables. It also allows sharing of data along with privacy.

Exam Tips:

a) Key point: a table physically stores data, a view does not; it only shows data from base tables.
b) Mention one use of views, such as hiding sensitive columns.

 

Question 62: Find the errors, if any, in the following code.
CREATE TABLE emp (name CHAR, RollNo INT(20));

Answer:

1. The size of the CHAR data type of the field name is missing, so it can store only one character.
2. The data type INT does not take a size argument.
The correct statement is:
CREATE TABLE emp (name CHAR(20), RollNo INT);

Exam Tips:

a) Remember which types take a size: CHAR, VARCHAR and DEC do; INT, SMALLINT and DATE do not.

 

Question 63: Consider the following variable declarations in SQL.
a. name CHAR(25)
b. name VARCHAR(25)
1. Considering the use of memory, which declaration is more suitable?
2. Justify your answer.

Answer:

1. name VARCHAR(25)
2. CHAR is a fixed-length data type. It always allocates memory for the maximum size, here 25 characters, so memory may be wasted for shorter names. VARCHAR allocates only enough memory to store the actual value.

Exam Tips:

a) Give an example: the name 'Anu' uses 25 character spaces in CHAR(25) but only 3 in VARCHAR(25).

 

Question 64: Mr. Dilip wants to create a table and apply some restrictions on it:
1. A column can never have empty values.
2. One of the columns must be a key to identify the rows.
Can you help him create a table satisfying the above restrictions, with an example?

Answer:

1. Use the NOT NULL constraint in CREATE TABLE.
2. Use the PRIMARY KEY constraint.
Example:
CREATE TABLE employee (RollNo DECIMAL(3) NOT NULL PRIMARY KEY, Name VARCHAR(70) NOT NULL, Design VARCHAR(30), DOB DATE, Salary DEC(7,2));

Exam Tips:

a) A PRIMARY KEY column is automatically NOT NULL and UNIQUE.
b) Name the constraint for each restriction before giving the full query.

 

Question 65: Write an SQL query to create a table Student with the fields RegNo, StudName, Sex, Course, Grade, etc. as per the following conditions:
1. RegNo should not be empty and any row in the table can be identified using this column.
2. Student name should always have some value.
3. The default value of Sex should be Female.
4. Grade should be any of the values: A+, A, B+, B, C+, C, D+, D, E

Answer:

CREATE TABLE Student (RegNo DECIMAL(4) NOT NULL PRIMARY KEY, StudName VARCHAR(70) NOT NULL, Sex VARCHAR(6) DEFAULT 'Female', Course VARCHAR(20), Grade CHAR(2) CHECK (Grade IN ('A+', 'A', 'B+', 'B', 'C+', 'C', 'D+', 'D', 'E')));

Exam Tips:

a) Map each condition to a constraint: PRIMARY KEY, NOT NULL, DEFAULT and CHECK.
b) Make sure the column size is large enough for the default value ('Female' needs at least 6 characters).

 

Question 66: Ramu created a table employee with the fields empId, empname, Designation and salary using SQL statements. Later he found that the data type of empId was typed as Integer instead of character and that he had missed a field 'Department'. Can you help him solve this problem without recreating the 'employee' table?

Answer:

ALTER TABLE employee MODIFY (empId CHAR(4));
ALTER TABLE employee ADD (Department CHAR(15));

Exam Tips:

a) Use MODIFY to change the data type of an existing column and ADD to insert a new column.

 

Question 67: While creating a table, Alvis gives "Emp Details" as the table name. Is it possible? Write down the rules for naming a table.

Answer:

It is not possible because there is a space between Emp and Details.
The rules for naming a table are:
1. It must not be a keyword (keywords are reserved words with a predefined meaning).
2. It must begin with a letter.
3. Digits can be used after the letters.
4. Special characters (including spaces) cannot be used, except the underscore.
5. It must not be the name of another existing table.

Exam Tips:

a) Suggest a valid name such as Emp_Details to show you understand the rule.

 

Five Mark Questions and Answers

Question 68: Consider the table ITEMS.

Item_CodeNameCategoryUnit_PriceSales_Price
0001PencilStationery5.008.00
0002PenStationery8.0010.00
0003NotebookStationery10.0020.00
0004ChappalFootwear50.0070.00
0005AppleFruits60.0090.00
0006OrangeFruits40.0060.00
0007PenStationery10.009.00

Write the output of the following queries.
a) SELECT ITEM_CODE, NAME FROM ITEMS WHERE CATEGORY = 'Stationery';
b) SELECT * FROM ITEMS WHERE SALES_PRICE < UNIT_PRICE;
c) SELECT CATEGORY, COUNT(*) FROM ITEMS GROUP BY CATEGORY;

Answer:

a)

Item_CodeName
0001Pencil
0002Pen
0003Notebook
0007Pen

b)

Item_CodeNameCategoryUnit_PriceSales_Price
0007PenStationery10.009.00

c)

CategoryCount(*)
Stationery4
Footwear1
Fruits2

Exam Tips:

a) Go through the table row by row and tick the rows that satisfy each condition before writing the output.
b) In (b), only item 0007 is sold below its unit price (9.00 < 10.00).
c) Show the output with column headings, as a table.

 

Question 69: Write SQL queries to:
1. Create a table Employee with the fields given below.

FieldType
EmpNoInteger
NameCharacter of size 70
DesignationCharacter of size 30
Date of birthDate
SalaryDecimal (7,2)

2. List the names of all employees whose name's second letter is 'a'.
3. List the Name and Designation of employees whose Designation is not 'Manager'.
4. Increase the salary of all employees by 10 percent.
5. Remove all managers whose salary is less than Rs. 10,000 from the table.

Answer:

1. CREATE TABLE Employee (EmpNo INT, Name VARCHAR(70), Desgn VARCHAR(30), DOB DATE, Salary DEC(7,2));
2. SELECT Name FROM Employee WHERE Name LIKE '_a%';
3. SELECT Name, Desgn FROM Employee WHERE Desgn <> 'Manager';
4. UPDATE Employee SET Salary = Salary + Salary * 0.10;
5. DELETE FROM Employee WHERE Desgn = 'Manager' AND Salary < 10000;

Exam Tips:

a) For "second letter is 'a'", use one underscore before a: '_a%'.
b) 10 percent is 0.10, not 0.01; check such calculations carefully.
c) Use <> (or !=) for "not equal to".

 

Question 70: A table Student consists of the fields RollNo, Name, Batch and Percent. Write SQL statements to:
1. Display RollNo and Name of students whose percentage is less than 90 and greater than 70.
2. Display RollNo and Name of all students in the science batch whose percentage is more than 90.
3. Display the names of all students in the commerce and science batches.
4. Display the average percent of students in each batch.
5. Display RollNo and Name in ascending order of Batch and descending order of Percent.

Answer:

1. SELECT RollNo, Name FROM Student WHERE Percent < 90 AND Percent > 70;
2. SELECT RollNo, Name FROM Student WHERE Batch = 'Science' AND Percent > 90;
3. SELECT Name FROM Student WHERE Batch = 'Science' OR Batch = 'Commerce';
4. SELECT Batch, AVG(Percent) FROM Student GROUP BY Batch;
5. SELECT RollNo, Name FROM Student ORDER BY Batch, Percent DESC;

Exam Tips:

a) With OR, repeat the column name in each condition; "Batch = 'Science' OR 'Commerce'" is wrong.
b) Query 1 can also be written using BETWEEN 71 AND 89 for whole-number percentages, but AND with < and > is exact.
c) Each column in ORDER BY can have its own ASC/DESC.

 

Question 71:
1. Classify the following SQL commands.
CREATE TABLE, INSERT INTO, ALTER TABLE, DELETE, UPDATE, DROP TABLE, SELECT
2. List the features of each category.

Answer:

1. DDL – CREATE TABLE, ALTER TABLE, DROP TABLE
DML – INSERT INTO, DELETE, UPDATE, SELECT

2. DDL (Data Definition Language) is used to create the structure of a table, modify the structure of a table and delete the structure of a table.
DML (Data Manipulation Language) is used to insert records into a table, modify the records of a table, delete records from a table and retrieve records from a table.

Exam Tips:

a) Write the full forms DDL and DML.
b) Key idea: DDL deals with structure, DML deals with data.

 

Question 72: Explain the available database integrity constraints.

Answer:

1. NOT NULL: It specifies that a column can never have null (empty) values.
2. UNIQUE: It ensures that no two rows have the same value in the specified column.
3. PRIMARY KEY: It declares a column or a set of columns as the primary key of the table. This constraint makes a column NOT NULL and UNIQUE.
4. DEFAULT: It sets a default value for a column when the user does not enter a value for that column.
5. AUTO_INCREMENT: It automatically increases the value in a column for each new record, generating serial numbers. Only one AUTO_INCREMENT column is allowed per table.

Exam Tips:

a) Give a one-line example for each constraint, such as Name VARCHAR(30) NOT NULL.
b) CHECK is another constraint you can mention; it restricts values to a given condition.

 

Question 73: Consider a table Student with the fields RegNo, StudName, Sex, Course and TotalScore. Write SQL queries for the following:
1. Enter a record.
2. List the details of all students.
3. Display the details of the students whose names end with 'Kumar'.
4. List all female students who got more than 50 marks.
5. List all students who are studying in either the Science or the Commerce group.
6. List the details of the students who are studying Humanities, in descending order of their names.

Answer:

1. INSERT INTO Student VALUES (52, 'JOSE', 'Male', 'Science', 500);
2. SELECT * FROM Student;
3. SELECT * FROM Student WHERE StudName LIKE '%Kumar';
4. SELECT * FROM Student WHERE Sex = 'Female' AND TotalScore > 50;
5. SELECT * FROM Student WHERE Course = 'Science' OR Course = 'Commerce';
6. SELECT * FROM Student WHERE Course = 'Humanities' ORDER BY StudName DESC;

Exam Tips:

a) For "ends with", put % before the text: '%Kumar'.
b) Use the same column names as in the question in every query.

 

Question 74: Create a table Product with the following fields using SQL:
Product code – an alphanumeric code
Product name – a maximum of 30 letters
Unit price – numeric values
Quantity – numeric values
Product price – numeric values
Write queries for the following:
1. Enter 5 records in the table (without giving values for product price).
2. Calculate the product price (unit price × quantity).
3. List all products whose unit price ranges from 10 to 20.
4. Calculate the total price of all products.

Answer:

CREATE TABLE Product (ProdCode VARCHAR(20) NOT NULL PRIMARY KEY, ProdName CHAR(30), UPrice DECIMAL(7,2), Qty DECIMAL(6), ProdPrice DECIMAL(7,2));
1. INSERT INTO Product (ProdCode, ProdName, UPrice, Qty) VALUES ('101', 'LUX', 29.50, 500);
Similarly, insert four more records.
2. UPDATE Product SET ProdPrice = Qty * UPrice;
3. SELECT ProdName FROM Product WHERE UPrice BETWEEN 10 AND 20;
4. SELECT SUM(ProdPrice) FROM Product;

Exam Tips:

a) When values are given for only some columns, list those column names after the table name in INSERT.
b) BETWEEN includes both end values (10 and 20).
c) Use UPDATE with an expression to calculate a column from other columns.

 

Question 75: Mr. Wilson wants to store the details of students. The details consist of different types of data. Explain the different data types used in SQL to store data.

Answer:

The different data types are:
1. CHAR (fixed length): It is declared as CHAR(size) and is used to store alphanumeric characters. The size has to be specified; if no size is given, only one character can be stored. Eg: name CHAR(20)
2. VARCHAR (variable length): It is declared as VARCHAR(size) and is also used to store alphanumeric characters, but it allocates only enough memory to store the actual value. Eg: name VARCHAR(20)
3. DECIMAL: It is declared as DEC(size, scale), where size is the total number of digits and scale is the maximum number of digits to the right of the decimal point. Eg: weight DEC(3, 2)
4. INTEGER: It is declared as INT and takes no arguments. It takes more memory than SMALLINT. Eg: RollNo INT
5. SMALL INTEGER: It is declared as SMALLINT and takes less memory. Eg: RollNo SMALLINT
6. DATE: It is used to store dates. Eg: DOB DATE
7. TIME: It is used to store time. Eg: Joining_Time TIME

Exam Tips:

a) Give the declaration form and an example for every data type.
b) Group them as character types (CHAR, VARCHAR), numeric types (DEC, INT, SMALLINT) and date/time types (DATE, TIME).

 

Question 76: A company wants to create a table to store its employees' details. Write SQL commands for the following:
1. Create a table EMP with the fields EMPNO varchar(10) primary key, Name varchar(20), Salary number(6), Department varchar(3).
2. Insert values into the table.
3. List all employees whose salary is more than 10,000.
4. Display name and salary in the order of name.

Answer:

1. CREATE TABLE EMP (EMPNO VARCHAR(10) NOT NULL PRIMARY KEY, Name VARCHAR(20), Salary DECIMAL(6), Department VARCHAR(3));
2. INSERT INTO EMP VALUES ('1001', 'ALVIS', 50000, 'SAL');
3. SELECT * FROM EMP WHERE Salary > 10000;
4. SELECT Name, Salary FROM EMP ORDER BY Name;

Exam Tips:

a) Make sure inserted values fit the column sizes declared in CREATE TABLE.
b) Text values are written in quotes, numbers without quotes.

 

Question 77: Create a table 'Savings' with the following fields: AccNo (Integer), Name (char), Age (Integer) and Balance (Number), where AccNo is the primary key. Write SQL commands for the following:
1. Insert data into all the fields for 3 records.
2. Display the list of account holders in the ascending order of their names.
3. Display the list of all account holders having age between 20 and 30.
4. Display the name and AccNo of customers having a balance of more than 10 lakhs.

Answer:

CREATE TABLE Savings (AccNo DECIMAL(4) NOT NULL PRIMARY KEY, Name CHAR(30), Age DECIMAL(3), Balance DECIMAL(10,2));
1. INSERT INTO Savings VALUES (501, 'Andrea', 18, 45000);
INSERT INTO Savings VALUES (502, 'Bincy', 25, 1500000);
INSERT INTO Savings VALUES (503, 'Clinton', 32, 800000);
2. SELECT * FROM Savings ORDER BY Name;
3. SELECT * FROM Savings WHERE Age BETWEEN 20 AND 30;
4. SELECT Name, AccNo FROM Savings WHERE Balance > 1000000;

Exam Tips:

a) 10 lakhs = 10,00,000 = 1000000; count the zeros carefully.
b) Separate column names in SELECT with commas, not dots.
c) Choose a size for Balance large enough to hold amounts above 10 lakhs.

 

Question 78: What are the components of SQL? How do they help to manage a database?

Answer:

The components of SQL are:

a) DDL (Data Definition Language) commands:
1. CREATE TABLE – used to create a table.
2. ALTER TABLE – used to modify an existing column or add a new column to an existing table. The two keywords used are ADD and MODIFY.
3. DROP TABLE – used to remove a table from the database.

b) DML (Data Manipulation Language) commands:
1. SELECT – used to select rows from a table. The keyword FROM is used with it, and the WHERE clause is used to specify the condition.
2. INSERT – used to insert new records into a table. The keyword used with it is INTO.
3. DELETE – used to delete records from a table.
4. UPDATE – used to modify the records in a table. The keyword used with it is SET.

c) DCL (Data Control Language) commands:
1. GRANT – gives users permission to access the database.
2. REVOKE – withdraws the rights given to users by the GRANT command.

Exam Tips:

a) Write the full form of each component with its commands and their uses.
b) You may also mention TCL (Transaction Control Language) with COMMIT and ROLLBACK as another component.

 

Step-by-Step Textbook Answers: Class 12 Computer Science Chapter 09 Structured Query Language

Textbook Solutions for Class 12 Computer Science Chapter 09 Structured Query Language

Explore reliable textbook solutions for Chapter 09 Structured Query Language tailored for Class 12 learners. Utilizing these complete exercise answers ensures your preparation aligns exactly with official Kerala Board standards for Computer Science.

Mastering Theoretical and Practical Questions

Clear, methodical explanations accompany every challenging problem within the Class 12 Computer Science text. Engaging with these detailed answers lays a solid foundation for advanced learning and improves foundational clarity for upcoming assessments.

Effective Self-Study and Homework Assistance

Frequent review of these structured answers builds strong analytical capabilities and response efficiency. Maximize your academic readiness by combining these textbook solutions with our curated study materials and mock evaluations for Class 12 Computer Science.

FAQs

Where can I find the latest Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers for the 2026-27 session?

The complete and updated Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers is available for free on StudiesToday.com. These solutions for Class 12 Computer Science are as per latest Kerala Board curriculum.

Are the Computer Science Kerala Board solutions for Class 12 updated for the new 50% competency-based exam pattern?

Yes, our experts have revised the Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers as per 2026 exam pattern. All textbook exercises have been solved and have added explanation about how the Computer Science concepts are applied in case-study and assertion-reasoning questions.

How do these Class 12 Kerala Board solutions help in scoring 90% plus marks?

Toppers recommend using Kerala Board language because Kerala Board marking schemes are strictly based on textbook definitions. Our Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers will help students to get full marks in the theory paper.

Do you offer Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers in multiple languages like Hindi and English?

Yes, we provide bilingual support for Class 12 Computer Science. You can access Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers in both English and Hindi medium.

Is it possible to download the Computer Science Kerala Board solutions for Class 12 as a PDF?

Yes, you can download the entire Kerala Plus Two Computer Science Chapter 9 Structured Query Language Questions and Answers in printable PDF format for offline study on any device.