{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

Relational Data Model and Constraints MCQs Flashcards

(30 cards)

1
Q

Which of the following is NOT a characteristic of a relation in the relational data model?

o A) Each relation has a unique name.
o B) Each relation can have duplicate rows.
o C) Each relation consists of tuples.
o D) Each tuple has a fixed number of attributes.

A

Each relation can have duplicate rows.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a primary key in a relational database?

o A) A key that allows duplicate values
o B) A unique identifier for a record in a table
o C) A foreign key referencing another table
o D) An attribute that can be null

A

A unique identifier for a record in a table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the NOT NULL constraint enforce in a relational database?

o A) A column cannot contain duplicate values
o B) A column must have a value (cannot be empty)
o C) A column can only have unique values
o D) A column must have a default value

A

A column must have a value (cannot be empty)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following describes a composite primary key?

o A) A primary key made of a single attribute
o B) A primary key that is automatically generated
o C) A primary key consisting of multiple attributes
o D) A primary key that allows null values

A

A primary key consisting of multiple attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following constraints can be used to enforce business rules in a relational database?

o A) Primary key constraint
o B) Foreign key constraint
o C) Check constraint
o D) All of the above

A

All of the above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the role of a foreign key in a relational database?

o A) To uniquely identify a record
o B) To reference a primary key in another table
o C) To enforce referential integrity
o D) Both B and C

A

Both B and C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which SQL command can be used to add constraints to an existing table?

o A) CREATE
o B) ALTER
o C) UPDATE
o D) INSERT

A

ALTER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the CHECK constraint do in a relational database?

o A) Ensures a column has a unique value
o B) Ensures a column cannot be null
o C) Enforces a specific condition on a column’s values
o D) Links two tables together

A

Enforces a specific condition on a column’s values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the effect of a cascading delete in a relational database?

o A) It prevents deletion of records
o B) It deletes a record and all related records in other tables
o C) It only deletes the primary key
o D) It creates a backup of the deleted records

A

It deletes a record and all related records in other tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the term “referential integrity” specifically refer to?

o A) Maintaining a unique primary key in each table
o B) Ensuring that foreign keys correctly reference existing primary keys
o C) Enforcing that no attribute can be null
o D) Restricting updates to primary keys

A

Ensuring that foreign keys correctly reference existing primary keys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In a relational database, how can you define a default value for a column?

o A) By using the DEFAULT constraint
o B) By using the NOT NULL constraint
o C) By using the CHECK constraint
o D) By specifying it in the CREATE TABLE statement

A

By using the DEFAULT constraint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which SQL statement is used to remove a constraint from a table?

o A) DROP
o B) DELETE
o C) REMOVE
o D) ALTER

A

ALTER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the term “cascade” mean in the context of referential integrity?

o A) It allows changes in one table to affect another table.
o B) It prevents any changes to the primary key.
o C) It enforces uniqueness across multiple tables.
o D) It allows for duplicate records in a table.

A

It allows changes in one table to affect another table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the difference between a primary key and a unique key?

o A) A primary key can be null; a unique key cannot.
o B) A unique key can have multiple null values; a primary key cannot.
o C) Both serve the same purpose.
o D) A primary key is used for foreign key relationships; a unique key is not.

A

A unique key can have multiple null values; a primary key cannot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In relational databases, what is the role of the database schema?

o A) It defines how data is stored in physical files.
o B) It describes the structure of the database, including tables and relationships.
o C) It enforces data integrity rules.
o D) It represents the data in a graphical format.

A

It describes the structure of the database, including tables and relationships.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following constraints is automatically enforced by the database system?

o A) CHECK
o B) NOT NULL
o C) UNIQUE
o D) Both B and C

17
Q

What is the outcome of trying to remove a primary key that is referenced by a foreign key in another table?

o A) The primary key is removed, and the foreign key is set to null.
o B) The primary key is removed, and the foreign key is also removed.
o C) An error occurs due to referential integrity violation.
o D) The operation is successful without any restrictions.

A

An error occurs due to referential integrity violation.

18
Q

Which of the following operations might violate referential integrity?

o A) Inserting a record with a valid foreign key
o B) Deleting a record that is referenced by a foreign key
o C) Updating a primary key that is not referenced
o D) None of the above

A

Deleting a record that is referenced by a foreign key

19
Q

What does the term “entity integrity” ensure in a relational database?

o A) All foreign keys must match primary keys.
o B) No two entities can have the same primary key value.
o C) All attributes must have values.
o D) All relationships must be defined.

A

No two entities can have the same primary key value.

20
Q

In SQL, which statement is used to create a new table with constraints?

o A) CREATE TABLE
o B) NEW TABLE
o C) INSERT TABLE
o D) DEFINE TABLE

21
Q

What type of relationship is represented by a one-to-many constraint in a relational database?

o A) A single entity can relate to multiple entities.
o B) Multiple entities can relate to a single entity.
o C) Entities cannot relate to each other.
o D) Both A and B

22
Q

What is the purpose of normalization in the context of relational databases?

o A) To optimize query performance
o B) To eliminate redundancy and ensure data integrity
o C) To create backup copies of the database
o D) To enforce constraints on attributes

A

To eliminate redundancy and ensure data integrity

23
Q

What does it mean when a foreign key is said to have “cascading updates”?

o A) Changes to the primary key are automatically reflected in the foreign key.
o B) All foreign keys in the database are updated.
o C) The foreign key can only be updated manually.
o D) None of the above

A

Changes to the primary key are automatically reflected in the foreign key.

24
Q

Which of the following constraints can be used to enforce a business rule, such as “age must be greater than 18”?

o A) PRIMARY KEY
o B) UNIQUE
o C) CHECK
o D) FOREIGN KEY

25
What happens if a column defined as UNIQUE is attempted to be populated with duplicate values? ## Footnote o A) The duplicates are removed automatically. o B) An error occurs, and the insert/update is rejected. o C) The operation is successful. o D) The duplicates are stored as null values.
An error occurs, and the insert/update is rejected.
26
What does the term "functional dependency" refer to in the context of relational databases? ## Footnote o A) A relationship between two tables o B) A constraint that defines how attributes relate to one another o C) The process of normalizing a database o D) A method for defining primary keys
A constraint that defines how attributes relate to one another
27
What is the effect of applying a unique constraint to a column in a table? ## Footnote o A) It allows null values, but no duplicates. o B) It prevents all values from being null. o C) It ensures that all values in the column are different. o D) It creates a primary key.
It ensures that all values in the column are different.
28
What is a transitive dependency in the context of relational databases? ## Footnote o A) A dependency between primary and foreign keys o B) A dependency between non-key attributes and primary keys o C) A dependency where one attribute depends on another attribute indirectly o D) A dependency that can be enforced by constraints
A dependency where one attribute depends on another attribute indirectly
29
What happens when a primary key is defined on a table? ## Footnote o A) The table can have multiple primary keys. o B) The table cannot contain null values in the primary key column. o C) The primary key can be updated freely. o D) The primary key can be duplicated.
The table cannot contain null values in the primary key column.
30
In a relational database, what is the significance of defining a default value for a column? ## Footnote o A) It prevents null values. o B) It allows for easier inserts when no value is provided. o C) It enforces uniqueness on the column. o D) It creates a foreign key relationship.
It allows for easier inserts when no value is provided.