Database Concepts and SQL
Chapter Summary
A database is an organized collection of related data stored electronically in a computer system, designed to make data access, management, and updating efficient. In a Relational Database Management System (RDBMS), data is stored in tables (relations) consisting of rows (records/tuples) and columns (fields/attributes). A crucial concept for BISE board exams is the Primary Key, which is a unique identifier for each record in a table and cannot contain null values. To link two tables together, a Foreign Key is used, establishing a relationship between them and ensuring referential integrity.
To interact with these databases, we use Structured Query Language (SQL), which is divided into two primary sub-languages frequently tested in theory and practical exams: DDL (Data Definition Language) and DML (Data Manipulation Language). DDL commands are used to define or modify the database structure itself, including CREATE TABLE, ALTER TABLE, and DROP TABLE. On the other hand, DML commands are used to manage and query the actual data stored within those tables.
Mastering DML basics is essential for scoring high marks in SQL query sections. The SELECT statement is used to retrieve data, often paired with clauses like WHERE for filtering records, ORDER BY for sorting results, and aggregate functions such as SUM(), AVG(), COUNT(), MAX(), and MIN(). Additionally, students must know how to insert, update, and delete records using INSERT INTO, UPDATE, and DELETE FROM commands. Board exam questions often require writing syntax-correct queries based on a given table schema, making accurate command memorization critical.
Important Questions
- Define Database and Database Management System (DBMS). Give two examples of DBMS.3 marks
- Differentiate between Data and Information with suitable examples.3 marks
- What is a Primary Key? Explain its importance in a relational database with an example.3 marks
- Write short notes on: (i) Tuple (ii) Attribute (iii) Table3 marks
- What is SQL? Explain its basic data definition and data manipulation commands.5 marks
- Write a SQL query to create a table named 'Student' with columns RollNo, Name, and Age, where RollNo is the Primary Key.4 marks
- Explain the concept of Foreign Key and its role in maintaining data integrity between two tables.4 marks