BIT202 · TU past paper
Database Management System 2078 question paper
The complete TU 2078 exam paper for Database Management System (BIT202), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- 15 marksER diagram purpose and symbolsHideAnswer
What is an E-R Diagram? Explain various symbols used in the E-R Diagram.[5]
An Entity-Relationship (E-R) Diagram is a graphical/pictorial representation of the logical structure of a database. It shows the entities (objects) in a system, the attributes of those entities, and the relationships between them. It wa...
- 25 marksTransaction definitionHideAnswer
What is Transaction? State and explain the properties of Transaction.[5]
A transaction is a logical unit of work that consists of a sequence of one or more database operations (such as read, write, insert, update, or delete) that must be executed as a single atomic unit. A transaction either completes fully o...
- 310 marksSQL data manipulation languageHideAnswer
From the relation given below, answer the following questions. EMPLOYEE (Ssn, Fname, Mnit, Name, Bdate, Address, Sex, Salary, Super_ssn, Dno) DEPARTMENT (Dname, Dnumber, Mgr_ssn, Mgr_start_date) PROJECT (Pname, Pnumber, Plocation, Dnum) DEPENDENT (Essn, Dependent_name, Sex, Bdate, Relationship) DEPT_LOCATIONS (Dnumber, Dlocation): a. Retrieve all the attributes of employees who work for the 'Computer' department department no 5 using SQL, b. For each Department, retrieve the department number, the number of employees in department, and their average salary using SQL, c. For each project on which more than two employees work, retrieve the project number, name, and the number of employees who work on that project using SQL, d. Select the EMPLOYEE tuples whose department is 10, or those whose salary is greater than Rs 50,000 using Relational Algebra, e. Retrieve the names of employees who have no dependents using Relational Algebra.[10]
- EMPLOYEE (Ssn, Fname, Mnit, Name, Bdate, Address, Sex, Salary, Superssn, Dno) - DEPARTMENT (Dname, Dnumber, Mgrssn, Mgrstartdate) - PROJECT (Pname, Pnumber, Plocation, Dnum) - DEPENDENT (Essn, Dependentname, Sex, Bdate, Relationship) -...
- 45 marksDatabase users and rolesHideAnswer
What are different types of Database Users? Explain in Brief. [5]
Database users are people who interact with the database system in different ways. They can be classified into the following types: --- - These are end users who interact with the database through predefined application programs (forms, ...
- 55 marksPrimary keys and foreign keysHideAnswer
What is Primary key and Foreign Key? Why is this required in the DBMS? [5]
--- A Primary Key is a column (or a set of columns) in a table that uniquely identifies each row/record in that table. - Must be unique for every record (no two rows can have the same primary key value) - Cannot contain NULL values - A t...
- 65 marksIntegrity constraintsHideAnswer
What is Integrity constraint? What are the three main categories of Integrity constraints. [5]
Integrity Constraints
Definition
An Integrity Constraint is a rule or condition imposed on a database to ensure the accuracy, consistency, and validity of data stored in the database. Integrity constraints prevent invalid data from being entered into the database and maintain the correctness of data throughout all operations (insertion, deletion, and update).
Three Main Categories of Integrity Constraints
1. Domain Integrity Constraints
- These constraints specify that the value of each attribute must be an atomic value from its domain (data type).
- They restrict the type, format, and range of values that can be stored in a column.
- Example: An attribute
Agemust contain only positive integer values; aGenderattribute may only accept'M'or'F'.
2. Entity Integrity Constraints
- This constraint states that the primary key of a relation must be unique and not null.
- Every tuple (row) in a relation must be uniquely identifiable.
- No attribute that is part of the primary key can have a NULL value.
- Example: In a
Studenttable, theStudentID(primary key) must have a unique, non-null value for every student record.
3. Referential Integrity Constraints
- This constraint is defined between two relations and is used to maintain consistency among tuples.
- It states that a foreign key in one relation must either match a primary key value in the referenced relation, or be NULL.
- It ensures that references between tables remain valid.
- Example: In an
Enrollmenttable, theStudentID(foreign key) must correspond to an existingStudentIDin theStudenttable.
Summary Table
Constraint Applies To Key Rule Domain Integrity Attribute values Values must be within defined domain Entity Integrity Primary Key Must be unique and not null Referential Integrity Foreign Key Must match a primary key or be null - 75 marksThird normal formHideAnswer
What is Functional Dependency? Explain 3NF with Examples. [5]
--- A functional dependency is a constraint between two sets of attributes in a relation. If attribute B is functionally dependent on attribute A, then for each value of A, there is exactly one corresponding value of B. Notation: A → B (...
- 85 marksSerial and non-serial schedulesHideAnswer
What is Schedule? Explain Serializability and Conflict Schedule. [5]
--- A schedule is a sequence of operations (read, write, commit, abort) from one or more concurrent transactions, arranged in the order they are executed by the system. - If transactions T1, T2, ..., Tn execute concurrently, a schedule d...
- 95 marksStarvation in DBMSHideAnswer
What is starvation in DBMS? Explain with example. [5]
Starvation (also called indefinite blocking) is a situation in which a transaction waits indefinitely for a lock or resource because other transactions are continuously granted priority over it, preventing it from ever proceeding. In oth...
- 105 marksMapping one-to-many relationshipsHideAnswer
During ER-to-Relational Mapping, explain with example to map 1: N and N:M relationship into a relation? [5]
Mapping 1:N and N:M Relationships in ER-to-Relational Mapping
1. Mapping 1:N (One-to-Many) Relationship
Rule / Approach
In a 1:N relationship, the entity on the N-side (many-side) gets the primary key of the 1-side entity added as a foreign key in its relation. No new relation is created.
Steps
- Create relations for both participating entity types.
- Identify the entity on the many side.
- Add the primary key of the one-side entity as a foreign key into the many-side relation.
- Also include any attributes of the relationship in the many-side relation.
Example
ER Diagram: A DEPARTMENT employs many EMPLOYEES (1:N)
DEPARTMENT (1) ----manages---- EMPLOYEE (N)Resulting Relations:
DEPARTMENT (Dept_No, Dept_Name, Location) PK EMPLOYEE (Emp_ID, Emp_Name, Salary, Dept_No) PK FK → DEPARTMENTThe primary key
Dept_Nofrom DEPARTMENT is placed as a foreign key in the EMPLOYEE relation.
2. Mapping N:M (Many-to-Many) Relationship
Rule / Approach
In an N:M relationship, a new relation (cross/junction table) is created to represent the relationship. This new relation contains:
- The primary key of the first entity (as FK)
- The primary key of the second entity (as FK)
- Any attributes of the relationship itself
- The combination of both foreign keys forms the primary key of the new relation.
Steps
- Create relations for both participating entity types.
- Create a new relation for the relationship.
- Include the primary keys of both entities as foreign keys in the new relation.
- The composite primary key = PK of entity 1 + PK of entity 2.
- Add any relationship attributes to the new relation.
Example
ER Diagram: A STUDENT enrolls in many COURSES, and a COURSE has many STUDENTS (N:M), with an attribute
Grade.STUDENT (N) ----enrolls---- COURSE (M) | Grade (relationship attribute)Resulting Relations:
STUDENT (Student_ID, Student_Name, Address) PK COURSE (Course_ID, Course_Name, Credits) PK ENROLLMENT (Student_ID, Course_ID, Grade) FK→STUDENT FK→COURSE |________________________| Composite PKA new relation ENROLLMENT is created with
Student_IDandCourse_IDas a composite primary key, andGradeas a relationship attribute.
Summary Table
Relationship New Relation Created? Foreign Key Placement 1:N No PK of 1-side added as FK in N-side relation N:M Yes PKs of both entities become composite PK in new relation - 115 marksNoSQL definition and characteristicsHideAnswer
What is NoSQL? What are the types of NoSQL? Explain. [5]
NoSQL (Not Only SQL) refers to a category of database management systems that do not follow the traditional relational (tabular) model. NoSQL databases are designed to handle: - Large volumes of unstructured or semi-structured data - Hig...
- 125 marksData models, schemas, and instancesHideAnswer
Explain Data Models, Schemas, and Instances. [5]
A data model is a collection of concepts or tools used to describe the structure of a database. It provides a way to describe the design of a database at logical, physical, and view levels. Data models define: - The data itself - Relatio...