Chapter 3.2 Flashcards

1
Q

What does an Integrity Constraint (IC) refer to in a database?

A

A condition that must be true for any instance of the database, such as domain constraints.

ICs are specified when the schema is defined and checked when relations are modified.

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

What is a legal instance of a relation?

A

An instance that satisfies all specified Integrity Constraints (ICs).

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

What is the role of a Database Management System (DBMS) regarding illegal instances?

A

The DBMS should not allow illegal instances.

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

What is a primary key?

A

A set of fields that uniquely identifies a tuple in a relation, ensuring no two distinct tuples can have the same values in all key fields.

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

What is the difference between a candidate key and a superkey?

A

A candidate key is a minimal superkey; no subset of the candidate key can uniquely identify a tuple.

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

Fill in the blank: A set of fields in one relation that refers to a tuple in another relation is called a ______.

A

[foreign key]

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

What is referential integrity?

A

A condition achieved when all foreign key constraints are enforced, preventing dangling references.

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

What happens if an Enrolled tuple with a non-existent student ID is inserted?

A

It is rejected.

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

What is the default action for foreign key constraints on deletes and updates in SQL?

A

NO ACTION (delete/update is rejected).

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

What does the CASCADE option do in foreign key constraints?

A

It deletes all tuples that refer to the deleted tuple.

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

What is a weak entity?

A

An entity that can only be identified uniquely by considering the primary key of another (owner) entity.

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

What is the significance of total participation in a weak entity set?

A

It means that every weak entity must be associated with an owner entity.

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

True or False: A weak entity set must have total participation in its identifying relationship set.

A

True.

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

What is the purpose of a view in a database?

A

A view stores a definition rather than a set of tuples, allowing for virtual tables.

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

What is the primary key in the Enrolled table example?

A

PRIMARY KEY (sid, cid).

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

Fill in the blank: When a student’s tuple is deleted, the corresponding Enrolled tuples can either be ______ or ______.

A

[deleted, set to a default value]

17
Q

What is an ISA hierarchy in databases?

A

A relationship where one entity set is a subclass of another, allowing for inheritance of attributes.

18
Q

What are participation constraints?

A

Constraints that specify whether all or only some entities in a set must participate in a relationship.

19
Q

What does the ON DELETE CASCADE option do?

A

It ensures that when a referenced row is deleted, all rows referencing it are also deleted.

20
Q

What is the purpose of specifying foreign key constraints in SQL?

A

To enforce referential integrity between tables.

21
Q

What is a primary key constraint?

A

A constraint that uniquely identifies each record in a table.

22
Q

How can aggregate relationships be represented in a database?

A

By creating a relation that includes keys from the participating entities and any descriptive attributes.

23
Q

What is a view in the context of database management?

A

A view is like a relation, but we store a definition, rather than a set of tuples.

Views can be used to simplify complex queries or to provide a specific subset of data.

24
Q

How is a view created in SQL?

A

CREATE VIEW view_name AS SELECT columns FROM table WHERE condition;

Example: CREATE VIEW YoungActiveStudents (name, age) AS SELECT S.name, S.age FROM Students S, Enrolled E WHERE S.sid = E.sid and S.age<21.

25
Q

What command is used to remove a view from the database?

A

DROP VIEW command.

This command allows users to delete a view from the database.

26
Q

What happens to a table if there is a view associated with it when using the DROP TABLE command?

A

DROP TABLE command has options to let the user specify how to handle views associated with the table.

Users can choose to drop the view along with the table or keep it.

27
Q

How can views be used in terms of security?

A

Views can present necessary information while hiding details in underlying relations.

For example, a view can show enrolled students without revealing course IDs.

28
Q

What is an updatable view?

A

An updatable view allows data modification through the view.

Example: CREATE VIEW GoodStudents1 (sid, gpa) AS SELECT S.sid, S.gpa FROM Students S WHERE S.gpa > 3.0.

29
Q

What is the relational model?

A

A tabular representation of data.

It is simple, intuitive, and the most widely used model in database systems.

30
Q

What types of integrity constraints can be specified in the relational model?

A

Primary keys, foreign keys, and domain constraints.

These constraints ensure data integrity and adherence to business rules.

31
Q

What is the role of the DBA regarding integrity constraints?

A

The DBA specifies integrity constraints based on application semantics, and the DBMS checks for violations.

This helps maintain the accuracy and reliability of the data.

32
Q

Fill in the blank: A powerful and natural query language exists for the relational model, which allows for _______.

A

expressive data retrieval.

SQL is the most common query language used with relational databases.

33
Q

True or False: Views can be used to hide sensitive data while still providing necessary information.

A

True.

This is a common practice in database security.