Database and SQL
A database is an organised collection of related data stored so it can be easily accessed, managed and updated. A Database Management System (DBMS) such as...
Why Databases Are Used
A database is an organised collection of related data stored so it can be easily accessed, managed and updated. A Database Management System (DBMS) such as MySQL is the software that handles it. In Class 12, databases matter because they store information far more reliably than plain files for large records. Data is arranged in tables made of rows (records) and columns (fields). Each table usually has a primary key, a column whose value is unique for every row and identifies it.
Core SQL Commands
SQL (Structured Query Language) is used to talk to a database. The most important commands are CREATE TABLE to make a table, INSERT INTO to add records, SELECT to retrieve data, UPDATE to change records, and DELETE to remove them. SELECT is the most used: SELECT name FROM student WHERE marks > 80 fetches names of students scoring above 80. Clauses like WHERE (condition), ORDER BY (sorting) and aggregate functions such as COUNT, SUM, AVG, MIN and MAX are commonly tested.
Example and Exam Tip
Example: SELECT COUNT(*) FROM student WHERE city = 'Delhi'; counts how many students are from Delhi. Exam tip: practise writing SELECT queries with WHERE and ORDER BY, and know the difference between primary key and foreign key. Board papers often give a table and ask you to write five queries on it, or to predict the output of a given query. Remember that SQL keywords are not case-sensitive but end statements with a semicolon, and that the Python-SQL interface (using a connector) is also part of the syllabus.