CBSE Class 12 Information Technology (802) Unit 1 Notes - Database Concepts – RDBMS Tool | Complete SQL Notes 2026-27
CBSE Class 12 Information Technology Unit 1: Database Concepts – RDBMS Tool
Complete RDBMS & SQL Notes | Easy Explanation | PYQs with Answers | Exam Tricks
Don't worry! These notes explain RDBMS and SQL in very simple, student-friendly language, with examples that are useful for CBSE Board Exams, school exams, practicals and viva.
📚 Unit 1: Database Concepts – RDBMS Tool
Topics Covered
Basics of RDBMS
SQL – Creating and Opening Database
Creating and Populating Tables
Modifying the Content and Structure of Table
Ordering and Grouping
Operating with Multiple Tables
Important SQL Commands
CBSE Exam Tricks
PYQ / Board-Style Questions with Answers
Quick Revision Sheet
Frequently Asked Questions
1. Basics of RDBMS
What is a Database?
A database is an organised collection of related data.
Example:
Suppose a school stores information about students:
| Roll No. | Name | Class | Marks |
|---|---|---|---|
| 101 | Rahul | XII | 85 |
| 102 | Priya | XII | 91 |
| 103 | Aman | XII | 78 |
This collection of student information can be stored in a database.
What is DBMS?
DBMS = Database Management System
A DBMS is software used to create, store, manage, update and retrieve data from a database.
Examples of DBMS
MySQL
Oracle
MS Access
PostgreSQL
SQLite
2. What is RDBMS?
RDBMS = Relational Database Management System
An RDBMS stores data in the form of tables.
A table consists of:
Rows
Columns
Example
STUDENT
| RollNo | Name | Class | Marks |
|---|---|---|---|
| 1 | Ravi | XII | 80 |
| 2 | Neha | XII | 92 |
| 3 | Aman | XII | 75 |
Here:
Table → STUDENT
Columns / Fields → RollNo, Name, Class, Marks
Rows / Records → Individual student details
Easy Trick
Column = Field = Attribute
Row = Record = Tuple
Remember:
F-A-R-T
Field → Attribute → Record → Tuple
3. Important Terms in RDBMS
Table
A table stores related data in rows and columns.
Field
A field represents a particular type of information.
Example:
Name, Age, Marks
Record
A complete row of information is called a record.
Primary Key
A Primary Key is a field or combination of fields that uniquely identifies each record in a table.
Example:
RollNo INT PRIMARY KEY
If RollNo is unique for every student, it can be used as a Primary Key.
Properties of Primary Key
It must contain unique values.
It cannot contain NULL values.
A table generally has one primary key constraint.
It uniquely identifies records.
Exam Trick
Primary Key = Unique Identity of a Record
4. What is SQL?
SQL = Structured Query Language
SQL is used to communicate with a relational database.
We can use SQL to:
Create a database
Create tables
Insert data
Retrieve data
Update data
Delete data
Modify table structure
Sort records
Group records
Work with multiple tables
5. SQL Commands – Basic Categories
Some commonly used SQL commands are:
| Category | Meaning | Examples |
|---|---|---|
| DDL | Data Definition Language | CREATE, ALTER, DROP |
| DML | Data Manipulation Language | INSERT, UPDATE, DELETE |
| DQL | Data Query Language | SELECT |
Easy Memory Trick
DDL = Design
DML = Modify Data
DQL = Query Data
6. Creating a Database
The CREATE DATABASE command is used to create a new database.
Syntax
CREATE DATABASE database_name;
Example
CREATE DATABASE SCHOOL;
This creates a database named SCHOOL.
7. Opening / Selecting a Database
In MySQL, the USE command is used to select a database.
Syntax
USE database_name;
Example
USE SCHOOL;
Now SQL commands will operate on the selected SCHOOL database.
Exam Trick
CREATE = Create database
USE = Select/Open database for use
8. Creating a Table
The CREATE TABLE command is used to create a table.
Syntax
CREATE TABLE table_name
(
column1 datatype,
column2 datatype,
column3 datatype
);
Example
CREATE TABLE STUDENT
(
RollNo INT PRIMARY KEY,
Name VARCHAR(30),
Class INT,
Marks INT
);
9. Common SQL Data Types
| Data Type | Use |
|---|---|
| INT | Whole numbers |
| DECIMAL | Decimal numbers |
| CHAR(n) | Fixed-length characters |
| VARCHAR(n) | Variable-length characters |
| DATE | Date values |
| TIME | Time values |
Example
Name VARCHAR(30)
This means the Name field can store character data up to 30 characters.
10. Populating a Table
Populating means adding records/data to a table.
The INSERT INTO command is used to insert records.
Syntax
INSERT INTO table_name
VALUES (value1, value2, value3);
Example
INSERT INTO STUDENT
VALUES (101, 'Rahul', 12, 85);
Another record:
INSERT INTO STUDENT
VALUES (102, 'Priya', 12, 91);
Inserting Data into Selected Columns
INSERT INTO STUDENT (RollNo, Name, Marks)
VALUES (103, 'Aman', 78);
Only the specified columns receive values; other columns depend on their definitions/defaults.
11. Displaying Records
The SELECT command is used to retrieve data.
Display all columns
SELECT * FROM STUDENT;
* means all columns.
Display selected columns
SELECT Name, Marks
FROM STUDENT;
This displays only Name and Marks.
Exam Trick
SELECT *= Show everything
12. WHERE Clause
The WHERE clause is used to specify a condition.
Example
SELECT * FROM STUDENT
WHERE Marks > 80;
This displays students whose marks are greater than 80.
Other Operators
| Operator | Meaning |
|---|---|
| = | Equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal to |
| <= | Less than or equal to |
| <> / != | Not equal to |
13. Logical Operators
SQL commonly uses:
AND
OR
NOT
AND
Both conditions must be true.
SELECT * FROM STUDENT
WHERE Marks > 80 AND Class = 12;
OR
At least one condition should be true.
SELECT * FROM STUDENT
WHERE Marks > 90 OR Class = 12;
NOT
Negates a condition.
SELECT * FROM STUDENT
WHERE NOT Class = 11;
14. Modifying the Content of a Table
The UPDATE command is used to change existing data.
Syntax
UPDATE table_name
SET column_name = new_value
WHERE condition;
Example
Suppose Rahul's marks were entered as 85 but should be 88.
UPDATE STUDENT
SET Marks = 88
WHERE RollNo = 101;
⚠️ Important Exam Point
Always be careful with the WHERE clause.
UPDATE STUDENT
SET Marks = 88;
This can update Marks for all records because there is no WHERE condition.
Trick
UPDATE without WHERE = Think Twice!
15. Deleting Records
The DELETE command removes records from a table.
Syntax
DELETE FROM table_name
WHERE condition;
Example
DELETE FROM STUDENT
WHERE RollNo = 103;
This deletes the record whose RollNo is 103.
Important Difference
DELETE FROM STUDENT;
removes all records from the table, but the table structure remains.
16. Modifying the Structure of a Table
The ALTER TABLE command is used to modify the structure of an existing table.
You can use it to:
Add a column
Modify a column
Drop a column
Add/modify constraints, depending on the SQL system
Adding a Column
Syntax
ALTER TABLE table_name
ADD column_name datatype;
Example
ALTER TABLE STUDENT
ADD City VARCHAR(30);
A new City column is added.
Modifying a Column
The exact syntax can vary with the database system.
For MySQL, for example:
ALTER TABLE STUDENT
MODIFY Name VARCHAR(50);
This changes the size of the Name column.
Removing a Column
ALTER TABLE STUDENT
DROP COLUMN City;
This removes the City column.
Memory Trick
ALTER = Change the table structure
17. ORDER BY – Ordering Records
ORDER BY is used to arrange records in ascending or descending order.
Ascending Order
SELECT * FROM STUDENT
ORDER BY Marks ASC;
ASC means ascending.
Descending Order
SELECT * FROM STUDENT
ORDER BY Marks DESC;
DESC means descending.
Easy Trick
ASC = A to Z / Small to Big
DESC = Z to A / Big to Small
18. GROUP BY – Grouping Records
GROUP BY is used to group rows having the same value in a column.
It is commonly used with aggregate functions such as:
COUNT()
SUM()
AVG()
MAX()
MIN()
Example Table: SALES
| Product | City | Amount |
|---|---|---|
| Pen | Rajkot | 100 |
| Book | Rajkot | 300 |
| Pen | Ahmedabad | 200 |
| Book | Ahmedabad | 400 |
To calculate total sales city-wise:
SELECT City, SUM(Amount)
FROM SALES
GROUP BY City;
This groups records according to City and calculates the total amount for each city.
19. Aggregate Functions
Aggregate functions perform calculations on a group of records.
| Function | Meaning |
|---|---|
| COUNT() | Counts records/values |
| SUM() | Calculates total |
| AVG() | Calculates average |
| MAX() | Finds maximum |
| MIN() | Finds minimum |
Examples
SELECT COUNT(*) FROM STUDENT;
Counts all records.
SELECT MAX(Marks) FROM STUDENT;
Finds the highest marks.
SELECT MIN(Marks) FROM STUDENT;
Finds the lowest marks.
SELECT AVG(Marks) FROM STUDENT;
Calculates average marks.
SELECT SUM(Marks) FROM STUDENT;
Calculates total marks.
20. GROUP BY with Aggregate Function
Suppose we have:
EMPLOYEE
| EmpID | Name | Department | Salary |
|---|---|---|---|
| 1 | A | Sales | 30000 |
| 2 | B | HR | 35000 |
| 3 | C | Sales | 40000 |
| 4 | D | HR | 45000 |
To calculate department-wise average salary:
SELECT Department, AVG(Salary)
FROM EMPLOYEE
GROUP BY Department;
21. HAVING Clause
HAVING is generally used to apply a condition on groups created using GROUP BY.
Example
SELECT Department, AVG(Salary)
FROM EMPLOYEE
GROUP BY Department
HAVING AVG(Salary) > 35000;
This displays only those departments whose average salary is greater than 35000.
Very Important Difference
WHERE → condition on individual rows before grouping.
HAVING → condition on groups after grouping.
Exam Trick
WHERE → Rows
HAVING → Groups
22. Operating with Multiple Tables
In a relational database, information is often divided into multiple related tables.
For example:
STUDENT
| RollNo | Name | Class |
|---|---|---|
| 1 | Rahul | XII |
| 2 | Priya | XII |
MARKS
| RollNo | Subject | Marks |
|---|---|---|
| 1 | Accountancy | 85 |
| 2 | Accountancy | 91 |
The common field is:
RollNo
This field can be used to connect the tables.
23. Primary Key and Foreign Key
Primary Key
Uniquely identifies a record in its own table.
Example:
RollNo INT PRIMARY KEY
Foreign Key
A Foreign Key is a field that refers to a key in another table and helps establish a relationship between tables.
Example
In the STUDENT table:
RollNo → Primary Key
In the MARKS table:
RollNo → Foreign Key
Easy Trick
Primary Key = Own Identity
Foreign Key = Connects Tables
24. JOIN – Working with Multiple Tables
A JOIN combines related data from two or more tables.
Example
SELECT STUDENT.Name, MARKS.Subject, MARKS.Marks
FROM STUDENT
INNER JOIN MARKS
ON STUDENT.RollNo = MARKS.RollNo;
This combines student information with marks information using RollNo.
25. INNER JOIN
INNER JOIN returns records where matching values exist in both tables.
Syntax
SELECT column_names
FROM Table1
INNER JOIN Table2
ON Table1.common_field = Table2.common_field;
Example
SELECT STUDENT.Name, MARKS.Marks
FROM STUDENT
INNER JOIN MARKS
ON STUDENT.RollNo = MARKS.RollNo;
26. SQL Query Order – Important Trick
When writing a query containing several clauses, remember this general order:
SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY
Super Trick
Remember:
S F W G H O
You can remember it as:
"Students Find What Groups Have Order."
Not every query requires all these clauses.
27. Common SQL Commands – Quick Revision
| Purpose | Command |
|---|---|
| Create database | CREATE DATABASE |
| Select database | USE |
| Create table | CREATE TABLE |
| Insert records | INSERT INTO |
| Display records | SELECT |
| Change records | UPDATE |
| Delete records | DELETE |
| Change table structure | ALTER TABLE |
| Sort records | ORDER BY |
| Group records | GROUP BY |
| Filter rows | WHERE |
| Filter groups | HAVING |
| Combine tables | JOIN |
⭐ CBSE EXAM TRICKS
Trick 1 – CREATE vs INSERT
CREATE creates the structure.
INSERT adds data.
CREATE = Structure
INSERT = Records
Trick 2 – UPDATE vs ALTER
UPDATE changes data.
ALTER changes table structure.
UPDATE →
👉 Class 12 All Chapters Notes
👉 Class 11 Commerce Notes
🚀 Join CommerceWallah12 Family - Free Notes Daily!
▶️ YouTube: Subscribe Now - CommerceWallah12
📸 Instagram: Follow on Instagram
💬 WhatsApp Channel: Join WhatsApp Channel for MCQs
📱 Direct Help: 9664795023
Disclaimer: Ye notes NCERT & CBSE pattern par banaye gaye hai. Koi doubt ho to Contact Us par message karein.





Comments
Post a Comment