Database Management Basics
Imagine a school that stores all student information — names, roll numbers, grades, attendance, and contact details — in paper registers. Finding a spe...
Introduction to Databases: Why We Need Them
Imagine a school that stores all student information — names, roll numbers, grades, attendance, and contact details — in paper registers. Finding a specific student's record means flipping through hundreds of pages. Updating one student's address means erasing and rewriting. Generating a list of students who scored above 90 in mathematics would require reading every single entry. A database solves all these problems.
A database is an organised collection of related data stored so that it can be easily accessed, managed, updated, and retrieved. A Database Management System (DBMS) is the software that manages databases — it handles creating, reading, updating, and deleting data through a standardised interface. Examples of DBMS software include MySQL, Microsoft Access, Oracle, SQLite, and PostgreSQL.
The most common type of database used in school computer science is the relational database, which organises data into tables (also called relations). Each table stores information about one type of entity. A school database might have a Students table, a Teachers table, a Subjects table, and an Attendance table. Tables are linked to each other through shared fields called keys.
A table is composed of rows and columns. Each row (also called a record or tuple) represents one instance of the entity — one student, one teacher, one subject. Each column (also called a field or attribute) represents one property of that entity — StudentID, Name, DateOfBirth, Class.
Before databases, organisations used flat files — simple text or spreadsheet files that stored all data in one place. The problems with flat files include data redundancy (the same information stored in many places), data inconsistency (copies getting out of sync), and difficulty enforcing data integrity rules. Relational databases solve these problems through careful table design.
Exam tip: CBSE questions often ask you to define terms: entity (a real-world object about which data is stored), attribute (a property of an entity), tuple (a row in a table), and relation (the table itself). Memorise these four definitions and their relationships.
Keys, Relationships, and Structured Query Language
In a relational database, tables are connected through special fields called keys. Understanding keys is essential for designing databases that store data efficiently without unwanted repetition.
A Primary Key is a field (or combination of fields) that uniquely identifies each row in a table. No two rows can have the same primary key value, and a primary key field can never be empty (NULL). In a Students table, StudentID (like "S001") makes a good primary key because every student has a unique ID. Using the student's name as a primary key would be problematic because two students could share the same name.
A Foreign Key is a field in one table that refers to the primary key of another table. It creates a link between the two tables. In an Attendance table, the StudentID field is a foreign key referencing the Students table. This relationship lets you look up full student details while storing just the ID in attendance records, avoiding repetition of the student's name, class, and address in every attendance row.
A Candidate Key is any field that could serve as a primary key (it is unique and non-null). There may be several candidate keys in a table; the designer chooses one to be the primary key. The others become alternate keys.
SQL (Structured Query Language) is the standard language for interacting with relational databases. The four fundamental SQL operations (CRUD) are: CREATE/INSERT: INSERT INTO Students (StudentID, Name, Class) VALUES ('S001', 'Priya', 10); READ: SELECT Name, Class FROM Students WHERE Class = 10; UPDATE: UPDATE Students SET Class = 11 WHERE StudentID = 'S001'; DELETE: DELETE FROM Students WHERE StudentID = 'S001';
The SELECT statement is the most used; it retrieves data matching specified conditions. The WHERE clause filters rows. ORDER BY sorts results: SELECT Name FROM Students ORDER BY Name ASC; lists students alphabetically.
Exam tip: Class 11 and 12 CBSE Computer Science papers include SQL questions asking you to write queries for described requirements. Practise translating plain English requirements ("List the names of all students in Class 10 who scored more than 80") into correct SQL statements.
Data Models, Normalisation, and Real-World Database Applications
Database design is not just about creating tables and filling them with data. Good database design ensures data is stored efficiently, consistently, and in a way that supports fast queries. Two key design concepts at the introductory level are data models and normalisation.
A data model defines how data is structured and related. The Entity-Relationship (ER) model is a popular tool for designing databases visually before implementation. In an ER diagram, rectangles represent entities (Students, Courses), ovals represent attributes (StudentName, CourseCode), and diamonds represent relationships between entities (Enrolled In). Relationships also have cardinality — one-to-one (one passport per person), one-to-many (one teacher teaches many students), and many-to-many (students enrol in many courses, and each course has many students).
Normalisation is the process of organising a database to reduce data redundancy and improve data integrity. The idea is to split data into well-structured tables so that each piece of information is stored in exactly one place. The first three Normal Forms (1NF, 2NF, 3NF) are the most commonly taught.
First Normal Form (1NF) requires that every cell in the table contains a single, atomic value (no lists or groups of values in one cell) and every row is unique. Second Normal Form (2NF) requires that the table is in 1NF and every non-key attribute depends on the whole primary key, not just part of it. Third Normal Form (3NF) requires 2NF and that non-key attributes do not depend on other non-key attributes.
Real-world applications of databases surround us. Railway and airline reservation systems use databases to track seats, passengers, and bookings. Hospital management systems store patient records, diagnoses, prescriptions, and billing. E-commerce platforms like Flipkart maintain product catalogues, customer accounts, order histories, and inventory. Every banking transaction is recorded in a database that must be consistent, secure, and recoverable after failures.
Exam tip: for CBSE Class 11, understand what an ER diagram represents and be able to draw a simple one for a described scenario (like a library system with Books, Members, and Borrowing relationships). Identify the entities, attributes, and relationship types.