S10 - Relational Databases

0.0(0)
studied byStudied by 11 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/34

flashcard set

Earn XP

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

35 Terms

1
New cards

First Normal Form

Data must be atomic for each attribute in a record

2
New cards

Second Normal Form

Data must be atomic, every non key attribute must be depended on the whole of the primary key (single primary key tables that are in 1NF are automatically in 2NF)

3
New cards

Third Normal Form

Data must be atomic, every non-key attribute must be dependent on the whole of the primary key and non-key attributes are functionally independent

4
New cards

Why are databases normalised?

To minimise data duplication, eliminate update, insertion, and deletion anomalies, eliminate data inconsistency

5
New cards

Databases

Structured way of storing, managing and retrieving data/information

6
New cards

‘Flat file’ databases

One long text/csv file, has data redundancies and inconsistencies

7
New cards

Entity

Category of objects about which data will be stored

8
New cards

Attribute

Characteristic about an entity, which would be stored as a field

9
New cards

Record

All characteristics of a specific object. They are the rows in a table

10
New cards

Primary key

Must be a unique characteristic for that specific record, is a unique identifier for a record

11
New cards

Composite Key

When the primary key of a relation is made of two or more attributes

12
New cards

Foreign Key

Attribute that links two tables. When two tables are in a one-to-many relationship, that relationship is modelled with an attribute

13
New cards

select specifics (SQL)

SELECT…FROM…WHERE…ORDER BY…

14
New cards

select and group (SQL)

SELECT…FROM…GROUP BY…

15
New cards

Data Definition Language (DDL)

Defines how the data is stored, organised and managed in the database

16
New cards

Data Manipulation Language (DML)

Manipulates the data, updates/changes it, selects subsets

17
New cards

CHAR(n)

Char string of fixed length n

18
New cards

VARCHAR(n)

Character string variable length max n

19
New cards

BOOLEAN

TRUE or FALSE

20
New cards

INTEGER, INT

Integer

21
New cards

FLOAT

Number with a floating decimal point

22
New cards

DATE

Stores Day, Month, Year values

23
New cards

TIME

Stores Hour, Minute, Second

24
New cards

MONEY, SMALLMONEY

Formats numbers in the currency used in your region. MONEY uses 8 bytes, SMALLMONEY uses 4 bytes

25
New cards

Deleting a column

ALTER TABLE...DROP…

26
New cards

Changing data type of a column

ALTER TABLE…MODIFY COLUMN…(VARCHAR(n))NOT NULL

27
New cards

Inserting a new record

INSERT INTO…VALUES…

28
New cards

Updating data

UPDATE…SET…WHERE…

29
New cards

Deleting a record

DELETE FROM…WHERE…

30
New cards

Client-Server Databases

Multiple users need to be able to access the database and use it

31
New cards

Concurrent Access

When multiple users try to access the database at the same time

32
New cards

Record Locks

When a user starts to access a record, an exclusive lock is set on the record. Other users can’t edit the records until the lock is released (when the first transaction is completed)

33
New cards

Serialiation

Transactions are allowed to take place one at a time in serial format. Process is managed by DBMS. Ensures each transaction is carried out in the correct sequence to avoid compromising the integrity of data.

34
New cards

Timestamp Ordering

  • Timestamps are generated for each transaction, indicates the order that transaction occurs in

  • Database records timestamp of the last read/write transaction for each record

  • Database server applies rules to determine if processing a transaction will result in loss of data integrity/inconsistency

    • if a transaction tries to write to a record then the transaction should be aborted if the read/write timestamp on the record is greater than the timestamp at which the transaction has started

35
New cards

Commitment Ordering

Look at each command it has been asked to execute on the database in terms of when it was made and also in terms of whether it should take precedence over other commands. Depends on nature of the command and the impact it has on the database