Font size
Worksheets12B revew midterms
Total questions: 17
Worksheet time: 16mins
What does ERD stand for in database design?
Entity Relationship Data
Entity Relationship Diagram
Entity Reference Diagram
Enhanced Relational Database
In an ERD, what do rectangles represent?
Relationships
Attributes
Entities
Primary Keys
What is the purpose of a primary key in a database table?
To link tables together
To allow duplicate values in a table
To uniquely identify each record
To store large amounts of text
Which SQL command is used to create a new table in SQLite?
INSERT INTO
CREATE TABLE
NEW TABLE
ADD TABLE
What type of relationship exists when one record in Table A relates to many records in Table B?
One-to-One
One-to-Many
Many-to-Many
None of the above
What is the SQL syntax to define a foreign key in SQLite?
FOREIGN KEY (column_name) REFERENCES table_name(column_name)
SET FOREIGN KEY (column_name) IN table_name(column_name)
ADD FOREIGN KEY (column_name) TO table_name(column_name)
LINK FOREIGN KEY (column_name) WITH table_name(column_name)
Which of the following best describes a one-to-one relationship?
One student can enroll in multiple courses
A country has multiple cities
Each passport belongs to exactly one person
A book can be borrowed by multiple students
In an ERD, what symbol is typically used to represent a many-to-many relationship?
A solid line
A crow’s foot
A double circle
A triangle
What happens if you try to insert a duplicate value into a primary key column?
SQLite will allow it
SQLite will generate a warning but insert the data
SQLite will reject the insertion with an error
SQLite will replace the existing record
What are the three main components of an ERD?
Describe the difference between a primary key and a foreign key.
Write an SQL statement to create a Students table with the following fields: id (primary key), name, and age.
Write an SQL statement to create a Courses table with course_id as the primary key and course_name as a text field.
Write an SQL statement to create an Enrollments table that links Students and Courses using foreign keys.
How would you represent a one-to-many relationship in an ERD?
Why is it important to set NOT NULL constraints on certain columns in a table?
If you were designing an ERD for an e-commerce system, what three main entities would you include?
