0% found this document useful (0 votes)
12 views7 pages

Model Que

The document covers key concepts and questions related to databases, including definitions of database models, relationships, keys, and data integrity. It also explains the differences between relational and hierarchical databases, the advantages of using a DBMS, and provides examples of SQL commands. Additionally, it includes exercises for creating ERDs and SQL scripts for database management.

Uploaded by

ruburikabruce
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)
12 views7 pages

Model Que

The document covers key concepts and questions related to databases, including definitions of database models, relationships, keys, and data integrity. It also explains the differences between relational and hierarchical databases, the advantages of using a DBMS, and provides examples of SQL commands. Additionally, it includes exercises for creating ERDs and SQL scripts for database management.

Uploaded by

ruburikabruce
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/ 7

SUMMARY OF DATABASE 1st TERM

PART 1

1. Which of the following is not a database model?


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

2. What does ERD stand for?


a. Entity Relations Diagram
b. Entity Relationship Diagram
c. Entity Related Diagram
d. Entities and Relationship Description
Answer: b. Entity Relationship Diagram

3. Which of the following best defines a relational database?


a. Data stored in a hierarchical structure
b. Data stored in objects
c. Data stored in tables with rows and columns
d. Data stored in XML format
Answer: c. Data stored in tables with rows and columns

4. In a database, a field is also referred to as:


a. Record
b. Attribute
c. Tuple
d. Object
Answer: b. Attribute

5. Which SQL command is used to retrieve data from a database?


a. INSERT
b. DELETE
c. SELECT
d. UPDATE
Answer: c. SELECT

6. A primary key can have null values.


Answer: False
7. The logical level of data abstraction describes how data is stored.
Answer: False

8. A one-to-many relationship is the most common type of relationship in databases.


Answer: True

9. Metadata refers to data about other data.


Answer: True

10. A view is a stored table in a database.


Answer: False

11. Define a database.


A database is a collection of related data organized in a way to minimize redundancy and support
efficient storage and retrieval.

12. What is a primary key?


A primary key is a unique identifier for each record in a database table.

13. What is a foreign key?


A foreign key is a field in one table that uniquely identifies a row in another table, creating a
relationship between the two tables.

14. Define metadata.


Metadata is data that describes other data, such as its structure, type, constraints, and
relationships.

15. What is an ERD?


An ERD (Entity-Relationship Diagram) visually represents entities, attributes, and relationships
in a database.

16. What is data redundancy?


Data redundancy refers to unnecessary duplication of data in a database.

17. Define a view in a database.


A view is a virtual table created by a query that pulls data from one or more underlying tables.

18. What is a record in a database?


A record is a collection of related data stored as a row in a database table.

19. What is normalization in databases?


Normalization is the process of organizing a database to reduce redundancy and improve data
integrity.

20. What is a relational database?


A relational database organizes data into tables, which are related to each other through keys.

………………………………………………………………………………………………………

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.

22. Describe the types of relationships in databases (one-to-one, one-to-many, many-to-many).


Ans:
 One-to-One: One record in a table relates to one record in another (e.g., person and
passport).

 One-to-Many: One record in a table relates to many records in another (e.g., customer
and orders).

 Many-to-Many: Many records in a table relate to many in another through an


intermediary table (e.g., students and courses).

23. How does a database ensure data integrity?


Ans:
Data integrity is ensured by:
 Constraints (e.g., primary key, foreign key, unique, not null).

 Data validation rules.

 Referential integrity.

 Proper normalization to eliminate redundancy.

24. What are the advantages of using a database management system (DBMS)?

Ans:
 Reduces data redundancy and inconsistency.

 Provides centralized management.

 Ensures data security and integrity.

 Supports concurrent access by multiple users.

25. Discuss the significance of using foreign keys in database design.

Ans: Foreign keys establish relationships between tables, enforce referential integrity, and
enable complex queries involving related data.

26. What is the role of constraints in a database? Provide examples.


Ans:
Constraints enforce rules to maintain accuracy and integrity, such as:
 Primary Key: Ensures unique identifiers.
 Foreign Key: Maintains relationships.
 Not Null: Prohibits null values.
 Unique: Ensures unique values in a column.

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:

Author writes Book.

Borrower borrows Book through Transaction.

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)
);

CREATE TABLE Employees (


EmployeeID INT PRIMARY KEY,
Name VARCHAR(100),
DepartmentID INT
FOREIGN KEY (DepartmentID) REFERENCES Departments(DepartmentID);

);

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)
);

CREATE TABLE Orders (


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

6. Using MySQL, write a query to insert data into a customer table.


Ans:
INSERT INTO Customers (CustomerID, Name)
VALUES (1, 'Alice');

You might also like