SQL Revision | Database Concepts & SQL Commands | Complete Notes | CBSE Class 12 Informatics Practices (2026–27)
Class 12 · Informatics Practices
SQL Revision – Database Concepts & SQL Commands
Before learning advanced SQL functions in Class 12, it is important to revise the database concepts and SQL commands studied in Class XI. These concepts form the foundation for writing queries, retrieving data, and managing databases efficiently.
What is Data?
Data refers to raw facts and figures that can be processed to produce meaningful information.
Examples: Student names, marks, employee IDs, salaries.
What is a Database?
A Database is an organized collection of related data stored electronically for easy access, retrieval, and management.
What is DBMS?
A Database Management System (DBMS) is software used to create, store, retrieve, update, and manage databases.
Examples: MySQL, Oracle, Microsoft Access, PostgreSQL.
What is RDBMS?
A Relational Database Management System (RDBMS) stores data in the form of related tables and supports relationships between them.
Examples: MySQL, Oracle, SQL Server.
DBMS vs RDBMS
| DBMS | RDBMS |
|---|---|
| Stores data in files or tables. | Stores data in related tables. |
| Relationships are limited. | Supports relationships using keys. |
| Less secure. | More secure. |
| Suitable for small applications. | Suitable for large applications. |
Basic Database Terminology
| Term | Description |
|---|---|
| Table | Collection of rows and columns. |
| Record (Row) | A single entry in a table. |
| Field (Column) | A single attribute of a record. |
| Tuple | Another name for a row. |
| Attribute | Another name for a column. |
Keys in a Database
Primary Key
A Primary Key uniquely identifies each record in a table.
Example: RollNo, EmployeeID.
Candidate Key
A Candidate Key is any column that can uniquely identify a record.
Alternate Key
A Candidate Key that is not selected as the Primary Key becomes an Alternate Key.
Foreign Key
A Foreign Key is a field in one table that refers to the Primary Key of another table.
What is SQL?
SQL (Structured Query Language) is the standard language used to communicate with relational databases.
Categories of SQL Commands
| Category | Purpose | Examples |
|---|---|---|
| DDL | Define database objects | CREATE, ALTER, DROP |
| DML | Manipulate data | INSERT, UPDATE, DELETE |
| DQL | Retrieve data | SELECT |
| DCL | Control permissions | GRANT, REVOKE |
| TCL | Transaction control | COMMIT, ROLLBACK |
Creating a Table
CREATE TABLE Student
(
RollNo INT PRIMARY KEY,
Name VARCHAR(30),
Marks INT,
City VARCHAR(20)
);
Inserting Records
INSERT INTO Student VALUES (101,'Amit',85,'Jaipur');
Viewing Records
SELECT * FROM Student;
Selecting Specific Columns
SELECT Name, Marks FROM Student;
WHERE Clause
The WHERE clause filters records based on a condition.
SELECT * FROM Student WHERE Marks > 80;
DISTINCT Keyword
Returns only unique values.
SELECT DISTINCT City FROM Student;
LIKE Operator
Used for pattern matching.
SELECT * FROM Student WHERE Name LIKE 'A%';
Returns all names starting with A.
BETWEEN Operator
SELECT * FROM Student WHERE Marks BETWEEN 70 AND 90;
IN Operator
SELECT *
FROM Student
WHERE City IN
('Jaipur','Delhi');
Updating Records
UPDATE Student SET Marks=90 WHERE RollNo=101;
Deleting Records
DELETE FROM Student WHERE RollNo=101;
NULL Values
A NULL value means that data is missing or unknown.
Finding NULL Values
SELECT * FROM Student WHERE City IS NULL;
Finding Non-NULL Values
SELECT * FROM Student WHERE City IS NOT NULL;
Common SQL Operators
| Operator | Purpose |
|---|---|
| = | Equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal to |
| <= | Less than or equal to |
| <> or != | Not equal to |
Real-Life Applications
| Field | Database Example |
|---|---|
| School | Student Management System |
| Hospital | Patient Records |
| Bank | Customer Accounts |
| Library | Book Management |
| E-Commerce | Orders and Products |
Common Errors
| Error | Reason |
|---|---|
| Syntax Error | Incorrect SQL syntax. |
| Unknown Column | Column name does not exist. |
| Duplicate Entry | Duplicate value in Primary Key. |
| Table Doesn't Exist | Incorrect table name. |
Quick Revision
| Concept | Remember |
|---|---|
| Database | Collection of related data |
| DBMS | Database management software |
| RDBMS | Stores related tables |
| Primary Key | Uniquely identifies a record |
| Foreign Key | Creates relationship between tables |
| SELECT | Retrieve data |
| INSERT | Add records |
| UPDATE | Modify records |
| DELETE | Remove records |
CBSE Exam Tips
- Revise all SQL commands from Class XI before learning SQL functions.
- Remember the categories of SQL commands (DDL, DML, DQL, DCL, TCL).
- Understand the difference between Primary Key and Foreign Key.
- Practice writing SQL queries using
WHERE,LIKE,BETWEEN, andIN. - Always use
IS NULLandIS NOT NULLfor NULL values.
Summary
SQL is the standard language for managing relational databases. Before studying advanced SQL functions in Class 12, students should have a clear understanding of database concepts, keys, SQL command categories, and basic SQL statements such as CREATE, INSERT, SELECT, UPDATE, and DELETE. These concepts form the foundation for writing efficient database queries.