Follow Us
माध्यम चुनें / Select Medium:
Eng (English) Hindi (हिन्दी)
CBSE • कक्षा 8 • Computer Science • अध्याय 2
अनुमानित समय: 45 Mins
प्रगति: अध्ययनरत

डेटाबेस का परिचय

In Class 8 Computer Science, "Database Management" is the architectural backbone of modern enterprise information systems, cloud computing, and big data engineering, strictly aligned with the JCERT and NCERT curriculum. In the pre-digital era, organizations relied on flat file systems (paper ledgers or plain text files), which suffered from crippling defects: rampant data redundancy (unnecessary duplication), severe data inconsistency, catastrophic lack of data concurrency, and non-existent security controls. This master study guide delivers an exhaustive, industry-grade exposition of Relational Database Management Systems (RDBMS). Students explore the relational model pioneered by Dr. Edgar F. Codd, mastering core architectural terminology: Relations (Tables), Tuples (Rows / Records), Attributes (Columns / Fields), Domain, Degree (number of columns), and Cardinality (number of rows). The chapter provides rigorous analysis of relational integrity constraints and Key structures—Primary Keys (uniqueness and NOT NULL enforcement), Candidate Keys, Alternate Keys, Foreign Keys (referential integrity), and Composite Keys. Furthermore, students learn the fundamentals of Structured Query Language (SQL)—categorizing commands into Data Definition Language (DDL: CREATE, ALTER, DROP) and Data Manipulation Language (DML: INSERT, UPDATE, DELETE, SELECT with WHERE, ORDER BY, DISTINCT, and aggregation functions)—concluding with foundational database normalization (1NF, 2NF, 3NF) and transaction ACID properties.

🗄️ How Does IRCTC Book 1.5 Million Train Tickets Every Day Without Ever Selling the Same Seat Twice?

At 10:00 AM every single morning, over 300,000 users log into the Indian Railways (IRCTC) reservation portal simultaneously, all trying to book the exact same Tatkal train seats on popular routes. If the railway used simple spreadsheets or paper registers, thousands of passengers would be assigned the exact same berth, leading to total chaos at railway platforms. How does a database guarantee that once a seat is booked by one traveler, it is instantly locked and unavailable to everyone else across the planet in milliseconds? The answer lies in the engineering genius of Relational Database Management Systems (RDBMS) and ACID transaction locks!

यह अध्याय क्यों महत्वपूर्ण है

Databases power virtually every digital service on Earth: social networks, banking ATMs, hospital health records, e-commerce stores, and government identity registries (Aadhaar). Mastering SQL and database design is the universal bedrock of software engineering and data science.

अध्ययन से पूर्व (आवश्यक ज्ञान)

  • Basic understanding of tables, rows, columns, and spreadsheet records.
  • Familiarity with data types: numbers, text (characters/strings), dates, and Boolean values.
  • Basic logical operators: AND, OR, NOT, greater than (>), less than (<), and equal to (=).

इस अध्याय के लक्ष्य

  • Contrast traditional Flat File Systems with Relational Database Management Systems (RDBMS) across data redundancy, integrity, and security.
  • Define core relational terminology: Relation, Tuple, Attribute, Domain, Degree, and Cardinality with practical schema examples.
  • Identify and differentiate Key constraints: Primary Key, Candidate Key, Alternate Key, Foreign Key, and Composite Key.
  • Formulate standard SQL statements across DDL (CREATE TABLE, ALTER TABLE, DROP TABLE) and DML (SELECT, INSERT INTO, UPDATE, DELETE).
  • Apply SQL filtering, sorting, and aggregate functions: WHERE, ORDER BY, DISTINCT, COUNT(), SUM(), AVG(), MIN(), MAX().
  • Explain transaction ACID properties (Atomicity, Consistency, Isolation, Durability) and basic normalization principles (1NF, 2NF, 3NF).

अध्याय रूपरेखा एवं प्रगति

1 1. Evolution from File Systems to D...
2 2. Relational Model Architecture &...
3 3. Database Keys & Relational Integ...
4 4. SQL Foundations (DDL vs. DML) &...

सम्पूर्ण सैद्धांतिक एवं वैचारिक अध्ययन

1. Evolution from File Systems to DBMS & Enterprise Advantages

Before the advent of databases, computer systems stored information in decentralized flat files. As organizational data expanded, file-based storage encountered insurmountable obstacles:

Challenge / Parameter Traditional Flat File System Relational DBMS (RDBMS) Solution
Data Redundancy Massive duplication. The same student name and address is typed into accounts, library, and exam files separately. Controlled redundancy through normalization; data is stored once in a centralized master table.
Data Inconsistency High risk. If a student updates their phone number in the library file, the accounts file still holds the obsolete number. Centralized updates guarantee that an edit in one relation instantly reflects across the entire system.
Concurrent Access & Isolation File locking prevents simultaneous edits or overwrites previous user changes without warning. Sophisticated multi-user concurrency control with row-level transaction locks and ACID safeguards.
Data Security & Access Control All-or-nothing file access; difficult to restrict specific confidential columns (like salaries). Role-based access control (RBAC), view-level masking, and granular cryptographic authorization.

2. Relational Model Architecture & Schema Terminology

The Relational Model organizes data into two-dimensional grid tables known as Relations. Understanding formal database terminology is essential for accurate schema modeling:

  • Relation (Table): A structured two-dimensional matrix containing rows and columns representing a real-world entity (e.g., Students, Books, Orders).
  • Tuple (Row / Record): A single horizontal row in a relation representing one complete instance of the entity (e.g., all details of student "Aman Kumar").
  • Attribute (Column / Field): A vertical column in a relation representing a specific characteristic or property of the entity (e.g., Roll_No, Name, Date_of_Birth).
  • Domain: The permissible pool or set of legal atomic values from which an attribute can draw its values (e.g., the domain of Marks is integers from 0 to 100).
  • Degree: The total number of attributes (columns) present in a relation. (e.g., a table with 5 columns has a Degree of 5).
  • Cardinality: The total number of tuples (rows) currently stored in a relation. (e.g., a table with 250 student records has a Cardinality of 250).

3. Database Keys & Relational Integrity Constraints

To ensure data uniqueness and prevent corruption, relational databases enforce structural constraints through Keys:

The Taxonomy of Relational Database Keys

  • Primary Key: A chosen candidate attribute that uniquely identifies each tuple in a relation. It MUST satisfy two strict rules: Uniqueness (no two rows can share the same value) and NOT NULL (it can never be left empty/blank). Example: Admission_No.
  • Candidate Key: All individual attributes or minimal attribute combinations within a table that possess the capacity to uniquely identify a tuple. (e.g., both Aadhaar_No and Admission_No are Candidate Keys).
  • Alternate Key: Any candidate key that was NOT chosen as the primary key. (If Admission_No is chosen as Primary Key, Aadhaar_No becomes the Alternate Key).
  • Foreign Key: An attribute in one relation (child table) whose values are derived directly from the Primary Key of another relation (parent table). It enforces Referential Integrity, ensuring that orphan records cannot be created.
  • Composite Key: A primary key formed by combining two or more attributes together when no single attribute alone is sufficient to guarantee uniqueness.

4. SQL Foundations (DDL vs. DML) & ACID Transaction Guarantees

SQL (Structured Query Language) is the standardized programming language utilized to create, query, and manipulate relational databases:

SQL Category Core Operations / Commands Operational Scope & Example Syntax
DDL (Data Definition Language) CREATE, ALTER, DROP Defines, modifies, or destroys the structural blueprint (schema) of tables.
CREATE TABLE Students (Roll_No INT PRIMARY KEY, Name VARCHAR(50));
DML (Data Manipulation Language) SELECT, INSERT, UPDATE, DELETE Queries, adds, updates, or deletes data tuples within existing tables.
SELECT Name, Marks FROM Students WHERE Marks >= 80 ORDER BY Marks DESC;
ACID Transaction Guarantees:
• Atomicity: All-or-nothing execution; if any step in a multi-step transaction fails, the entire transaction rolls back.
• Consistency: The database transitions only between valid states conforming to all schema constraints.
• Isolation: Concurrent transactions execute independently without cross-contaminating intermediate states.
• Durability: Once committed, updates persist permanently in non-volatile storage even through power crashes.

प्रोग्रामिंग सिंटेक्स, स्टेटमेंट्स एवं भाषा अनुवादक नियम

Degree of a Relation
Degree = Total Number of Attributes (Columns)
Fixed structural metric defined during table creation.
Cardinality of a Relation
Cardinality = Total Number of Tuples (Rows)
Dynamic metric that fluctuates as records are inserted or deleted.
Primary Key Invariant Constraints
Primary Key = UNIQUE Constraint + NOT NULL Constraint
Guarantees absolute entity integrity for every single tuple in the table.
SQL Standard Query Pattern
SELECT cols FROM table WHERE filter ORDER BY col [ASC|DESC];
Universal syntax template for relational data extraction.
Referential Integrity Rule
Child.ForeignKey in Parent.PrimaryKey OR Child.ForeignKey IS NULL
Prevents orphan records across linked relational tables.

अवधारणात्मक हल उदाहरण एवं अनुप्रयोग (Solved Examples)

उदाहरण 1
Question 1: Consider a table named "STUDENT" with 6 columns (AdmNo, Name, Class, Sec, Marks, City) containing records for 45 students. State the Degree and Cardinality of this table. If 5 new students join and the "City" column is removed, what are the new Degree and Cardinality?
विस्तृत समाधान / उत्तर:

Answer:

  1. Initial State:
  • Degree = Number of attributes (columns) = 6.
  • Cardinality = Number of tuples (rows) = 45.
  1. After Modifications:
  • 5 new students join -> Number of rows becomes 45 + 5 = 50.
  • The "City" column is dropped -> Number of columns becomes 6 - 1 = 5. New Degree = 5. New Cardinality = 50.
उदाहरण 2
Question 2: Differentiate between a Primary Key and a Foreign Key with a real-world School Management database schema.
विस्तृत समाधान / उत्तर:

Answer:

  1. Primary Key:
  • Definition: An attribute that uniquely identifies every tuple within its own table. It cannot contain duplicate values and cannot be NULL.
  • Example: In the "STUDENTS" parent table: Columns: Roll_No (Primary Key), Student_Name, Class. Here, Roll_No uniquely identifies each student (e.g., Roll No 101 belongs exclusively to Aman).
  1. Foreign Key:
  • Definition: An attribute in a child table that references the Primary Key of a parent table to establish a relationship and enforce referential integrity.
  • Example: In the "LIBRARY_ISSUED" child table: Columns: Issue_ID (Primary Key), Book_ID, Student_Roll_No (Foreign Key), Issue_Date. Here, Student_Roll_No is a Foreign Key referencing STUDENTS.Roll_No.
  • Enforcement: The library software will reject any book issue attempt if the operator types Roll No 999 when Roll No 999 does not exist in the STUDENTS table. This prevents "orphan records".
उदाहरण 3
Question 3: Write standard SQL statements for the following database operations on a table named "EMPLOYEE" with columns (EmpID, Name, Department, Salary, City): (a) Retrieve all employees working in the "IT" department who earn more than 50,000, ordered by Salary descending. (b) Increase the Salary of all employees in the "HR" department by 10%. (c) Delete all employee records where City is "Patna".
विस्तृत समाधान / उत्तर:
Answer: (a) Query data with filtering and sorting: ```sql SELECT * FROM EMPLOYEE WHERE Department = "IT" AND Salary > 50000 ORDER BY Salary DESC; ``` (b) Update existing records: ```sql UPDATE EMPLOYEE SET Salary = Salary * 1.10 WHERE Department = "HR"; ``` (c) Delete records matching a condition: ```sql DELETE FROM EMPLOYEE WHERE City = "Patna"; ```
उदाहरण 4
Question 4: What are the ACID properties in database transaction management? Explain their necessity using a bank fund transfer example.
विस्तृत समाधान / उत्तर:

Answer: Suppose Account A transfers ₹10,000 to Account B. This involves two steps: (1) Deduct ₹10,000 from A, and (2) Add ₹10,000 to B.

  1. Atomicity ("All or Nothing"): If the system crashes after step 1 (money deducted from A) but before step 2 (money added to B), Atomicity ensures the transaction is completely rolled back. A’s money is refunded. The transaction never stays half-done.
  2. Consistency: The total sum of money in the banking system remains conserved and compliant with balance rules before and after the transfer.
  3. Isolation: If Account A’s balance is queried while the transfer is occurring, other users see either the pre-transfer balance or the post-transfer balance, never an intermediate corrupted state.
  4. Durability: Once the bank displays "Transfer Successful" (transaction committed), the update is permanently written to disk. Even if the server suffers an electrical blackout a second later, the balances remain intact.
उदाहरण 5
Question 5: Differentiate between Data Definition Language (DDL) and Data Manipulation Language (DML). Classify the following commands: DROP, UPDATE, ALTER, INSERT.
विस्तृत समाधान / उत्तर:

Answer:

  1. Differences:
  • DDL (Data Definition Language): Commands that operate on the structure, schema, or blueprint of the database. DDL changes are auto-committed and affect table definitions, constraints, and data types.
  • DML (Data Manipulation Language): Commands that operate on the actual data records (tuples) stored inside the tables. DML commands insert, modify, delete, and query rows without changing table schema.
  1. Classification of Commands:
  • DROP: DDL (permanently destroys a table schema and its contents).
  • ALTER: DDL (modifies table schema by adding, renaming, or dropping columns).
  • INSERT: DML (adds new data tuples into an existing table).
  • UPDATE: DML (modifies attribute values of existing tuples).

सामान्य गलतियाँ एवं परीक्षक के जाल (Examiner Traps)

सामान्य भ्रम / गलत उत्तर

Confusing the DROP command with the DELETE command in SQL.

सही वैज्ञानिक तथ्य

DELETE is a DML command that removes specific rows (tuples) from a table while preserving the table structure. DROP is a DDL command that completely obliterates the entire table schema and all data permanently.

सामान्य भ्रम / गलत उत्तर

Allowing a Primary Key column to contain NULL (empty) values.

सही वैज्ञानिक तथ्य

Entity Integrity strictly dictates that a Primary Key must be both UNIQUE and NOT NULL. A primary key can never be left empty.

सामान्य भ्रम / गलत उत्तर

Writing the WHERE clause after the ORDER BY clause in a SELECT query.

सही वैज्ञानिक तथ्य

In standard SQL syntax order, the WHERE filtering clause must ALWAYS precede the ORDER BY sorting clause (i.e. SELECT ... FROM ... WHERE ... ORDER BY ...).

चित्रात्मक व्याख्या एवं मॉडल

Relational Database Architecture & SQL Schema Matrix JCERT / NCERT Class 8 Computer Science | RDBMS, Keys, DDL/DML & ACID Transactions Referential Integrity (Primary -> Foreign Key) Parent Table: STUDENTS (Master) • Roll_No (PRIMARY KEY) • Student_Name Degree = 4 (Columns) • Cardinality = 500 (Rows) Foreign Key Link Child Table: LIBRARY_ISSUED • Issue_ID (PK) • Roll_No (FOREIGN KEY) Enforces Referential Integrity • Prevents orphan records SQL Taxonomy & ACID Guarantees DDL (Structure / Schema): CREATE TABLE, ALTER TABLE, DROP TABLE (Auto-committed) DML (Data Manipulation): SELECT, INSERT INTO, UPDATE, DELETE (Row-level actions) ACID Transaction Pillars: • Atomicity: All-or-nothing execution • Consistency: Rule validation • Isolation: Concurrency locking • Durability: Permanent disk commit Core Database Metrics & Query Syntax: • Degree: Total attributes (columns) • Cardinality: Total tuples (rows) • Primary Key: Unique identifier + NOT NULL constraint (No duplicates or blanks) • SELECT: SELECT cols FROM tbl WHERE cond; • UPDATE: UPDATE tbl SET col=val WHERE cond;

अध्याय का सार संक्षेप एवं 10 मुख्य निष्कर्ष

मुख्य बिंदु 1
  1. A Database is an organized, centralized collection of interrelated data designed to eliminate redundancy, inconsistency, and access friction.
मुख्य बिंदु 2
  1. In the Relational Model, data is structured into two-dimensional tables called Relations, with rows known as Tuples and columns called Attributes.
मुख्य बिंदु 3
  1. The Degree of a relation is its total number of columns; the Cardinality is the dynamic count of its current rows.
मुख्य बिंदु 4
  1. A Primary Key uniquely identifies every tuple in a relation and must strictly satisfy the UNIQUE and NOT NULL constraints.
मुख्य बिंदु 5
  1. Candidate Keys are all attributes capable of serving as the primary key; the unselected candidate keys become Alternate Keys.
मुख्य बिंदु 6
  1. A Foreign Key is an attribute in a child relation referencing the primary key of a parent relation to enforce Referential Integrity.
मुख्य बिंदु 7
  1. SQL Data Definition Language (DDL) includes CREATE, ALTER, and DROP to manage database structure and schema blueprints.
मुख्य बिंदु 8
  1. SQL Data Manipulation Language (DML) includes SELECT, INSERT INTO, UPDATE, and DELETE to manage data tuples within existing tables.
मुख्य बिंदु 9
  1. SQL aggregate functions include COUNT(), SUM(), AVG(), MIN(), and MAX() to compute statistics across columns.
मुख्य बिंदु 10
  1. ACID properties (Atomicity, Consistency, Isolation, Durability) guarantee that multi-user database transactions execute reliably without data loss.

स्व-मूल्यांकन अभ्यास (Check Your Understanding)

मूल वैचारिक स्पष्टता की जांच के लिए नैदानिक प्रश्न। पहले स्वयं हल करें, फिर उत्तर देखें।

1
What is the Cardinality of a table with 8 columns and 120 student records?
उत्तर एवं व्याख्या देखें
उत्तर: 120
Cardinality refers to the total number of tuples (rows/records) in a relation, which is 120. (Its Degree is 8).
2
Can a Primary Key column ever accept a NULL value?
उत्तर एवं व्याख्या देखें
उत्तर: No, never.
Entity Integrity dictates that a Primary Key must be strictly UNIQUE and NOT NULL so that every record can be identified unambiguously.
3
Which SQL command is used to permanently destroy an entire table structure along with all its data?
उत्तर एवं व्याख्या देखें
उत्तर: DROP TABLE
DROP TABLE is a DDL command that removes the entire table schema. In contrast, DELETE only empties rows while keeping the table structure intact.
4
What relational constraint is enforced by linking a Foreign Key to a Primary Key?
उत्तर एवं व्याख्या देखें
उत्तर: Referential Integrity
Referential Integrity ensures that foreign key values in a child table must correspond to valid primary key values in the parent table.
5
Which ACID property ensures that all steps in a transaction either complete entirely or roll back completely with no partial saves?
उत्तर एवं व्याख्या देखें
उत्तर: Atomicity
Atomicity treats the entire transaction as a single atomic unit of work: either all operations succeed, or all are undone.
अध्याय का अध्ययन पूर्ण हुआ?
अभ्यास के लिए तैयार?

ऑनलाइन CBT टेस्ट देकर तैयारी का मूल्यांकन करें

झारखण्ड बोर्ड परीक्षा पैटर्न पर आधारित बहुविकल्पीय प्रश्नों का ऑनलाइन टेस्ट दें। तुरंत परिणाम, समय विश्लेषण और प्रत्येक प्रश्न का विस्तृत हल प्राप्त करें।