Class 12 Computer Science Chapter 09 ยท 25 min read

๐Ÿ›ข๏ธ Relational Databases

Unit 3 ยท Ch 9 Jun 27, 2026
Chapter Quiz Share

Most applications store their data in a database. This chapter explains why we use a DBMS, how the relational model organises data into tables, the terms used to describe it (relation, tuple, attribute, domain, degree, cardinality and keys), and gives a first look at MySQL and SQL.

๐Ÿ’ก How to use these notes

This chapter covers DBMS fundamentals, the Relational Model, and MySQL basics. Read the Board Exam Tips with each section, and pay particular attention to Sections 9.3, 9.4 and 9.8 during revision.


9.1 ๐Ÿ Introduction

A database is an organised collection of related data, and a DBMS (Database Management System) is the software that lets you create, store, retrieve, update, and manage that data efficiently.

Think of it this way: A pile of Excel sheets scattered across a laptop is "data". A well-organised, searchable, secure, multi-user system built around that data is a "database" โ€” and the software running it is the DBMS!

๐Ÿ—„๏ธ

Database

Organised collection of related data

Student recordslibrary cataloguebank accounts
โš™๏ธ

DBMS

Software to create, manage and query databases

MySQLOraclePostgreSQL
๐Ÿ”—

Relational Model

Organises data into tables (relations) linked by common values

Most widely used database model today
๐Ÿ’ป

SQL

The language used to talk to relational databases

Structured Query Language

9.2 ๐ŸŽฏ Purpose of DBMS

Before DBMS existed, data was stored in flat files (plain text files, spreadsheets) managed directly by application programs. This caused serious problems โ€” and DBMS was built specifically to solve them!

Problems with File-Based Systems:

graph TD
    FILE["๐Ÿ“ File-Based System\n(No DBMS)"]
    P1["๐Ÿ” Data Redundancy\nSame data stored multiple times"]
    P2["โš ๏ธ Data Inconsistency\nCopies go out of sync"]
    P3["๐Ÿ”’ Poor Security\nNo proper access control"]
    P4["๐Ÿšซ No Concurrent Access\nOnly one user/program at a time"]
    P5["๐Ÿ’ฅ Data Isolation\nData scattered in different formats"]
    P6["๐Ÿ”— No Integrity Constraints\nInvalid data can creep in"]

    FILE --> P1
    FILE --> P2
    FILE --> P3
    FILE --> P4
    FILE --> P5
    FILE --> P6

    style FILE fill:#F44336,color:#fff

How DBMS Solves These Problems:

Problem in File System How DBMS Fixes It
Data Redundancy Centralised storage โ€” data stored once, referenced everywhere
Data Inconsistency Single source of truth โ€” update once, reflects everywhere
Poor Security User-level permissions, authentication, role-based access
No Concurrent Access Built-in concurrency control โ€” multiple users safely at once
Data Isolation Unified schema โ€” all data follows one consistent structure
No Integrity Constraints PRIMARY KEY, FOREIGN KEY, NOT NULL, CHECK constraints enforce valid data
โœ…

Data Independence

Applications don't need to know how data is physically stored

Change storage without rewriting programs
๐Ÿ”

Security & Access Control

Different users get different permission levels

Admin can edit; student can only view marks
๐Ÿค

Concurrent Access

Many users can use the database simultaneously, safely

Hundreds of students checking results at once
๐Ÿ›ก๏ธ

Backup & Recovery

Built-in tools to recover data after crashes

Automatic backupstransaction logs
๐Ÿ“‹ Board Exam Tip

"What is the purpose of DBMS? / Why do we need a DBMS instead of file systems?" โ€” 2-3 mark question asked very often! Core answer: A DBMS centralises data to eliminate redundancy, maintain consistency, enforce security and integrity constraints, and support concurrent multi-user access โ€” none of which is reliably possible with plain file-based storage.


9.3 ๐Ÿ”— Relational Database Model

The Relational Model, proposed by Dr. E. F. Codd in 1970, organises data into two-dimensional tables (called relations) made up of rows and columns. It is the most widely used database model in the world today.

graph LR
    RM["๐Ÿ—„๏ธ RELATIONAL MODEL"]
    T1["๐Ÿ“‹ Table = Relation"]
    T2["โžก๏ธ Row = Tuple"]
    T3["โฌ‡๏ธ Column = Attribute"]
    T4["๐Ÿ”‘ Each row uniquely identified by a key"]

    RM --> T1
    RM --> T2
    RM --> T3
    RM --> T4

    style RM fill:#2196F3,color:#fff

Example โ€” A Student Relation:

RollNo Name Class Marks
1 Priya Sharma 12A 91
2 Arjun Kumar 12B 88
3 Sita Roy 12A 95
๐Ÿ“‹

Relation (Table)

The entire table โ€” a set of related tuples

The "Student" table itself
โžก๏ธ

Tuple (Row)

One single record/entry in the table

The row for "Priya Sharma"
โฌ‡๏ธ

Attribute (Column)

A single property/field of the relation

"Marks" column
๐Ÿ”ข

Domain

The set of allowed/valid values for an attribute

Marks domain = 0 to 100
๐Ÿง  Why "Relational"? ๐Ÿง 

The word "Relational" does NOT mean tables are related to each other (though they often are!). It comes from the mathematical term "relation", which is simply the formal name for a table โ€” a set of tuples (rows). Tables being linked via keys is a separate, additional feature of the model!

Properties of a Relation (Important Rules!):

Property Rule
Atomic Values Each cell holds a single, indivisible value (no lists inside a cell)
Unique Column Names No two columns in a relation can have the same name
Row Order Doesn't Matter Rows can be in any order; the data is still the same relation
Column Order Doesn't Matter Columns can be rearranged without changing meaning
No Duplicate Rows Every tuple in a relation must be unique
๐Ÿ“‹ Board Exam Tip

"Define Relation, Tuple, and Attribute with examples." โ€” 3-mark question. Answer: A Relation is a table consisting of rows and columns. A Tuple is a single row of the relation, representing one record. An Attribute is a single column of the relation, representing one property/field of the data.


9.4 ๐Ÿ“ The Relational Model Terminology

Beyond Relation, Tuple, and Attribute, the relational model has its own precise vocabulary that you need to know precisely.

Core Terminology โ€” Quick Reference:

Term Meaning Example
Degree Number of attributes (columns) in a relation Student table with 4 columns โ†’ Degree = 4
Cardinality Number of tuples (rows) in a relation Student table with 3 rows โ†’ Cardinality = 3
Relation Schema The structure/blueprint of a relation (name + attributes) Student(RollNo, Name, Class, Marks)
Relation Instance The actual data present in a relation at a given moment The current set of rows in the table
Candidate Key An attribute (or set) that can uniquely identify each tuple RollNo, Admission Number
Primary Key The candidate key chosen to uniquely identify tuples RollNo (chosen as the Primary Key)
Alternate Key Candidate keys NOT chosen as the Primary Key Admission Number (if RollNo is PK)
Foreign Key An attribute in one table that refers to the Primary Key of another table ClassID in Student table referring to Class table
graph TD
    SCHEMA["๐Ÿ“ Relation Schema\nStudent(RollNo, Name, Class, Marks)"]
    DEG["Degree = 4\n(4 attributes)"]
    INST["๐Ÿ“Š Relation Instance\n(Actual rows of data)"]
    CARD["Cardinality = 3\n(3 tuples currently)"]

    SCHEMA --> DEG
    SCHEMA -.->|"populated with"| INST
    INST --> CARD

    style SCHEMA fill:#9C27B0,color:#fff
    style INST fill:#2196F3,color:#fff
๐Ÿ’ก Memory Trick: Degree vs Cardinality! ๐ŸŽต

Think Degree = Down the columns (how many fields). Think Cardinality = Count the rows (how many records). If it helps, remember: "Cardinality Counts rows, Degree Defines columns"


9.4.1 Views ๐Ÿ‘๏ธ

A View is a virtual table based on the result of an SQL query. It does not store data itself โ€” it dynamically pulls data from one or more underlying base tables whenever it's accessed.

graph LR
    T1["๐Ÿ“‹ Table: Student"]
    T2["๐Ÿ“‹ Table: Marks"]
    QUERY["๐Ÿ” SELECT Query\n(joins & filters data)"]
    VIEW["๐Ÿ‘๏ธ VIEW\n(Virtual Table)\nNo data stored โ€” computed live!"]

    T1 --> QUERY
    T2 --> QUERY
    QUERY --> VIEW

    style VIEW fill:#9C27B0,color:#fff

Why Use Views?

๐Ÿ”

Security

Hide sensitive columns; show only what's needed

Hide salaryshow only name & department
๐ŸŽฏ

Simplicity

Hide complex joins behind a simple table-like name

Users query the viewnot the messy joins
๐Ÿงฉ

Logical Data Independence

Underlying table structure can change without breaking the view's users

Insulates apps from schema changes
โ™ป๏ธ

Reusability

Write a complex query once, reuse it like a table forever

No need to repeat long JOIN queries

Key Facts about Views:

Property Detail
Stores data? โŒ No โ€” always computed fresh from base tables
Created using CREATE VIEW view_name AS SELECT ...
Can be queried like A normal table โ€” SELECT * FROM view_name
Updatable? Only simple views (based on a single table, no aggregate functions)
Dropped using DROP VIEW view_name
๐Ÿง  View = A Window, Not a Photocopy! ๐ŸชŸ

A View is like looking through a window at the base table โ€” you see a live, current picture of the data. It's NOT like taking a photocopy (which would freeze the data at that moment). Change the base table, and the view's output changes instantly too!

๐Ÿ“‹ Board Exam Tip

"What is a View in SQL? Why is it used?" โ€” 2-mark question. Answer: A View is a virtual table derived from one or more base tables using a SELECT query. It does not store data physically but is computed dynamically when accessed. Views are used for security (hiding columns), simplicity (hiding complex joins), and data independence.


9.4.2 Structure of Relational Databases ๐Ÿ—๏ธ

A relational database isn't just one table โ€” it's a collection of related tables, linked together through keys, forming a complete structured system.

graph TD
    DB["๐Ÿ—„๏ธ Relational Database"]
    T1["๐Ÿ“‹ Student Table\n(RollNo, Name, ClassID)"]
    T2["๐Ÿ“‹ Class Table\n(ClassID, ClassName, Teacher)"]
    T3["๐Ÿ“‹ Marks Table\n(RollNo, Subject, Score)"]

    DB --> T1
    DB --> T2
    DB --> T3
    T1 -.->|"ClassID (Foreign Key)"| T2
    T3 -.->|"RollNo (Foreign Key)"| T1

    style DB fill:#F44336,color:#fff
    style T1 fill:#4CAF50,color:#fff
    style T2 fill:#2196F3,color:#fff
    style T3 fill:#FF9800,color:#fff

Building Blocks of the Structure:

Component Role
Tables (Relations) Store the actual organised data
Rows (Tuples) Individual records within each table
Columns (Attributes) Properties describing each record
Primary Keys Uniquely identify rows within their own table
Foreign Keys Link rows in one table to rows in another table
Constraints Rules (NOT NULL, UNIQUE, CHECK) ensuring data validity
Schema The overall blueprint describing all tables and their relationships
๐Ÿ”‘

Primary Key Rule

Must be unique and NOT NULL for every row

RollNo can never repeat or be blank
๐Ÿ”—

Foreign Key Rule

Must match an existing Primary Key value in the parent table (or be NULL)

ClassID in Student must exist in Class table
๐Ÿงฑ

Referential Integrity

The rule that Foreign Keys must always point to valid existing data

Prevents "orphan" records
โš  Common Mistake

Students often think a database is just "one big table with everything in it." In reality, good relational database design splits data into multiple smaller, linked tables (this process is called Normalisation โ€” covered in detail later) to avoid redundancy and keep data consistent.

๐Ÿ“‹ Board Exam Tip

"What is the structure of a relational database?" โ€” 3-mark question. Answer: A relational database consists of multiple tables (relations), each made up of rows (tuples) and columns (attributes). Tables are linked using Primary Keys and Foreign Keys, and constraints ensure data validity. This structure is collectively described by the database's schema.


9.5 ๐Ÿ“œ Brief History of MySQL

MySQL is one of the most popular open-source Relational Database Management Systems (RDBMS) in the world โ€” powering everything from small school projects to giants like Facebook and YouTube (in their early years)!

graph LR
    Y1["1995\n๐Ÿ‘จโ€๐Ÿ’ป Created by\nMichael Widenius,\nDavid Axmark &\nAllan Larsson"]
    Y2["2008\n๐Ÿข Acquired by\nSun Microsystems"]
    Y3["2010\n๐Ÿข Acquired by\nOracle Corporation"]
    Y4["Today\n๐ŸŒ World's most\npopular open-source\nRDBMS"]

    Y1 --> Y2 --> Y3 --> Y4

    style Y1 fill:#4CAF50,color:#fff
    style Y2 fill:#FF9800,color:#fff
    style Y3 fill:#F44336,color:#fff
    style Y4 fill:#2196F3,color:#fff

Key Historical Facts:

Fact Detail
Released 1995
Creators Michael "Monty" Widenius, David Axmark, Allan Larsson
Name Origin "My" โ€” daughter of co-founder Monty Widenius; "SQL" โ€” Structured Query Language
Current Owner Oracle Corporation (since 2010)
License Type Open-source (GPL) with paid commercial editions also available
Written In C and C++
๐Ÿง  Fun Fact! ๐ŸŽต

MySQL is named after co-founder Monty Widenius's daughter, My! Combine that with SQL (the language it uses), and you get MySQL. A cute, personal origin story for one of the world's biggest pieces of software infrastructure!


9.6 ๐Ÿ–ฅ๏ธ MySQL Database System

MySQL works on a Client-Server architecture โ€” there's a central MySQL server that stores and manages all the data, and client programs (or command-line tools) connect to it to send queries and receive results.

graph LR
    C1["๐Ÿ’ป MySQL Client\n(Workbench, CLI, App)"]
    C2["๐Ÿ’ป MySQL Client\n(Another App)"]
    SERVER["๐Ÿ–ฅ๏ธ MySQL SERVER\nStores databases\nProcesses queries\nManages users"]
    DB["๐Ÿ—„๏ธ Databases\n(Tables, Views, Data)"]

    C1 -->|"SQL Query"| SERVER
    C2 -->|"SQL Query"| SERVER
    SERVER --> DB
    SERVER -->|"Result Set"| C1
    SERVER -->|"Result Set"| C2

    style SERVER fill:#F44336,color:#fff
    style DB fill:#FF9800,color:#fff

Components of MySQL Database System:

๐Ÿ–ฅ๏ธ

MySQL Server (mysqld)

The core engine that stores data and processes all queries

Runs continuously in the background
๐Ÿ’ป

MySQL Client

Software/tool used to connect to and interact with the server

MySQL WorkbenchCLIphpMyAdmin
๐Ÿ—„๏ธ

Storage Engine

The underlying mechanism that actually reads/writes data to disk

InnoDB (most common)MyISAM
๐Ÿ”

User Management

Controls who can connect and what they're allowed to do

GRANT and REVOKE privileges

Key Features of MySQL:

Feature Benefit
Open Source Free to use, modify, and distribute
Cross-Platform Runs on Windows, Linux, macOS
Multi-User Support Many clients can connect and query simultaneously
Scalability Handles everything from tiny apps to massive websites
High Performance Optimised query engine, indexing support
Security User authentication, privilege-based access control
ACID Compliance (InnoDB) Ensures reliable transactions even during crashes
๐Ÿ“‹ Board Exam Tip

"What is the Client-Server architecture of MySQL?" โ€” 2-mark question. Answer: MySQL follows a Client-Server model where the MySQL Server stores and manages all data and processes queries, while Client programs (command line, applications, tools like MySQL Workbench) connect to the server, send SQL queries, and receive results back.


9.7 ๐Ÿš€ Starting MySQL

Before you can run any SQL command, you need to start the MySQL server and then connect a client to it. The exact steps differ slightly by operating system, but the core idea stays the same.

Starting MySQL โ€” Typical Workflow:

graph TD
    A["1๏ธโƒฃ Install MySQL Server\n(via installer or XAMPP/WAMP)"]
    B["2๏ธโƒฃ Start the MySQL Service\n(mysqld running in background)"]
    C["3๏ธโƒฃ Open MySQL Client\n(Command Line / Workbench)"]
    D["4๏ธโƒฃ Login with Credentials\nmysql -u username -p"]
    E["5๏ธโƒฃ Enter Password"]
    F["โœ… mysql> prompt appears\nReady to run SQL commands!"]

    A --> B --> C --> D --> E --> F

    style F fill:#4CAF50,color:#fff

Common Ways to Start MySQL:

Platform / Tool Method
Windows (Command Line) Open Command Prompt โ†’ mysql -u root -p
XAMPP / WAMP Open Control Panel โ†’ Click "Start" next to MySQL
Linux sudo service mysql start then mysql -u root -p
MySQL Workbench Open the app โ†’ Double-click the saved connection

Basic Login Command:

mysql -u root -p
Part Meaning
mysql The MySQL client program being launched
-u root Login as the user named root (default admin account)
-p Prompt for a password before connecting
โœ…

Successful Login

Server running + correct credentials โ†’ `mysql>` prompt appears

Ready to type SQL commands
โŒ

Connection Refused

Server isn't running, or wrong host/port

Start the MySQL service first
โŒ

Access Denied

Wrong username or password

Double-check credentials and try again
๐Ÿง  The mysql> Prompt is Your Command Centre! ๐Ÿง 

Once you see mysql>, you are inside the MySQL client, connected to the server, and ready to type SQL statements directly. Every statement you type here must end with a semicolon ; to execute!


9.8 ๐Ÿ’ป MySQL and SQL

MySQL is the database management system (the engine); SQL (Structured Query Language) is the language used to communicate with it โ€” create tables, insert data, retrieve records, and much more.

Real-world Analogy: MySQL is like the car engine; SQL is the steering wheel and pedals you use to actually control it. You need both โ€” the engine alone does nothing without a way to direct it!

graph LR
    USER["๐Ÿ‘ค You"]
    SQL["๐Ÿ’ป SQL Statement\nSELECT * FROM Student;"]
    MYSQL["๐Ÿ–ฅ๏ธ MySQL Server\n(Interprets & Executes)"]
    RESULT["๐Ÿ“Š Result Set\n(Table of matching rows)"]

    USER -->|"types"| SQL
    SQL -->|"sent to"| MYSQL
    MYSQL -->|"returns"| RESULT
    RESULT --> USER

    style MYSQL fill:#F44336,color:#fff
    style SQL fill:#2196F3,color:#fff

9.8.1 Processing Capabilities of SQL โš™๏ธ

SQL is a remarkably versatile language โ€” it can do far more than just fetch data. Its capabilities are generally grouped into four major categories.

๐Ÿ—๏ธ

Data Definition

Define and modify the structure of database objects

CREATEALTERDROP
โœ๏ธ

Data Manipulation

Insert, update, delete, and retrieve actual data

INSERTUPDATEDELETESELECT
๐Ÿ”

Data Control

Manage user permissions and access rights

GRANTREVOKE
๐Ÿ”„

Transaction Control

Manage groups of operations as a single safe unit

COMMITROLLBACKSAVEPOINT

SQL's Processing Capabilities โ€” Detailed:

Capability What It Does Example
Define Data Create/modify database structures CREATE TABLE, ALTER TABLE
Retrieve Data Query and fetch data matching conditions SELECT ... WHERE ...
Manipulate Data Insert, update, or delete records INSERT INTO, UPDATE, DELETE
Control Access Grant or revoke permissions to/from users GRANT SELECT ON Student TO user1
Ensure Integrity Enforce rules so invalid data can't be entered PRIMARY KEY, NOT NULL, CHECK
Manage Transactions Group multiple statements as one all-or-nothing unit COMMIT, ROLLBACK
๐Ÿ“‹ Board Exam Tip

"What are the processing capabilities of SQL?" โ€” 3-mark question. Answer: SQL can define database structures (DDL), manipulate data within them (DML), control user access (DCL), and manage transactions (TCL) โ€” making it a complete language for working with relational databases, not just a query tool.


9.8.2 Data Definition Language (DDL) ๐Ÿ—๏ธ

DDL (Data Definition Language) consists of SQL commands used to define, modify, and remove the structure of database objects like tables, views, and indexes โ€” NOT the data inside them.

graph TD
    DDL["๐Ÿ—๏ธ DDL Commands"]
    C1["CREATE\nMake a new object\n(table, database, view)"]
    C2["ALTER\nModify an existing\nobject's structure"]
    C3["DROP\nPermanently delete\nan object"]
    C4["TRUNCATE\nRemove all rows but\nkeep table structure"]

    DDL --> C1
    DDL --> C2
    DDL --> C3
    DDL --> C4

    style DDL fill:#9C27B0,color:#fff

The Four DDL Commands:

Command Purpose Example
CREATE Build a new table, database, view, or index CREATE TABLE Student (RollNo INT, Name VARCHAR(30));
ALTER Change an existing table's structure ALTER TABLE Student ADD Marks INT;
DROP Permanently delete a table/database/view entirely DROP TABLE Student;
TRUNCATE Delete all rows instantly, but keep the table structure TRUNCATE TABLE Student;
โš ๏ธ

DROP vs TRUNCATE vs DELETE

All three remove data, but very differently!

See comparison table below
๐Ÿ”’

DDL is Auto-Committed

DDL changes are saved permanently the moment they run โ€” ROLLBACK won't undo them

Be careful before running DROP!

DROP vs TRUNCATE vs DELETE โ€” Critical Comparison:

Feature DROP TRUNCATE DELETE
Category DDL DDL DML
Removes Entire table structure + data All rows, keeps structure Specific rows (or all, with no WHERE)
Can use WHERE? โŒ No โŒ No โœ… Yes
Can Rollback? โŒ No (auto-committed) โŒ No (auto-committed) โœ… Yes (if not committed)
Speed Fast Very Fast Slower (row-by-row logging)
๐Ÿ“‹ Board Exam Tip

"Differentiate between DROP, TRUNCATE, and DELETE." โ€” 2-3 mark question asked very frequently! Core answer: DROP removes the entire table (structure + data) permanently. TRUNCATE removes all rows but keeps the empty table structure intact. DELETE removes rows selectively (using WHERE) and can be rolled back, unlike DROP/TRUNCATE which are auto-committed.


9.8.3 Classification of SQL Statements ๐Ÿ“‚

SQL commands are formally classified into five categories, based on what kind of task they perform.

graph TD
    SQL["๐Ÿ’ป SQL STATEMENTS"]
    DDL["๐Ÿ—๏ธ DDL\nData Definition\nCREATE, ALTER, DROP"]
    DML["โœ๏ธ DML\nData Manipulation\nINSERT, UPDATE, DELETE, SELECT"]
    DCL["๐Ÿ” DCL\nData Control\nGRANT, REVOKE"]
    TCL["๐Ÿ”„ TCL\nTransaction Control\nCOMMIT, ROLLBACK, SAVEPOINT"]
    DQL["๐Ÿ” DQL\nData Query\nSELECT"]

    SQL --> DDL
    SQL --> DML
    SQL --> DCL
    SQL --> TCL
    SQL --> DQL

    style DDL fill:#9C27B0,color:#fff
    style DML fill:#2196F3,color:#fff
    style DCL fill:#F44336,color:#fff
    style TCL fill:#FF9800,color:#fff
    style DQL fill:#4CAF50,color:#fff

SQL Statement Categories โ€” Complete Reference:

Category Full Form Purpose Commands
DDL Data Definition Language Define/modify database structure CREATE, ALTER, DROP, TRUNCATE
DML Data Manipulation Language Insert, update, delete data INSERT, UPDATE, DELETE
DQL Data Query Language Retrieve/fetch data SELECT
DCL Data Control Language Manage user access rights GRANT, REVOKE
TCL Transaction Control Language Manage transactions COMMIT, ROLLBACK, SAVEPOINT
๐Ÿง  Note on SELECT! ๐Ÿง 

Many textbooks (and CBSE itself, in older syllabi) club SELECT under DML rather than giving it a separate DQL category. Both classifications are accepted in CBSE answers โ€” just be consistent and mention SELECT's purpose (retrieving data) clearly!

๐Ÿ“‹ Board Exam Tip

"Classify the following SQL statements: CREATE, INSERT, GRANT, COMMIT, SELECT, DROP." โ€” Common 1-mark-per-item question. Answer: CREATE, DROP โ†’ DDL | INSERT โ†’ DML | GRANT โ†’ DCL | COMMIT โ†’ TCL | SELECT โ†’ DQL (or DML)


โš ๏ธ Common Errors and Misconceptions

Misconception Correct Fact
โŒ MySQL and SQL are the same thing โœ… MySQL is a DBMS software; SQL is the language used to interact with it (and other RDBMS too)
โŒ A View stores its own copy of data โœ… A View is virtual โ€” it computes results live from base tables every time it's queried
โŒ DELETE and TRUNCATE do the same thing โœ… DELETE can be selective (WHERE) and rolled back; TRUNCATE removes everything and is auto-committed
โŒ Degree refers to number of rows โœ… Degree = number of columns; Cardinality = number of rows
โŒ Database = one giant table โœ… A relational database is multiple linked tables, connected via Primary/Foreign Keys
โŒ Candidate Key and Primary Key are different concepts entirely โœ… Primary Key IS a Candidate Key โ€” just the one chosen to be the main identifier

๐ŸŽฏ Sample Board Exam Questions

Q1: Very Short Answer [1 mark each]

a) Who proposed the Relational Model, and in which year? โ†’ Dr. E. F. Codd, in 1970

b) What is the full form of DDL? โ†’ Data Definition Language

c) Name the company that currently owns MySQL. โ†’ Oracle Corporation

d) What does "Cardinality" of a relation mean? โ†’ The number of tuples (rows) in the relation

e) Name any one DCL command. โ†’ GRANT or REVOKE


Q2: Short Answer [2 marks]

Q: What is a View? Give one advantage of using a View.

A View is a virtual table based on the result of an SQL SELECT query. It does not store data physically; it is computed dynamically each time it is accessed. Advantage: Views improve security by allowing users to see only specific columns/rows of a table, hiding sensitive data from underlying base tables.


Q3: Short Answer [2 marks]

Q: Differentiate between Degree and Cardinality of a relation.

Feature Degree Cardinality
Meaning Number of attributes (columns) Number of tuples (rows)
Changes when Columns are added/removed (ALTER) Rows are inserted/deleted
Example Student(RollNo, Name, Marks) โ†’ Degree = 3 50 students in the table โ†’ Cardinality = 50

Q4: Short Answer [3 marks]

Q: Explain the purpose of a DBMS over traditional file-based systems.

A DBMS is software designed to overcome the limitations of file-based data storage. It provides:

  1. Reduced Redundancy โ€” centralised data, stored once
  2. Consistency โ€” single source of truth for all applications
  3. Security โ€” user authentication and permission-based access
  4. Concurrent Access โ€” multiple users can safely use the data at once
  5. Integrity Constraints โ€” rules like PRIMARY KEY and NOT NULL prevent invalid data

Q5: Output/Analysis Question [2 marks]

Q: Classify the following SQL statements into DDL, DML, DCL, or TCL:

a) ALTER TABLE Student ADD COLUMN Age INT; โ†’ DDL

b) UPDATE Student SET Marks = 95 WHERE RollNo = 1; โ†’ DML

c) REVOKE SELECT ON Student FROM user2; โ†’ DCL

d) ROLLBACK; โ†’ TCL


โœ๏ธ Practice Problems

  1. Define Primary Key, Candidate Key, and Alternate Key with one example each.
  2. Explain with a diagram how MySQL's Client-Server architecture works.
  3. Write the steps to start MySQL from the command line and log in as the root user.
  4. Compare DROP, TRUNCATE, and DELETE on three different parameters.
  5. What is the difference between Relation Schema and Relation Instance? Give an example.
  6. Why is a View called a "virtual table"? Can a View always be updated? Explain.
  7. List and briefly explain the five categories of SQL statements with one command example each.
  8. Explain why file-based systems suffer from data redundancy and inconsistency, with an example.
Take the Chapter 09 Quiz Custom Quiz
Solved Board Questions

Practice real board exam questions for this chapter.

View Solved Board Questions
Learning Support

Need Help With This Chapter?

Save key topics for exam revision, ask questions to teachers, or submit content corrections.

Verified Doubts & Teacher Answers

Chapter 09 Quiz