Khyber Pakhtunkhwa Board - DIT Part-II - Database Systems - 2nd Term 2026 (Fully Solved). Time Allowed: 02 Hrs & 40 Minutes | Marks: 60. Complete solved paper for exam preparation.
a) Processed
c) Logically related data
c) One parent
b) Network
c) Tables
c) DDL - Data Definition Language
b) MySQL
b) Unique and Not Null
b) Atomic values
c) WHERE
i. Data is raw facts, while Information is processed data.
ii. DBMS stands for Database Management System.
iii. Hierarchical model organizes data in tree structure.
iv. A database is an organized collection of logically related data stored in a Computer System.
v. SQL command used to insert data is INSERT INTO.
A Database is an organized collection of logically related data that is stored electronically in a computer system. It is designed to store, manage, and retrieve data easily. Example: Student database, Employee database. It is managed by DBMS.
A Primary Key is a field or combination of fields that uniquely identifies each record in a table. Properties: Must be Unique, Must be Not Null, Only one primary key per table. Example: Student_ID in Student table.
Normalization is the process of organizing data in a database to remove data redundancy and improve data integrity. It divides large tables into smaller tables and defines relationships between them. Its main types are 1NF, 2NF, 3NF, BCNF.
ERD stands for Entity Relationship Diagram. It is a graphical representation of the database structure that shows Entities, Attributes, and Relationships between entities. It uses symbols: Rectangle for Entity, Oval for Attribute, Diamond for Relationship.
Open Source & Free, High Performance and reliable, Easy to Use with PHP/Java, Provides strong data security, Runs on all major OS like Windows, Linux.
WHERE clause is used in SQL to filter records. It extracts only those records that fulfill a specific condition. Syntax: SELECT * FROM Students WHERE Marks > 50;
A table is in 2NF if: It is already in 1NF (all values are atomic) and it has no Partial Dependency - meaning all non-key attributes must fully depend on the whole primary key, not part of it. It is mainly important for tables with composite primary keys.
Entity: An entity is a real-world object about which we store data. Example: Student, Teacher, Book. Represented by a rectangle in ERD. Attribute: A property of an entity. Example: For Student entity, attributes are Name, Roll_No, Class. Represented by an oval in ERD.
1. Hierarchical Model: Organizes data in a tree structure. One parent can have many children, but each child has only one parent. Advantages: Simple, Fast. Disadvantages: Does not support many-to-many, complex to manage. 2. Network Model: Child can have many parents. Uses pointers to link records. Advantages: Supports many-to-many, flexible. Disadvantages: Very complex. 3. Relational Model (RDBMS): Data is stored in tables with rows and columns. Tables are related through keys. Advantages: Simple, flexible, supports SQL, widely used. Disadvantages: Can be slow for large data. 4. Object-Oriented Model: Data stored as objects like in OOP. Good for complex data like images, video but complex and not widely used.
a) Data Dictionary Management: DBMS maintains a Data Dictionary which stores metadata about database structure, tables, fields, relationships. b) Data Storage Management: DBMS creates and manages storage of data on disk efficiently. c) Data Integrity Management: DBMS ensures data is accurate and consistent. It enforces integrity rules like Primary Key, Foreign Key, Unique, Not Null.
1. DDL - Data Definition Language: Used to define and change structure. Commands: CREATE, ALTER, DROP, TRUNCATE. 2. DML - Data Manipulation Language: Used to manipulate data inside tables. Commands: SELECT, INSERT, UPDATE, DELETE. 3. DCL - Data Control Language: Used to control access. Commands: GRANT, REVOKE. Also TCL: COMMIT, ROLLBACK, SAVEPOINT.
a) COUNT(): Returns total number of rows. SELECT COUNT(*) FROM Students; b) LENGTH(): Returns length of a string. LENGTH('Ali') = 3. c) RTRIM(): Removes blank spaces from right side. d) SUBSTR(): Extracts substring. SUBSTR('Pakistan', 1, 4) = 'Paki'. e) CONCAT(): Joins two or more strings. CONCAT('Good',' Morning') = 'Good Morning'.
INNER JOIN: Returns only matching records from both tables. LEFT JOIN: Returns all records from left table and matching from right table. If no match, NULL. RIGHT JOIN: Opposite of LEFT JOIN. Returns all from right table. CROSS JOIN: Returns cartesian product - every row of first combined with every row of second. If A has 3 rows and B has 4, result = 12 rows.
