Relationships, Basic Terms and Keys! Flashcards

1
Q

Describe each of these words and give an example.

  • Entities
  • Attributes
  • Relationships
  • Constraints
  • Relation
A

Entities: Real things which are added to a database.
Examples: People, places, events, etc.

Attributes: Individual Items of data associated with an entity.
Examples: Name, Age, National insurance number, etc.

Relationships: Ways in which entities are connected.
Examples: A is apart of B, A lives in B, etc.

Constraints: Rules which limit data.
Examples: Every A must have a B, only A’s greater than 7, etc.

Relations: Just a table except it allows for duplicate data.
Examples: A students table.

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

What is a domain?
Give an example.

What is a degree?
Give an example.

What is cardinality?
What is optionality?

A

A domain is a set data type essentially. For example, all integers must be whole numbers, all dates in a certain format, etc. It holds all the possible answers that the user can enter.

Degree: this refers to the number of columns used to link tables through primary and foreign keys.

Cardinality: This refers to the maximum number of entities that can participate in a relationship. (The maximum number of fields which can be linked with the foreign keys. Think Multiplicity in a entity relationship diagram.

Optionality: Is the same but refers to the minimum amount as opposed to the maximum.

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

What is entity integrity?

A

This is a system which ensures that data entered can not be a duplicate or be left null. It’s used to prevent any bad data entering.

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

What is a Primary Key?

What is a foreign key?

And what are parent tables and child tables?

A

Primary Key is a unique column which does not hold any duplicates, so it should be given to a column which uniquely identifies the rest of a records info. For example, Customer ID would get it, as this column is a unique version of the Customer name column. Make sense? The table which holds the primary key is called the parent table.

Foreign keys are references to another primary key in another table. These can hold nulls and duplicates. The tables which hold a foreign key is known as a child table.

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

What is multiplicity? Describe this entity relationship diagram I’ve attempted to recreate.

Driver Table- 1..1——0..* -Hire agreement-0..*——0..1-Vehicle

And how does Cardinality and Optionality play into this?

A

It’s used to reflect how many of each thing a table can take from another… look:

Driver Table- 1..1——0..* -Hire agreement-0..*——0..1-Vehicle

Pretend that’s a entity relationship diagram right.

Basically it’s saying 1 and only 1 driver can take out anywhere from 0 to infinite hire agreements, and that the 0 to infinite hire agreements can each only take out 0 to 1 vehicles for rent.

Cardinality is refers to the part which says “the max amount is…” while OPTIONALITY refers to the “least amount”. :D

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

What is DBMS and what does it prevent?

A

DBMS refers to database management system, and is used to create and manage databases.

It can prevent detrimental actions to the database, such as deleting a parent record while child records still exist.

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