Oracle Database Quiz Questions

Course Name:Oracle
Chapter Name:Chapter 8 - RDBMS Concepts
Lesson Content Link:ERD (Data Model)
Current Quiz Count:30
Progress
0%
Q1
True / False

In ORACLE, an Entity-Relationship Diagram (ERD) is used to visually represent the structure of a database.

Q2
True / False

In an ORACLE ERD, entities are represented by rectangles.

Q3
True / False

In ORACLE, a relationship in an ERD can be many-to-many.

Q4
True / False

In ORACLE, attributes in an ERD are depicted using ovals.

Q5
True / False

In an ORACLE ERD, primary keys are indicated by underlining the attribute name.

Q6
True / False

In ORACLE, foreign keys are used to establish relationships between entities in an ERD.

Q7
True / False

In ORACLE ERD, a weak entity does not have its own primary key.

Q8
True / False

In ORACLE ERD, a derived attribute is an attribute that can be calculated from other attributes.

Q9
True / False

In ORACLE, an ERD can include both physical and logical data models.

Q10
True / False

In ORACLE, identifying relationships in an ERD imply that the child entity is dependent on the parent entity for its identity.

Q11
Multiple Choice

Which SQL code snippet demonstrates creating a table based on an ERD where the primary key is a composite key?

SQL Code
CREATE TABLE enrollment (
student_id NUMBER,
course_id NUMBER,
enrollment_date DATE,
PRIMARY KEY (student_id, course_id)
);
Q12
Multiple Choice

Which SQL code snippet demonstrates adding a foreign key constraint based on an ERD model?

SQL Code
ALTER TABLE orders
ADD CONSTRAINT fk_customer_id
FOREIGN KEY (customer_id)
REFERENCES customers (customer_id);
Q13
Multiple Choice

Which SQL code snippet demonstrates creating a many-to-many relationship in a database based on an ERD?

SQL Code
CREATE TABLE student_course (
student_id NUMBER,
course_id NUMBER,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES students(student_id),
FOREIGN KEY (course_id) REFERENCES courses(course_id)
);
Q14
Multiple Choice

Which SQL code snippet demonstrates creating an ERD-based table with a self-referencing foreign key?

SQL Code
CREATE TABLE employees (
employee_id NUMBER PRIMARY KEY,
manager_id NUMBER,
FOREIGN KEY (manager_id) REFERENCES employees(employee_id)
);
Q15
Multiple Choice

Which SQL code snippet demonstrates the creation of a hierarchical relationship between tables based on an ERD model?

SQL Code
CREATE TABLE departments (
department_id NUMBER PRIMARY KEY,
parent_department_id NUMBER,
FOREIGN KEY (parent_department_id) REFERENCES departments(department_id)
);
Q16
Multiple Choice

Which SQL code snippet demonstrates advanced creation of an ERD-based table with multiple foreign keys?

SQL Code
CREATE TABLE project_assignment (
assignment_id NUMBER PRIMARY KEY,
employee_id NUMBER,
project_id NUMBER,
FOREIGN KEY (employee_id) REFERENCES employees(employee_id),
FOREIGN KEY (project_id) REFERENCES projects(project_id)
);
Q17
Multiple Choice

Which SQL code snippet demonstrates creating an advanced ERD-based table with a unique constraint on a composite key?

SQL Code
CREATE TABLE employee_contact (
employee_id NUMBER,
contact_type VARCHAR2(50),
contact_value VARCHAR2(100),
PRIMARY KEY (employee_id, contact_type),
UNIQUE (employee_id, contact_value)
);
Q18
Multiple Choice

Which SQL code snippet demonstrates certification-level creation of an ERD-based table with multiple composite keys and foreign key constraints?

SQL Code
CREATE TABLE task_assignment (
task_id NUMBER,
employee_id NUMBER,
project_id NUMBER,
PRIMARY KEY (task_id, employee_id),
FOREIGN KEY (employee_id, project_id) REFERENCES project_assignment(employee_id, project_id)
);
Q19
Multiple Choice

Which SQL code snippet demonstrates certification-level creation of a table with an ERD-based complex foreign key relationship?

SQL Code
CREATE TABLE order_items (
order_id NUMBER,
item_id NUMBER,
quantity NUMBER,
PRIMARY KEY (order_id, item_id),
FOREIGN KEY (order_id) REFERENCES orders(order_id),
FOREIGN KEY (item_id) REFERENCES items(item_id)
);
Q20
Multiple Choice

Which SQL code snippet demonstrates certification-level use of ERD concepts to create a normalized table structure with foreign key constraints?

SQL Code
CREATE TABLE product_category (
category_id NUMBER PRIMARY KEY,
parent_category_id NUMBER,
category_name VARCHAR2(50),
FOREIGN KEY (parent_category_id) REFERENCES product_category(category_id)
);
Q21
Single Choice

Which SQL statement is used to create a table that represents an entity in an ERD?

SQL Code
CREATE TABLE department (
 department_id NUMBER PRIMARY KEY,
 department_name VARCHAR2(50)
);
Q22
Single Choice

How would you define a one-to-many relationship between two entities in Oracle?

SQL Code
CREATE TABLE employee (
 employee_id NUMBER PRIMARY KEY,
 department_id NUMBER,
 CONSTRAINT fk_department FOREIGN KEY (department_id)
 REFERENCES department(department_id)
);
Q23
Single Choice

Which constraint would you apply to ensure that an attribute in an entity is unique across all records?

SQL Code
CREATE TABLE project (
 project_id NUMBER PRIMARY KEY,
 project_code VARCHAR2(10) UNIQUE,
 project_name VARCHAR2(100)
);
Q24
Single Choice

How would you represent a many-to-many relationship between two entities in Oracle?

SQL Code
CREATE TABLE enrollment (
 student_id NUMBER,
 course_id NUMBER,
 PRIMARY KEY (student_id, course_id),
 FOREIGN KEY (student_id) REFERENCES student(student_id),
 FOREIGN KEY (course_id) REFERENCES course(course_id)
);
Q25
Single Choice

Which SQL clause is used to enforce referential integrity between related entities?

SQL Code
CREATE TABLE order_details (
 order_id NUMBER,
 product_id NUMBER,
 CONSTRAINT fk_order FOREIGN KEY (order_id)
 REFERENCES orders(order_id)
);
Q26
Single Choice

How would you model an entity with optional attributes in an ERD using Oracle SQL?

SQL Code
CREATE TABLE contact (
 contact_id NUMBER PRIMARY KEY,
 phone_number VARCHAR2(15),
 email_address VARCHAR2(50) NULL
);
Q27
Single Choice

What is the best way to represent an inheritance relationship in an ERD using Oracle SQL?

SQL Code
CREATE TABLE person (
 person_id NUMBER PRIMARY KEY,
 name VARCHAR2(100)
);
CREATE TABLE employee (
 employee_id NUMBER PRIMARY KEY,
 person_id NUMBER,
 CONSTRAINT fk_person FOREIGN KEY (person_id)
 REFERENCES person(person_id)
);
Q28
Single Choice

Which key constraint ensures that each entity instance in a table is uniquely identifiable?

SQL Code
CREATE TABLE customer (
 customer_id NUMBER PRIMARY KEY,
 customer_name VARCHAR2(100)
);
Q29
Single Choice

How would you represent a weak entity in an ERD using Oracle SQL?

SQL Code
CREATE TABLE dependent (
 dependent_id NUMBER,
 employee_id NUMBER,
 PRIMARY KEY (dependent_id, employee_id),
 CONSTRAINT fk_employee FOREIGN KEY (employee_id)
 REFERENCES employee(employee_id)
);
Q30
Single Choice

How would you define a relationship between two entities with a mandatory participation constraint?

SQL Code
CREATE TABLE enrollment (
 student_id NUMBER,
 course_id NUMBER,
 PRIMARY KEY (student_id, course_id),
 FOREIGN KEY (student_id) REFERENCES student(student_id) ON DELETE CASCADE,
 FOREIGN KEY (course_id) REFERENCES course(course_id) ON DELETE CASCADE
);