Databases and SQL Flashcards

1
Q

What is a data model?

A

An abstract description of the essential data within a given context and how data is related.

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

What is an entity?

A

A distinct thing about which data must be stored.

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

What is an attribute?

A

A single property or piece of information of an entity.

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

What is data modelling?

A

The process of producing an abstract model that represents the organisation and structure of the data

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

What problems exist in a flat-file database?

A

1) Data redundancy
2) Data inconsistency

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

What is an entity identifier?

A

An attribute or combination of attributes that uniquely identify each instance of an entity.

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

How is information from a flat-file database represented?

A

A single table with columns for each attribute and each row representing a new instance of each entity.

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

What is a composite key?

A

Multiple attributes are combined to form the table’s entity identifier

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

What information is stored in a entity description?

A

Entity name, primary key and attributes
(entity is always singular)

EntityName( PrimaryKey , Attribute1)
- primary key must be underlined

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

How to create a table in SQL?

A

CREATE TABLE table_name (
primaryAttribute DATATYPE PRIMARY KEY,
attribute2 DATATYPE CHECK (….)
);
- remember that you can write NOT NULL, DEFAULT constraints

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

What is an entity-relationship diagram used for?

A

E-R diagrams are used to graphically represent the relationships between tables in a database

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

How can we tell from an entity description what the E-R diagram looks like?

A

The table which contains a foreign key of the other table holds the “many” side of the relationships.

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

Understanding E-R relationships

A
  1. One-to-many: one tutor, many students (and each student has one tutor)
  2. Many-to-many: one teacher, many pupils - one student, many teachers
  3. One-to-one: one school, one headteacher
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly