Lecture 2 Flashcards

1
Q

Relational DBMS

A

Most DBMS are networked and multi-user, therefore:

  • Concurrent writes to files
  • Network interruptions
  • Database downtime while users are connected
  • Requesting changing data
  • Managing computational resources
  • Authentication and authorisation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ACID

A

An important property of a multi-user DBMS.

  • Atomic: Transactions are all or nothing.
  • Consistent: Only valid data is saved
  • Isolated: Simultaneous transactions are independently performed
  • Durable: Transactions are never lost
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A transaction

A

A unit of work that is executed as a single entity.

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

Relational approach to a database (Reminder)

A

Organises data into rows and columns, which collectively from a table. Data is structured across multiple tables, which can be joined with the use of primary and foreign keys.

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

Entity

A

Something of interest to the use of the database. e.g Customer, Student, Geolocation

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

Cell

A

An individual piece of data stored in a table.

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

Field

A

A property of an entity. (column of a table)

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

Row / Record

A

An instance of an entity, a collection of cells representing an individual entity.

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

Result-set

A

A non-persistent table, the result of a query (What you’ll be working with in code)

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

Primary Key

A

One or more columns that together can be used as a unique identifier for each row in a table.

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

Foreign Key

A

One or more columns that together are used to identify a record in another table.

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

Relation integrity constraints (3 constraints)

A
  1. Domain constraints
  2. Key constraints
  3. Referential Integrity Constraints
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Domain constraints for Relational Models

A

Domain constraints can be violated if an attribute value is not appearing in the corresponding domain or it is not of the appropriate data type.

  • Constraints on whether a cell can be NULL
  • Constraints on the data type records
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Key constraints for Relational Models

A

Primary key attributes must be unique for different records in the relation.

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

Primary Key

A
  • Highly stable, unique identifier.
  • Cannot have null attributes.

Altering a table:
ALTER TABLE us_states ADD PRIMARY KEY (state_code);

Creating a table:
CREATE TABLE us_states (
InvoiceNo int NOT NULL,
CustomerID int NOT NULL,
Amount int,
PRIMARY KEY (InvoiceNO)
);

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

Candidate Key

A
  • Unique identifier fields, are columns in the table where their values are unique and can be assigned as primary key.
  • Can never be null or empty. And its value should be unique.
  • Minimal super key.
17
Q

Super Key

A

Consists of candidate keys attributes + extra attributes

18
Q

Foreign Key

A

Foreign key constraints reference to keys in other tables, consternating the values of the table.

Denotes a strict relation between two entities.

ALTER TABLE Voters
ADD FOREIGN KEY (State_Voter_Registration)
REFERENCES US_States(State_code);

19
Q

Simple and Composite Keys

A

If a key, let’s say the PK has more than one field, it is a composite key.

If it only refers to one field, it is a simple key.

20
Q

Defining behaviour on FK’s:

A

We can define a behaviour when a certain field is deleted.

  • Restrict DELETION
  • UPDATE all linked records, CASCADE
  • SET NULL value
  • NO ACTION
  • SET DEFAULT value

e.g:
REFERENCES teachers(ID) ON DELETE RESTRICT ON UPDATE CASCADE,

20
Q

Defining behaviour on FK’s:

A

We can define a behaviour when a certain field is deleted.

  • Restrict DELETION
  • UPDATE all linked records, CASCADE
  • SET NULL value
  • NO ACTION
  • SET DEFAULT value

e.g:
REFERENCES teachers(ID) ON DELETE RESTRICT ON UPDATE CASCADE,

21
Q

Entity Relationship Model

A

ER is a way to organise the description of entities and the relationships between them.

  • Entities, all with characteristic attributes.
  • For each kind of entity there are instances that combine to an entity set.
  • A key as a minimal set of attributes to identify and distinguish entity instances.
  • Relationships between entities.
22
Q

Entity Relationship Model entities:

A

one-to-one: Each A may relate to one B
many-to-one: Several A may relate to one B
one-to-many: Each A may relate to several B
many-to-many: Any number of A can relate to any number of B.

23
Q

ER diagrams:

A

Entity - rectangle
Relationship - diamond
Attribute - circle
Key attribute - circle with line

Chen notation: entities are on top of the lines within relationships

24
Q

ER Schema

A

Practice