Model Que
Model Que
PART 1
………………………………………………………………………………………………………
PART 2
21. Explain the difference between a relational database and a hierarchical database.
Ans:
A relational database stores data in tables with rows and columns and uses primary and
foreign keys to establish relationships. It is flexible and widely used.
A hierarchical database organizes data in a tree-like structure where each record has a
single parent, which makes querying relationships complex and less flexible.
One-to-Many: One record in a table relates to many records in another (e.g., customer
and orders).
Referential integrity.
24. What are the advantages of using a database management system (DBMS)?
Ans:
Reduces data redundancy and inconsistency.
Ans: Foreign keys establish relationships between tables, enforce referential integrity, and
enable complex queries involving related data.
27. What are the three levels of database abstraction? Explain with examples.
Ans:
Physical: Describes data storage details (e.g., blocks, bytes).
Logical: Describes what data is stored and relationships (e.g., tables, fields).
View: Simplifies user interaction with the database.
28. Describe the process of creating a database using MySQL and XAMPP.
Ans:
Install XAMPP and start the Apache and MySQL modules.
Access phpMyAdmin through http://localhost/phpmyadmin/.
Use the SQL tab or graphical interface to create databases and tables.
29. What is the difference between functional and non-functional requirements in database
design?
Ans:
Functional requirements describe what the system should do. These requirements specify the
functions and features that the database must provide to meet the needs of its users
Non-functional requirements describe how the system performs certain functions. These
requirements define the system's quality attributes, such as performance, usability, and
reliability.
30. What are the data types used in database design? Provide examples.
Ans:
Numeric data types such as: INT , TINYINT , BIGINT , FLOAT , REAL , etc.
Date and Time data types such as: DATE , TIME , DATETIME , etc.
Character and String data types such as: CHAR , VARCHAR , TEXT , etc.
Unicode character string data types such as: NCHAR , NVARCHAR , NTEXT , etc.
31. Explain the role of SQL in database management and provide examples of its key
commands.
Ans: SQL manages and manipulates database data through commands like SELECT,
INSERT, UPDATE, DELETE, and CREATE TABLE.
PART 3
1. Draw an ERD for a library system that tracks books, authors, and borrowers.
Ans:
Entities: Book (BookID, Title, AuthorID), Author (AuthorID, Name), Borrower (BorrowerID,
Name), and Transaction (TransactionID, BookID, BorrowerID, Date).
Relationships include:
2. Design an ERD for an e-commerce system involving customers, products, and orders.
Ans:
Entities: Customer (CustomerID, Name), Order (OrderID, Date, CustomerID), Product
(ProductID, Name, Price), and OrderDetails (OrderID, ProductID, Quantity).
Relationships:
Customer places Order.
Order contains Products (via OrderDetails).
3. Create an ERD for a school system with entities for students, courses, and instructors.
Ans:
Entities: Student (StudentID, Name), Course (CourseID, Title), Instructor (InstructorID, Name),
and Enrollment (StudentID, CourseID).
Relationships:
Student enrolls in Course.
Instructor teaches Course.
4. Write an SQL script to create a database for an employee management system with tables for
employees and departments.
Ans:
CREATE TABLE Departments (
DepartmentID INT PRIMARY KEY,
DepartmentName VARCHAR(100)
);
);
5. How would you use SQL to define a primary key and a foreign key? Provide examples.
Ans:
CREATE TABLE Customers (
CustomerID INT PRIMARY KEY,
Name VARCHAR(50)
);