0% found this document useful (0 votes)
3 views9 pages

FinalTerm RahulChahal

The document is a final exam for a course on Relational Database Systems, featuring multiple-choice and theory questions covering key concepts such as database purpose, relational models, integrity constraints, normalization, ACID properties, and SQL queries. It includes questions on data relationships and the database design process, along with practical SQL code examples. The exam is designed to assess students' understanding of relational databases and their applications.

Uploaded by

youwontgetemail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

FinalTerm RahulChahal

The document is a final exam for a course on Relational Database Systems, featuring multiple-choice and theory questions covering key concepts such as database purpose, relational models, integrity constraints, normalization, ACID properties, and SQL queries. It includes questions on data relationships and the database design process, along with practical SQL code examples. The exam is designed to assess students' understanding of relational databases and their applications.

Uploaded by

youwontgetemail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Final Exam

Relational Database Systems

Focus College

Mrityunjay Gupta

Rahul Chahal

Dec 20, 2023

Question 1: What is the primary purpose of databases?


a. Entertainment
b. Data Storage and Retrieval
c. Social Media
d. Gaming
Correct Answer: b. Data Storage and Retrieval

Question 2: Which database model uses tables to represent data?


a. Hierarchical
b. Relational
c. Object-Oriented
d. Network
Correct Answer: b. Relational

Final Exam 1
Question 3: What is a primary key used for in a relational database?

a. Sorting data
b. Ensuring uniqueness
c. Creating relationships
d. Performing calculations
Correct Answer: b. Ensuring uniqueness

Question 4: In which normal form is a relation least susceptible to anomalies?


a. 1NF
b. 2NF
c. 3NF
d. BCNF
Correct Answer: d. BCNF

Question 5: What is the purpose of an ER diagram in database design?

a. Data storage

b. Visualization of data relationships


c. Query optimization

d. Index creation
Correct Answer: b. Visualization of data relationships

Section B: Theory Questions (5 Marks Each)


Question 6: Explain the concept of integrity constraints in a relational database.

Final Exam 2
Answer:
Integrity in a relational database is like rules that make sure the information stored is
accurate and reliable. There are different types or different rules of integrity constraints
including.

Primary Key Constraint: Each row in the library must have a unique tag number
(primary key).

Foreign Key Constraint: This establishes a relationship between two tables by


linking the primary key of one table to the foreign key of another table.

Unique Constraint: This ensures that a column or a combination of columns in a


table contains unique values.

Not Null Constraint: This specifies that a column must always have a value and
cannot be left empty or null.

Check Constraint: This allows you to define a condition the data in a column must
satisfy. It limits the range of valid values that can be inserted into the column.

Therefore integrity constraints in the database can maintain data integrity, accuracy,
and consistency, ensuring the reliability and validity of the information stored within it.

Question 7: Differentiate between One-to-One, One-to-Many, and Many-to-Many


relationships with examples.

Answer:
In the Relational database, the terms One-to-One, One-to-Many, and Many-to-Many
relationships are between tables.

1. One-to-One Relationship: In a one-to-one relationship, each record in Table A is


related to exactly one record in Table B, and vice versa.

Example: Database of tracking electronic devices and their warranties. If there


are two tables, Device and Warranty . Each device (e.g., a laptop or smartphone)
has exactly one warranty, and each warranty is linked to only one device. The
relationship could be established using a unique identifier like DeviceID in the
Device table and WarrantyID in the Warranty table.

Final Exam 3
2. One-to-Many Relationship: In a one-to-many relationship, each record in Table A
can be related to multiple records in Table B, but each record in Table B is related to
only one record in Table A.

Example: for example, we're managing a library. we have two tables, Library

and Book . Each library can have multiple books, but each book is located in
only one library. The relationship is established using a common key, such as
LibraryID in the Library table and LibraryID in the Book table.

3. Many-to-Many Relationship: In a many-to-many relationship, each record in Table


A can be related to multiple records in Table B, and vice versa, facilitated by a
junction table.

Example: Imagine a database for a music store. You might have tables for
Artist and Album . Each artist can produce multiple albums, and each album

can involve multiple artists. To represent this many-to-many relationship, you


introduce a junction table, say ArtistAlbum , with columns like ArtistID and
AlbumID .

Question 8: Discuss the importance of normalization in database design.


Answer:

In the process of Normalization, organizing a database to reduce redundancy and


improve data integrity.

1. Minimizing Data Redundancy:

Avoids repeating the same information, making your data tidy and efficient.

2. Reducing Update Anomalies:

Breaks down data into smaller bits, so changing one thing doesn't mess up
everything.

3. Improving Data Integrity:

Ensures your data is accurate and consistent by organizing it logically.

Final Exam 4
4. Facilitating Query Performance:

Speeds up finding data by keeping related information in separate places.

5. Simplifying Schema Maintenance:

Makes updating or changing data structures straightforward and simple.

6. Supporting Scalability:

Sets a strong foundation for growth, letting you add new stuff without slowing
down.

7. Enforcing Business Rules:

Makes sure data follows the rules, keeping it reliable and trustworthy.

Question 9: Elaborate on the ACID properties and their significance in transaction


management.

Reference: What does ACID mean in Database Systems?

Answer: ACID, an acronym for Atomicity, Consistency, Isolation, and Durability, plays a
vital role in guaranteeing the dependability and integrity of database transactions.

ACID Properties

1. Atomicity:

What It Means: Doing a task is like playing a game level—all or nothing.

Why It Matters: It ensures your actions happen together or not at all, avoiding
weird in-between situations.

2. Consistency:

What It Means: Your game follows rules before and after each move.

Why It Matters: Keeps your data following the rules, avoiding odd situations,
like negative items in your online cart.

Final Exam 5
3. Isolation:

What It Means: Each player (or user) is in their own bubble, not seeing others'
moves.

Why It Matters: Stops one person's actions from messing up another's,


keeping the game fair and data safe.

4. Durability:

What It Means: Saving your game progress stays saved, even if the power
goes out.

Why It Matters: Ensures once something is done, like buying a new game
level, it stays done, no matter what happens later.

Question 10: Describe the steps involved in the database design process.
Answer:

The database design process involves several key steps to ensure the creation of an
efficient and well-organized database. Some of the steps:

1. Data Modeling

2. Testing

3. Physical Design

4. Maintenance and Optimization

5. Implementation

6. Training

7. Schema Refinement

8. Normalization

9. Documentation

10. Requirements Analysis

Final Exam 6
11. Conceptual Design

12. Deployment

13. Data Loading

Section C: MySQL Codes (10 Marks Total)

Question 11: Write a SQL query to retrieve all columns from the "Employees" table
where the salary is greater than 50000.
Answer

SELECT *
FROM Employees
WHERE Salary > 50000;

Question 12: Create a new table named "Orders" with columns for OrderID,
CustomerID, and OrderDate. Ensure that OrderID is the primary key.

Answer:

CREATE TABLE Orders (


OrderID INT PRIMARY KEY,
CustomerID INT,
OrderDate DATE
);

Final Exam 7
Question 13: Implement a JOIN operation to display the names of customers and their
corresponding orders.

Answer:

CREATE TABLE Customers (


CustomerID INT PRIMARY KEY,
CustomerName VARCHAR(50)
);

CREATE TABLE Orders (


OrderID INT PRIMARY KEY,
CustomerID INT,
OrderDate DATE,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);

-- JION opertation
SELECT Customers.CustomerName, Orders.OrderID, Orders.OrderDate
FROM Customers
JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

Question 14: Define a simple view named "HighSalaries" that displays employees
earning more than 70000.
Answer:

CREATE VIEW HighSalaries AS


SELECT *
FROM Employees
WHERE Salary > 70000;

Final Exam 8
Question 15: Write a transaction in MySQL that transfers an amount of 1000 from one
bank account to another. Ensure the ACID properties are maintained.
Answer:

CREATE PROCEDURE TransferAmount()


BEGIN
START TRANSACTION;

UPDATE BankAccounts
SET Balance = Balance - 1000
WHERE AccountID = 'RahulAccount';

UPDATE BankAccounts
SET Balance = Balance + 1000
WHERE AccountID = 'MrityunjayAcoount';

COMMIT;
END //
DELIMITER ;

CALL TransferAmount();

Final Exam 9

You might also like