Database Fundamentals

1. Review of 1st Year RDBMS

Before diving into advanced topics, let's briefly review the foundational concepts of Relational Database Management Systems (RDBMS):

  • Database: An organized collection of interrelated data.
  • Table (Relation): A collection of data organized in rows and columns.
  • Row/Tuple: A single record in a table containing data for one entity.
  • Column/Attribute: A specific property or characteristic of an entity.
  • Primary Key: A column (or set of columns) that uniquely identifies each row in a table. It cannot contain NULL values.
  • Foreign Key: A column that references the primary key of another table, establishing a relationship between the two tables.
  • SQL Commands: Divided into DDL (Data Definition Language - CREATE, ALTER, DROP) and DML (Data Manipulation Language - INSERT, UPDATE, DELETE).

2. Database Transactions

A Transaction is a single logical unit of work consisting of one or more SQL operations. For example, transferring money from one bank account to another involves two operations: debiting one account and crediting the other. Both must succeed, or neither should occur.

ACID Properties of Transactions:
  • Atomicity: All operations succeed or all fail ("all-or-nothing").
  • Consistency: The database remains in a valid state before and after the transaction.
  • Isolation: Concurrent transactions execute independently and do not interfere with each other.
  • Durability: Once a transaction is committed, changes are permanent even in case of a system failure.

Transaction Control Commands (TCL)

  • START TRANSACTION (or BEGIN): Marks the start of a transaction.
  • COMMIT: Makes all changes performed in the transaction permanent. Cannot be undone.
  • ROLLBACK: Undoes all changes made since the last COMMIT or START TRANSACTION, restoring the database to its previous state.
  • SAVEPOINT name: Creates a bookmark within a transaction, allowing you to roll back to this specific point.
  • ROLLBACK TO SAVEPOINT name: Undoes changes only up to the specified savepoint.

Auto-commit in MySQL: By default, MySQL automatically commits each SQL statement as it is executed. To perform multi-statement transactions, you must explicitly start a transaction or disable auto-commit using SET autocommit=0;.

-- Example of a Bank Transfer Transaction
START TRANSACTION;
UPDATE account SET balance = balance - 5000 WHERE acno = 'A001';  -- Debit
UPDATE account SET balance = balance + 5000 WHERE acno = 'A002';  -- Credit
COMMIT;  -- Save both operations permanently
-- If an error occurred, you would use ROLLBACK to undo both

3. GROUP BY Clause

The GROUP BY clause groups rows with the same values in specified columns into summary rows. It is primarily used with aggregate functions (like SUM, COUNT, AVG) to calculate statistics for each group.

Syntax: SELECT column, aggregate_fn(column) FROM table GROUP BY column;

Rule: Any non-aggregated column present in the SELECT list must also appear in the GROUP BY clause.

-- Calculate average marks for each class
SELECT class, AVG(marks) AS avg_marks FROM student GROUP BY class;

-- Count total employees in each department
SELECT dept, COUNT(*) AS total_employees FROM employee GROUP BY dept;

HAVING Clause vs WHERE Clause

Feature WHERE Clause HAVING Clause
Purpose Filters individual rows before grouping Filters groups after grouping is performed
Use with Aggregate Functions Cannot contain aggregate functions Can (and often does) contain aggregate functions
Execution Order Executed before GROUP BY Executed after GROUP BY
-- Find classes where the average marks are greater than 70
SELECT class, AVG(marks) FROM student 
GROUP BY class 
HAVING AVG(marks) > 70;

4. Group/Aggregate Functions

Aggregate functions perform a calculation on a set of values and return a single summarizing value.

Function Syntax Ignores NULL? Use Case / Example
MAX() MAX(column) Yes Returns highest value.
SELECT MAX(marks) FROM student;
MIN() MIN(column) Yes Returns lowest value.
SELECT MIN(salary) FROM employee;
AVG() AVG(column) Yes Returns arithmetic mean.
SELECT AVG(marks) FROM student;
SUM() SUM(column) Yes Returns total sum.
SELECT SUM(salary) FROM employee WHERE dept='IT';
COUNT(*) COUNT(*) No Counts ALL rows (including NULLs and duplicates).
SELECT COUNT(*) FROM student;
COUNT(col) COUNT(column) Yes Counts non-NULL values in the column.
SELECT COUNT(marks) FROM student;
COUNT(DISTINCT) COUNT(DISTINCT col) Yes Counts unique non-NULL values.
SELECT COUNT(DISTINCT class) FROM student;

5. Displaying Data from Multiple Tables

a) Cartesian Product (Cross Join)

Combines every row of the first table with every row of the second table. This happens when you select from multiple tables without specifying a WHERE condition to link them.

Resulting Rows = (Rows in Table 1) × (Rows in Table 2). If Student has 3 rows and Subject has 4 rows, the result has 3 × 4 = 12 rows.

Syntax: SELECT * FROM table1, table2;

Usually undesired because it creates meaningless combinations. Corrected by using a JOIN condition.

b) UNION Clause

Combines the result sets of two or more SELECT statements into a single result set.

  • Rules: The SELECT statements must have the same number of columns, and the columns must have compatible data types.
  • UNION: Removes duplicate rows from the combined result.
  • UNION ALL: Keeps all rows, including duplicates (executes faster).
SELECT name FROM student
UNION
SELECT name FROM teacher;

c) Equi-Join (Inner Join)

Retrieves matching rows from two tables based on equal values in related columns (usually the Foreign Key in the child table matching the Primary Key in the parent table). This is the most common type of join.

-- Old style using WHERE clause
SELECT student.name, marks.subject, marks.score
FROM student, marks
WHERE student.rollno = marks.rollno;

-- Modern ANSI JOIN style (Recommended)
SELECT s.name, m.subject, m.score
FROM student s
INNER JOIN marks m ON s.rollno = m.rollno;

Note: s and m are table aliases used to shorten the query syntax.

d) Foreign Key Context in Joins

A foreign key in a child table references a primary key in a parent table. Joins work by linking these related keys. This enforces referential integrity, ensuring you cannot insert a foreign key value that does not exist in the parent's primary key column, and you cannot delete a parent row if a child row references it.


Introduction to MySQL - Advanced

1. Working with NULL Values

NULL represents the absence of a value. It is not zero, not an empty string, and not false; it simply means the value is unknown or unassigned.

  • IS NULL: Used to check for NULL values. You cannot use = NULL.
  • IS NOT NULL: Used to check for non-null values.
  • IFNULL(column, value): Returns the specified value if the column is NULL; otherwise, it returns the column value.
  • COALESCE(val1, val2, ...): Returns the first non-null value from the provided list.
SELECT * FROM student WHERE marks IS NULL;
SELECT * FROM student WHERE phone IS NOT NULL;
SELECT name, IFNULL(marks, 0) AS marks FROM student; -- Shows 0 instead of NULL

2. ORDER BY Clause

Sorts the result set returned by a SELECT query by one or more columns.

  • ASC (Ascending): A-Z, 0-9. This is the default sort order.
  • DESC (Descending): Z-A, 9-0.

Sorting Rules: In ASC order, NULL values appear FIRST. In DESC order, NULL values appear LAST.

-- Sort by marks descending
SELECT * FROM student ORDER BY marks DESC;

-- Sort using column alias
SELECT name, marks*1.2 AS grade FROM student ORDER BY grade DESC;

-- Multiple column sort: Sort by class ASC, then by marks DESC within each class
SELECT * FROM student ORDER BY class ASC, marks DESC;

3. DML Updates (UPDATE and DELETE)

UPDATE Command

Modifies existing data in a table.

WARNING: Without a WHERE clause, ALL rows in the table will be updated!

UPDATE student SET marks = 95 WHERE rollno = 1;
UPDATE student SET class = class + 1;    -- Promotes ALL students
UPDATE employee SET salary = salary * 1.1 WHERE dept = 'IT';  -- 10% raise

DELETE Command

Removes rows from a table based on a condition.

WARNING: Without a WHERE clause, ALL rows are deleted, but the table structure remains.

DELETE FROM student WHERE rollno = 5;
DELETE FROM student WHERE marks < 33;  -- Delete all failed students
DELETE vs TRUNCATE vs DROP
Feature DELETE TRUNCATE DROP
Command Type DML DDL DDL
Action Removes specific rows (or all) Removes all rows and resets auto-increment Removes table structure and all data
WHERE Clause Allowed Not Allowed Not Allowed
Rollback Yes (within transaction) No No

4. ALTER TABLE Command (DDL)

Modifies the existing structure of a table without deleting and recreating it.

-- Add a new column
ALTER TABLE student ADD email VARCHAR(100);
ALTER TABLE student ADD phone CHAR(10) AFTER name;

-- Remove a column
ALTER TABLE student DROP COLUMN phone;

-- Change data type of a column
ALTER TABLE student MODIFY marks DECIMAL(5,2);

-- Rename a column (MySQL 8.0+)
ALTER TABLE student RENAME COLUMN rollno TO student_id;

Note: To permanently delete an entire table, use DROP TABLE student; or safely use DROP TABLE IF EXISTS student;.

5. MySQL String Functions

Function Description Example & Result
ASCII(str) Returns ASCII numeric value of first character ASCII('A') → 65
CHAR(n) Returns character for ASCII code CHAR(65) → 'A'
CONCAT(s1, s2...) Joins multiple strings together CONCAT('Hi', ' ', 'all') → 'Hi all'
INSTR(str, sub) Returns 1-indexed position of first occurrence (0 if not found) INSTR('NextNote', 'Note') → 5
LCASE() / LOWER() Converts string to lowercase LOWER('IT') → 'it'
UCASE() / UPPER() Converts string to uppercase UPPER('sql') → 'SQL'
LENGTH(str) Returns length in bytes/characters LENGTH('Next') → 4
LTRIM(str) Removes leading (left) whitespace LTRIM(' A') → 'A'
RTRIM(str) Removes trailing (right) whitespace RTRIM('A ') → 'A'
TRIM(str) Removes both leading and trailing whitespace TRIM(' A ') → 'A'
MID() / SUBSTR() / SUBSTRING() Extracts a substring: (string, start_pos, length) MID('NextNote', 5, 4) → 'Note'
RIGHT(str, n) Returns rightmost n characters RIGHT('NextNote', 4) → 'Note'
LEFT(str, n) Returns leftmost n characters LEFT('NextNote', 4) → 'Next'
REPLACE(str, from, to) Replaces all occurrences of substring REPLACE('A B', 'B', 'C') → 'A C'
REVERSE(str) Reverses the string REVERSE('Cat') → 'taC'

6. MySQL Mathematical Functions

Function Description Example & Result
POWER(b, e) / POW(b, e) Returns base raised to exponent POW(2, 8) → 256
ROUND(n, d) Rounds number to d decimal places ROUND(3.141, 2) → 3.14; ROUND(3.5) → 4
TRUNCATE(n, d) Truncates number to d decimal places (no rounding) TRUNCATE(3.99, 1) → 3.9
SQRT(n) Returns square root SQRT(16) → 4
ABS(n) Returns absolute value ABS(-7) → 7
CEIL() / CEILING() Rounds UP to nearest integer CEIL(3.1) → 4
FLOOR(n) Rounds DOWN to nearest integer FLOOR(3.9) → 3
MOD(n, m) Returns remainder of division MOD(10, 3) → 1

7. MySQL Date and Time Functions

Function Description Example Result Format
CURDATE() / CURRENT_DATE() Returns current date '2025-07-25'
NOW() / SYSDATE() Returns current date and time '2025-07-25 10:30:00'
MONTH(date) Returns month number (1-12) MONTH('2025-07-25') → 7
DAY(date) / DAYOFMONTH() Returns day of month (1-31) DAY('2025-07-25') → 25
DAYOFWEEK(date) Returns day of week (1=Sun, 2=Mon... 7=Sat) DAYOFWEEK('2025-07-25') → 6 (Friday)
DAYOFYEAR(date) Returns day of year (1-366) DAYOFYEAR('2025-07-25') → 206
YEAR(date) Returns year part YEAR('2025-07-25') → 2025
DATEDIFF(date1, date2) Returns number of days between two dates DATEDIFF('2025-12-31', '2025-01-01') → 364
DATE_FORMAT(date, format) Formats a date according to format string DATE_FORMAT(CURDATE(), '%d/%m/%Y') → '25/07/2025'
-- Find out how many days old each student is:
SELECT name, DATEDIFF(CURDATE(), dob) AS days_old FROM student;

-- Find orders placed in July:
SELECT * FROM orders WHERE MONTH(order_date) = 7;

Key Exam Points (15+ Expected Questions)

  1. What is a transaction? List and explain the ACID properties.
  2. Differentiate between COMMIT and ROLLBACK.
  3. Explain the use of the SAVEPOINT command with an example.
  4. What is the difference between WHERE and HAVING clause?
  5. Which aggregate function includes NULL values in its count? (Answer: COUNT(*))
  6. Write the syntax and use case for Cartesian Product. Why is it generally avoided?
  7. How does UNION differ from UNION ALL?
  8. Define an Equi-Join. Provide an SQL query example.
  9. How do you check if a column contains a NULL value in MySQL?
  10. What is the default sort order for the ORDER BY clause? Where do NULLs appear in DESC sorting?
  11. Write an SQL statement to add a new column 'address' to an existing table.
  12. Compare DELETE, TRUNCATE, and DROP commands.
  13. What will be the output of SELECT INSTR('CHSE', 'S');? (Answer: 3)
  14. Differentiate between ROUND() and TRUNCATE() math functions.
  15. Write an SQL command to display the current date and time. (Answer: SELECT NOW();)
  16. How do you extract the rightmost 4 characters of a string in SQL?

Official CHSE Odisha IT Question Bank — Unit 3 Solved Paper

Complete exam-oriented solutions (Paper-I & Paper-II) with textbook errata corrections for Class 12 Board Exams.
Full Printable Solved Paper (372 Qs)
65 Total Solved Q&As 40 Paper-I (MCQ / Blanks / 1M) 23 Paper-II Objective 2 Long Board Subjective

Paper-II Full Long Subjective Answers (CHSE Board Pattern)

Paper II · Unit 3 Board Subjective (5–7M)
Q1. What is a database transaction? What is meant by committing and revoking a transaction? How are they achieved using COMMIT and ROLLBACK statements?
CHSE Exam-Oriented Model Answer:

Database Transaction: A logical single unit of work (e.g., transferring ₹5,000 from Account A to Account B) comprising one or more SQL statements that must follow ACID properties (Atomicity, Consistency, Isolation, Durability) — either ALL succeed together or NONE take effect.

  • Committing (`COMMIT`): Confirms all steps completed cleanly and permanently writes changes to disk so other users see the updated state.
  • Revoking / Undoing (`ROLLBACK`): Cancels uncommitted statements upon error or failure, restoring the database cleanly back to its pre-transaction state (or to a named SAVEPOINT).
START TRANSACTION;
UPDATE accounts SET balance = balance - 5000 WHERE acc_no = 101;
SAVEPOINT step1;
UPDATE accounts SET balance = balance + 5000 WHERE acc_no = 202;
-- If second update fails:
ROLLBACK TO step1;   -- partial undo, OR full ROLLBACK;
-- If both succeed:
COMMIT;
Paper II · Unit 3 Board Subjective (5–7M)
Q2. What are the four significant subsets of SQL?
CHSE Exam-Oriented Model Answer:
SubsetPurposePrimary Commands & Example
1. DDL (Data Definition Language)Defines or alters table/database structureCREATE, ALTER, DROP, TRUNCATE
e.g., CREATE TABLE emp(id INT PRIMARY KEY, name VARCHAR(40));
2. DML (Data Manipulation Language)Reads, inserts, updates, or deletes data rowsSELECT, INSERT, UPDATE, DELETE
e.g., INSERT INTO emp VALUES(1, 'Ritu');
3. DCL (Data Control Language)Controls database user access privilegesGRANT, REVOKE
e.g., GRANT SELECT ON emp TO user1;
4. TCL (Transaction Control Language)Manages transaction atomicity & recoverySTART TRANSACTION, COMMIT, ROLLBACK, SAVEPOINT
Solved Paper-I Workbook Questions — MCQs, Blanks & 1-Mark (40 Qs) Click to Toggle
Paper I · Unit 3 MCQ (1M)
Q1. Which of the following is generally used for performing tasks like creating the structure of the relations, deleting relation?
(a) DML (Data Manipulation Language)
(b) Query
(c) Relational Schema
(d) DDL (Data Definition Language)
Answer: (d) DDL (Data Definition Language)
Exam Concept: DDL (CREATE, ALTER, DROP, TRUNCATE) defines and modifies the table structure/schema.
Paper I · Unit 3 MCQ (1M)
Q2. Which of the following provides the ability to query information from the database and insert tuples into, delete tuples from, and modify tuples in the database?
(a) DML (Data Manipulation Language)
(b) DDL (Data Definition Language)
(c) Query
(d) Relational Schema
Answer: (a) DML (Data Manipulation Language)
Exam Concept: DML (SELECT, INSERT, UPDATE, DELETE) retrieves and modifies rows (tuples) inside existing tables.
Paper I · Unit 3 MCQ (1M)
Q3. What do you mean by one to many relationships?
(a) One class may have many teachers
(b) One teacher can have many classes
(c) Many classes may have many teachers
(d) Many teachers may have many classes
Answer: (b) One teacher can have many classes
Exam Concept: In a 1:N (One-to-Many) relationship, one entity on the "1" side relates to multiple instances on the "Many" side (Workbook key selects (b)).
Paper I · Unit 3 MCQ (1M)
Q4. A Database Management System is a type of ________ software.
(a) It is a type of system software
(b) It is a kind of application software
(c) It is a kind of general software
(d) Both A and C
Answer: (b) It is a kind of application software
Exam Concept: MySQL, Oracle, and MS Access run atop the Operating System as specialized application/database software.
Paper I · Unit 3 MCQ (1M)
Q5. Which of the following can be used to extract or filter the data & information from the data warehouse?
(a) Data redundancy
(b) Data recovery tool
(c) Data mining
(d) Both B and C
Answer: (c) Data mining
Exam Concept: Data Mining discovers patterns and extracts meaningful insights from large data warehouses.
Paper I · Unit 3 MCQ (1M)
Q6. Which one of the following refers to the copies of the same data (or information) occupying the memory space at multiple places.
(a) Data Repository
(b) Data Inconsistency
(c) Data Mining
(d) Data Redundancy
Answer: (d) Data Redundancy
Exam Concept: Unnecessary duplication of identical data across files causes Data Redundancy (which RDBMS normalization reduces).
Paper I · Unit 3 MCQ (1M)
Q7. Which one of the following refers to the "data about data"?
(a) Directory
(b) Sub Data
(c) Warehouse
(d) Meta Data
Answer: (d) Meta Data
Exam Concept: Metadata stores structural descriptions (table names, column types, constraints) inside the Data Dictionary.
Paper I · Unit 3 MCQ (1M)
Q8. Which of the following refers to the level of data abstraction that describes exactly how the data actually stored?
(a) Conceptual Level
(b) Physical Level
(c) File Level
(d) Logical Level
Answer: (b) Physical Level
Exam Concept: The 3 ANSI-SPARC levels are Physical (lowest — disk storage blocks/indexes), Logical/Conceptual (what tables/keys exist), and View/External (user views).
Paper I · Unit 3 MCQ (1M) Erratum Fixed
Q9. Which of the following refers to the number of tuples in a relation?
(a) Entity
(b) Column
(c) Cardinality
(d) None of the above
Answer: (c) Cardinality [Workbook key misprints (a) Entity]
Exam Concept: Always write **Cardinality** for row count in CHSE board exams.
Workbook Key Note / Correction: CRITICAL RDBMS ERRATUM: Number of tuples (rows) in a relation = **Cardinality** ((c)). Number of attributes (columns) = **Degree**. Workbook key wrongly prints (a) Entity!
Paper I · Unit 3 MCQ (1M)
Q10. Which one of the following is a type of Data Manipulation Command?
(a) Create
(b) Alter
(c) Delete
(d) All of the above
Answer: (c) Delete
Exam Concept: DELETE removes rows (DML), whereas CREATE and ALTER are DDL commands.
Paper I · Unit 3 MCQ (1M)
Q11. Which of the following command is a type of Data Definition language command?
(a) Create
(b) Update
(c) Delete
(d) Merge
Answer: (a) Create
Exam Concept: CREATE builds tables/schemas/databases (DDL); UPDATE, DELETE, MERGE manipulate row data (DML).
Paper I · Unit 3 MCQ (1M) Erratum Fixed
Q12. Which of the following is used to denote the selection operation in relational algebra?
(a) Pi (Greek)
(b) Sigma (Greek)
(c) Lambda (Greek)
(d) Omega (Greek)
Answer: (b) Sigma (σ) [Workbook key misprints (a) Pi]
Exam Concept: Memory trick: **S**igma = **S**election; **P**i = **P**rojection.
Workbook Key Note / Correction: CRITICAL ERRATUM: In Relational Algebra, **Sigma (σ)** denotes **Selection** (row filtering), while **Pi (Π)** denotes **Projection** (column filtering). Workbook key mistakenly prints (a) Pi!
Paper I · Unit 3 MCQ (1M) Erratum Fixed
Q13. The ________ operation, denoted by − (misprinted as ? in PDF), allows us to find tuples that are in one relation but are not in another.
(a) Union
(b) Set-difference
(c) Difference
(d) Intersection
Answer: (c) Difference / Set-difference (both b & c mean R − S)
Exam Concept: R − S returns all rows present in R that do not appear in S.
Workbook Key Note / Correction: PDF displays "?" due to a missing minus symbol font glyph for Relational Algebra Set Difference (−). Workbook key prints (c) Difference.
Paper I · Unit 3 Fill in Blank / T-F
Q14. A huge collection of the information or data accumulated from several different sources is known as ________.
Answer: Data warehouse
Exam Concept: Data Warehouses aggregate historical multi-source data for analytical querying (OLAP).
Paper I · Unit 3 Fill in Blank / T-F
Q15. Rows of a relation are known as the ________.
Answer: Tuples
Exam Concept: Relation = Table, Tuple = Row/Record, Attribute = Column/Field.
Paper I · Unit 3 Fill in Blank / T-F
Q16. What displays the unique values of the column? SELECT ________ dept_name FROM instructor;
Answer: DISTINCT
Exam Concept: SELECT DISTINCT column_name eliminates duplicate rows from the query result set.
Paper I · Unit 3 Fill in Blank / T-F
Q17. The ________ clause allows us to select only those rows in the result relation that satisfy a specified predicate.
Answer: WHERE
Exam Concept: WHERE condition filters individual rows before grouping/projection.
Paper I · Unit 3 Objective / Short (1–2M)
Q18. What is a unary operation?
Answer: An operation (e.g., Selection σ or Projection Π in relational algebra) that acts on only ONE operand / single relation.
Exam Concept: Workbook key prints "One operand". Contrast Binary operations (Union ∪, Join ⋈) requiring two relations.
Paper I · Unit 3 Objective / Short (1–2M)
Q19. Which is a join condition containing an equality operator.
Answer: Equijoin
Exam Concept: An Equijoin links two tables using = equality between matching column keys (WHERE A.id = B.id).
Paper I · Unit 3 Objective / Short (1–2M)
Q20. What is used to sort the result of query according to an attribute?
Answer: ORDER BY clause (ORDER BY col_name ASC|DESC)
Exam Concept: Defaults to ascending (ASC) unless DESC is specified.
Paper I · Unit 3 MCQ (1M) Erratum Fixed
Q1. In precedence of set operators, the expression is evaluated from
(a) Left to left
(b) Left to right
(c) Right to left
(d) From user specification
Answer: (b) Left to right [Workbook key prints (c)]
Exam Concept: Parentheses (...) explicitly control evaluation order across SQL engines.
Workbook Key Note / Correction: Standard SQL (Oracle/PostgreSQL/ANSI SQL) evaluates equal-precedence set operators (UNION, EXCEPT, MINUS) **Left to Right** ((b)), with INTERSECT having higher precedence unless parenthesized. Workbook key lists (c) Right to left.
Paper I · Unit 3 MCQ (1M)
Q2. Which of the following is not outer join?
(a) Left outer join
(b) Right outer join
(c) Full outer join
(d) None of these
Answer: (d) None of these
Exam Concept: All three — Left Outer Join, Right Outer Join, and Full Outer Join — are valid Outer Join types (though classic MySQL requires LEFT JOIN UNION RIGHT JOIN for Full Outer Join).
Paper I · Unit 3 MCQ (1M)
Q3. The System which schedules the inputs and outputs of the disk in database is classified as
(a) Operating system
(b) Host system
(c) Client system
(d) Structured system
Answer: (a) Operating system
Exam Concept: Disk I/O scheduling and block read/write management are core Operating System functions.
Paper I · Unit 3 MCQ (1M)
Q4. The program interface which provides the feature to client side programs to call the DBMS is classified as
(a) Open programming interface
(b) Closed programming interface
(c) Application programming interface
(d) Data programming language
Answer: (c) Application programming interface (API)
Exam Concept: Client programs communicate with MySQL via APIs/drivers such as JDBC, ODBC, PDO, or MySQLi.
Paper I · Unit 3 MCQ (1M) Erratum Fixed
Q5. In DBMS, the description of database in the form of schema is also called
(a) Extension of schema
(b) Intension of schema
(c) Mathematical operators of schema
(d) Logical operators of schema
Answer: (b) Intension of schema [Workbook key misprints (a) Extension]
Exam Concept: Memory trick: **I**ntension = **I**ntended structure/design; **E**xtension = **E**xisting data rows.
Workbook Key Note / Correction: CRITICAL ERRATUM: Schema structure/description = **Intension** ((b)). Data rows currently stored at a point in time = **Extension** (Instance). Workbook key mistakenly picks (a).
Paper I · Unit 3 MCQ (1M)
Q6. Which of the following can add a row to a table?
(a) Alter
(b) Add
(c) Insert
(d) Commit
Answer: (c) Insert (INSERT INTO tbl VALUES (...))
Exam Concept: ALTER ... ADD adds a column (DDL), while INSERT INTO adds a row/tuple (DML).
Paper I · Unit 3 MCQ (1M)
Q7. Which of these commands will delete a table called XXX if you have appropriate authority?
(a) DROP XXX
(b) DROP TABLE XXX
(c) DELETE XXX
(d) DELETE TABLE XXX
Answer: (b) DROP TABLE XXX
Exam Concept: DROP TABLE permanently deletes both table structure and all its data.
Paper I · Unit 3 MCQ (1M)
Q8. Which of the following is not available in MySQL?
(a) REVOKE
(b) FETCH
(c) LIKE
(d) JOIN
Answer: (b) FETCH [Note: Cursor FETCH exists inside stored routines, not standalone top-level SQL; standard workbook key is (b)]
Exam Concept: REVOKE, LIKE, and JOIN are direct standalone MySQL keywords.
Paper I · Unit 3 MCQ (1M)
Q9. Which keyword is the synonym for DATABASE?
(a) TABLE
(b) OBJECT
(c) DB
(d) SCHEMA
Answer: (d) SCHEMA
Exam Concept: In MySQL, CREATE SCHEMA and CREATE DATABASE (plus SHOW SCHEMAS) are identical synonyms.
Paper I · Unit 3 MCQ (1M)
Q10. What is abc in the following SQL statement? DELETE FROM xyz WHERE abc=5;
(a) column name
(b) table name
(c) row name
(d) database name
Answer: (a) column name
Exam Concept: xyz is the table name, and abc in the WHERE predicate is a column/attribute name.
Paper I · Unit 3 MCQ (1M)
Q11. What is the value of val2 in the following MySQL statement? UPDATE t SET val1=val1+2, val2 = val1;
(a) previous val1
(b) updated val1
(c) unchanged
(d) val1 + 1
Answer: (b) updated val1
Exam Concept: Unlike ANSI SQL/PostgreSQL, MySQL evaluates SET assignments sequentially left-to-right, so val2 receives the newly updated val1!
Paper I · Unit 3 MCQ (1M)
Q12. Which keyword is used to delete all the rows from the table?
(a) TRUNCATE
(b) REMOVE
(c) DELETE ALL
(d) CLEAR
Answer: (a) TRUNCATE (TRUNCATE TABLE tbl_name;)
Exam Concept: TRUNCATE removes all rows rapidly and resets AUTO_INCREMENT while keeping the empty table structure intact.
Paper I · Unit 3 Objective / Short (1–2M)
Q13. The facility that allows nesting one select statement into another is called ________.
Answer: Subquery / SubQuerying (Nested Query)
Exam Concept: Example: SELECT name FROM emp WHERE sal > (SELECT AVG(sal) FROM emp);.
Paper I · Unit 3 Objective / Short (1–2M)
Q14. The assignment operator is denoted by which symbol?
Answer: = (or := in user session variables)
Exam Concept: Used in UPDATE tbl SET col = value.
Paper I · Unit 3 Objective / Short (1–2M)
Q15. What is called the graphical representation of database description?
Answer: Schema Diagram (or ER Diagram)
Exam Concept: Visualizes tables, attributes, primary keys, and foreign-key relationship arrows.
Paper I · Unit 3 Objective / Short (1–2M)
Q16. If you want to undo a GRANT, you should use what?
Answer: REVOKE (DCL command)
Exam Concept: Syntax: REVOKE SELECT ON db.* FROM 'user'@'localhost';.
Paper I · Unit 3 Objective / Short (1–2M) Erratum Fixed
Q17. What are the differences between DESCRIBE and SHOW FIELDS FROM commands?
Answer: DESCRIBE table_name; (short DESC) and SHOW FIELDS FROM table_name; (alias SHOW COLUMNS FROM) return the exact same basic column structure (Field, Type, Null, Key, Default, Extra). Difference: SHOW FULL FIELDS FROM additionally displays Privileges and Collation, and SHOW FIELDS supports a LIKE/WHERE filter clause; DESCRIBE can also take a single column name.
Exam Concept: Exam tip: Always mention DESCRIBE works quickly as a shortcut (DESC), whereas SHOW FIELDS/COLUMNS supports FULL and WHERE filtering.
Workbook Key Note / Correction: PDF Key Misalignment: In the workbook Answer Key (Page 22), #17 prints "Use" (actually the answer for #18!) leaving #18 blank! Both #17 and #18 are answered cleanly above and below.
Paper I · Unit 3 Objective / Short (1–2M) Erratum Fixed
Q18. What statement is used to select a default database?
Answer: USE database_name;
Exam Concept: Example: USE school_db; sets school_db as the active schema for subsequent queries.
Workbook Key Note / Correction: Workbook key left #18 empty after printing "Use" on line #17.
Paper I · Unit 3 Objective / Short (1–2M)
Q19. To create a database only if it doesn't already exist, which clause is used?
Answer: IF NOT EXISTS (CREATE DATABASE IF NOT EXISTS db_name;)
Exam Concept: Prevents MySQL from raising an error if the database name already exists.
Paper I · Unit 3 Objective / Short (1–2M)
Q20. Which keyword in the UPDATE statement is used to assign values to columns?
Answer: SET
Exam Concept: Syntax: UPDATE student SET marks = 95 WHERE roll = 101;.
Solved Paper-II Short Objective Questions (23 Qs) Click to Expand
Paper II · Unit 3 Objective / Short (1–2M)
Q1. Does SQL support programming?
Answer: SQL (Structured Query Language) is primarily a declarative non-procedural query language (not a full general-purpose language with native control loops like Java/C), built specifically to define, query, and manipulate relational database tables.
Paper II · Unit 3 Objective / Short (1–2M)
Q2. What are the languages/sub-languages used in SQL?
Answer: DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language), and TCL (Transaction Control Language).
Paper II · Unit 3 Objective / Short (1–2M)
Q3. What is a Data Definition Language (DDL)?
Answer: DDL is the SQL subset used to create, alter, and remove database structures (tables, views, schemas, indexes). Key commands: CREATE, ALTER, DROP, TRUNCATE.
Paper II · Unit 3 Objective / Short (1–2M)
Q4. What is a Data Manipulation Language (DML)?
Answer: DML retrieves and modifies data rows stored inside tables. Key commands: INSERT (add row), SELECT (query rows), UPDATE (modify rows), DELETE (remove rows).
Paper II · Unit 3 Objective / Short (1–2M)
Q5. What is Data Control Language (DCL)?
Answer: DCL manages user permissions and security rights over database objects. Commands: GRANT (assign privilege) and REVOKE (withdraw previously granted privilege).
Paper II · Unit 3 Objective / Short (1–2M)
Q6. What do you mean by a Database Management System?
Answer: A DBMS is an integrated software suite that enables users and applications to define database schemas, store, retrieve, update, secure, and manage structured data efficiently.
Paper II · Unit 3 Objective / Short (1–2M)
Q7. What is RDBMS?
Answer: Relational Database Management System (E.F. Codd’s model) stores data in 2D tables (Relations) consisting of rows (Tuples) and columns (Attributes), linked together using keys (Primary & Foreign keys). Examples: MySQL, Oracle, SQL Server.
Paper II · Unit 3 Objective / Short (1–2M)
Q8. What is primary key?
Answer: A Primary Key is an attribute (or minimal set of attributes) that uniquely identifies every row (tuple) in a table. It CANNOT contain NULL or duplicate values.
Paper II · Unit 3 Objective / Short (1–2M)
Q9. What is a foreign key?
Answer: A Foreign Key is a column (or set of columns) in a child table whose values reference the Primary Key (or Unique key) of another parent table to enforce Referential Integrity.
Paper II · Unit 3 Objective / Short (1–2M)
Q10. What is null value in MySQL?
Answer: NULL represents a missing, unknown, or inapplicable value in a column — it is NOT equal to zero (0) or an empty string (""). Tested using IS NULL / IS NOT NULL.
Paper II · Unit 3 Objective / Short (1–2M)
Q11. Which keyword eliminates redundant data from a query result?
Answer: DISTINCT (SELECT DISTINCT dept FROM student;)
Paper II · Unit 3 Objective / Short (1–2M) Erratum Fixed
Q12. How would you display system date as the result of a query?
Answer: In MySQL (CHSE Syllabus): SELECT CURDATE(); (date only) or SELECT NOW(); / SELECT SYSDATE(); (date & time).
[Note: Workbook Answer Key prints SQL Server’s GETDATE()].
Workbook Key Note / Correction: CHSE Syllabus tests **MySQL**, where GETDATE() does not exist! Write SELECT CURDATE(); or SELECT NOW(); in CHSE exams (you can parenthetically note SQL Server GETDATE()).
Paper II · Unit 3 Objective / Short (1–2M)
Q13. What is NOT NULL constraint?
Answer: A column constraint guaranteeing that a field must ALWAYS hold a value and cannot be left empty (NULL) during INSERT or UPDATE.
Paper II · Unit 3 Objective / Short (1–2M)
Q14. What is error in following statement? UPDATE EMPL;
Answer: Missing mandatory SET column = value clause (and normally a WHERE filter condition). Valid syntax: UPDATE EMPL SET salary = 25000 WHERE emp_id = 101;.
Paper II · Unit 3 Objective / Short (1–2M)
Q15. Identify the error? DELETE ALL FROM TABLE EMP;
Answer: Both ALL and TABLE keywords are invalid in SQL DELETE syntax. Correct SQL statement: DELETE FROM EMP;.
Paper II · Unit 3 Objective / Short (1–2M)
Q16. Differentiate WHERE and HAVING clause?
Answer: • WHERE: Filters individual rows BEFORE grouping; cannot contain aggregate functions (SUM(), COUNT()).
• HAVING: Filters summary groups AFTER GROUP BY; supports aggregate conditions (e.g., HAVING COUNT(*) > 5).
Paper II · Unit 3 Objective / Short (1–2M) Erratum Fixed
Q17. How SQL commands are classified?
Answer: 4 main categories:
1. DDL (Data Definition): CREATE, ALTER, DROP, TRUNCATE
2. DML (Data Manipulation): SELECT, INSERT, UPDATE, DELETE
3. DCL (Data Control): GRANT, REVOKE
4. TCL (Transaction Control): COMMIT, ROLLBACK, SAVEPOINT, START TRANSACTION
Workbook Key Note / Correction: Workbook Answer Key stops mid-sentence ("four categories:"); include all 4 categories and examples for full marks.
Paper II · Unit 3 Objective / Short (1–2M)
Q18. What are the two ways in which multiple transactions can be executed?
Answer: (i) Serial Execution (one transaction finishes completely before the next begins) and (ii) Concurrent Execution (interleaved execution controlled via locking/isolation).
Paper II · Unit 3 Objective / Short (1–2M)
Q19. What is a save point?
Answer: A named checkpoint created inside an active transaction (SAVEPOINT sp1;) allowing partial rollback (ROLLBACK TO sp1;) without undoing earlier work in that transaction.
Paper II · Unit 3 Objective / Short (1–2M)
Q20. What do you understand by transaction COMMIT and ROLLBACK?
Answer: • COMMIT: Permanently saves all SQL changes executed in the current transaction to the database.
• ROLLBACK: Undoes all uncommitted changes since START TRANSACTION (or a SAVEPOINT), restoring the database back to its consistent prior state.
Paper II · Unit 3 Objective / Short (1–2M)
Q21. What are the properties of database transaction?
Answer: ACID Properties: (i) Atomicity (all-or-nothing), (ii) Consistency (valid state-to-valid state), (iii) Isolation (concurrent transactions don’t corrupt each other), (iv) Durability (committed data survives crashes).
Paper II · Unit 3 Objective / Short (1–2M)
Q22. What TCL commands are supported by SQL?
Answer: START TRANSACTION (or BEGIN), COMMIT, ROLLBACK, SAVEPOINT, and SET AUTOCOMMIT = 0|1.
Paper II · Unit 3 Objective / Short (1–2M)
Q23. Write the use of ORDER BY CLAUSE.
Answer: Sorts SELECT output rows in ascending (ASC, default) or descending (DESC) order across one or more columns.
Example: SELECT name, marks FROM student ORDER BY marks DESC;.