Week 2 Flashcards

1
Q

What is a relationship made up of

A
  1. Instance: a table with rows and columns.
    #Rows = cardinality, #fields/attributes = degree / arity.
  2. Relation Schema: specifies the relation’s name and type (domain) of each column
    E.G. Students(sid:string, name:string, login: string, age:integer, gpa: real)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the mathematical notation that can be use to represent a relation schema?

A

S(A1,A2, A3,… An) Where S is the schema’s name, A is an attribute.
* E.g. Students(sid:string, name:string, login:string, age:integer, gpa:real).

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

What is the Integrity of data?

A

It is the state of data in which data obeys the constraints set by DBA.

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

What is the Domain constraint?

A

Values in tuples should obey types of attributes.

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

What is the Key constraint?

A

Keys of a relation must be unique, non-redundant, and not Null (entity integrity constant).

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

What is referential integrity?

A

If two relational schemas are related to each other,
1. The relation must be made by using keys
2. The DBMS must preserve this relation.
3. Foreign keys must have the same type and values in the current relation.

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

What is a Foreign key?

A

Set of fields in one relation that is used to ‘refer’ to a tuple/row in another relation. Must correspond to the primary key of the referring relation. Like a ‘logical pointer’.

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

What is the 4 options on deletes and updates in SQL/92

A
  1. Default is NO ACTION (delete/update is rejected)
  2. CASCADE (also delete all tuples that refer to deleted tuple)
  3. SET NULL / SET DEFAULT (sets foreign key value of a referencing tuple)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an Entity integrity constraint in Key constraints?

A

A key value cannot be null

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

What is a superkey?

A

A set of attributes such that its subset is a key for the relation.

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

What is the Relation schema in this relationship? How do we link the relationship in the table? What is the integrity constraint?

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

What is ER-to-Relational Mapping in a 1:1 relationship?

A

For each 1:1 binary relationship in ER schema, identify relations S and T (in relational schema) that correspond to entity types participating in relationship
Choose on of relations for example, S and include primary key of T as foreign key in S

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

What is ER-to-Relational Mapping in a 1:N relationship?

A

For each 1:N binary relationship in ER schema, identify relation S (in relational schema) that represents participating entity at N-side of relationship
Include primary key of relation T as foreign key in S (where T represents entity at 1-side of relationship)
Each entity instance on N-side is related to at most one entity instance on 1-side (primary ke constraint)

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

What is ER-to-Relational Mapping in a M:N relationship?

A

For each M:N binary relationship in ER schema, create new relation R to represent many to many relationship
* Include primary keys of relations that represent participating entity types as foreign key attributes in R
* The combination of primary keys of the two relations representing participating entities will form primary key of R

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