L03 - Databases Flashcards

1
Q

Data Organization

A

The data tier comprises elements which provide persistent storage of data and reading and writing access to this data. Within computer systems, data can be organized in a hierarchical way.

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

Data File Approach

A

It stores data in the computer´s file system. Often, information-systems are not planned inter-divisional. In many cases those systems were planned separately from each other and sharing of data was not considered. That lead to redundant data and the organization of data was tailored to the division-specific applications. (Framework Slide 9).

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

Problems with Traditional Data Processing

A

Redundancy:
- Multiple copies of a date in different data files.

Inconsistency:
- Different values are saved for one attribute.

Dependencies between application and data:
- Data in files and software for data processing and management are strongly connected. A change in program code requires change in data structure.

No exchange of data/ lack of flexibility:
- Data in files are inflexible with respect to evaluations and relationships. Concurrent access to multiple attributes and choice of desired data element requires expensive searching and sorting procedures.

No data security:
- As data is saved in different at location access to data and their modification cannot be controlled.

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

Database Systems as the solution

A

Database Systems can solve many of the problems resulting from the traditional “file approach”. It contains the Database and Database Management System (DBMS). (e.g. HR or paying employees).

A database is a structured collection of data records. It stores data in a way that a computer program may query the database. The returned data is the answer to the query and the extracted data is said to be information.

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

Database Schema

A

Every database needs a structural description of the objects which are represented in the database and their characteristics and the relationship between these facts. The schema of the database is a structural description of a database. The data model is used to organize the schema of the database. The choice of a specific model determines the kind of database (e.g. hierarchical, object-oriented, relational, graph-based, document).

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

Relational Databases

A

Data is stored as tables. A table is a set of data elements (values) which are organized in rows and columns. Every column is identified by a name and every row is identified by several values composing a data record.

The entity type is specified by a set of attributes (defined by the column names). The specific entity is characterized by the attribute values. Every table in a database should have a column with values which uniquely identify the different data records. Single data records can be retrieved, updated and sorted.

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

Primary Keys

A

e.g. matriculation number, number of identity card. If no natural primary key is given, the use of consecutive numbers is common.

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

Foreign Key

A

A set of attributes in one table that uniquely identifies a row of another table.

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

Database Management Systems

A

DBMS is a collection of programs which enable the central efficient management of data. It is the interface between application program and physical data files. The DBMS separates the physical data (How is data structured and organized on physical storage media) structure from the logical structure (How is data represented to the user).

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

SQL (Structured Query Language)

A

SQL is the most popular computer language for relational databases. It is the industry standard.

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

Database Management System Components

A

A DBMS offers several components for the creation, manipulation and evaluation of data in a database:

  1. DDL (Data Definition Language):
    - provides means to define the schema of a database (logical view)
  2. DML (Data Manipulation Language):
    - is used to process the data in the database and offers constructs to the user/ programmer to retrieve, insert, delete and update data in the database
  3. DCL (Data Control Language):
    - allows to control the access to data in the database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

DDL

A

A data definition language (DDL) is a syntax similar to a computer programming language for defining data structures, especially database schemas (Statement: CREATE, ALTER, DROP).

What happens now with the foreign key in the course table, when we UPDATE or DELETE a row in the room table? (example for two connected table course -> room) (Slide 27). When we UPDATE/ DELETE a row in the room table, the foreign key in the course is:

  • NO ACTION: The update/deletion is not allowed. The operation is rolled back.
  • CASCADE: The foreign key is updated in the course table as well (for update) or the whole row in the course table is deleted as well (for delete).
  • SET NULL: The foreign key in the course table is set to null.
  • SET DEFAULT: The foreign key in the course table is set to a default value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

DML

A

A data manipulation language (DL) is a family of syntax elements similar to a computer programming language used for inserting, deleting and updating data in a database. Performing read-only queries (e.g. SELECT) of data is sometimes also considered a component of DML. (Statement: INSERT, SELECT, UPDATE, DELETE)

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

Advantages of Using a DBMS

A
  1. Redundancy and inconsistency control
  2. Independence between application and data
  3. Provides a transaction mechanism
  4. Allows and manages the data access of multiple users
  5. Manages and enforces the access rights to data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Redundancy and Inconsistency Control

A

A specific entity should be stored once and be uniquely identified by the primary key. Additional information should be stored in a extra table and should be accessed via foreign key. The DBMS provides means to propagate changes to referencing elements in database.

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

Data – Application Independence

A

Applications do not access or manipulate data. Data is exclusively managed by the DBMS.

17
Q

Transactions

A

Besides atomic database operations (simple read and write) a DBMS also allows transactions. A transaction is a group of atomic operations which is executed as a single unit without interference by other database operations. Either the entire group of operations is executed or not a single operation at all (e.g. Credit transfer Slide 36).

18
Q

Rollbacks

A

If a transaction is executed every single operation of the transaction has to be performed and the resulting database has to be consistent (e.g. overdrawn account is not allowed). If one of the two cases do not apply, the entire transaction has to rolled back.

19
Q

ACID – Paradigm

A
  • Atomicity: A transaction has to be treated as the smallest, non-dividable unit. Either all operations are executed or no operation at all.
  • Consistency: The state of the database may be inconsistent while processing the transaction, but the completion of a transaction must result in a consistent database state.
  • Isolation: Different transactions which are executed in parallel must not interfere with each other. The intermediate results of a transaction are not visible to any other transaction and the transaction has to be processed as if it was the only transaction executed on the database.
  • Durability: The effects of a successful transaction on a database are persistent.
20
Q

Multiple Users

A

If date is organized on a central unit, data access has to coordinated. Multiple users may perform database operations at the same time (concurrent modification). However, restricting the use of a database to single user at a time would waste resources

21
Q

Problem Lost Update

A

Two tickets transactions are pursued at the time (selling 2 and 3 from 20) at the end the database gives out that 18/17 tickets are left.

22
Q

Problem Dirty Read

A

T1 reads from an inconsistent state. When Query 2 is rolled-back because of any issue in the database (or the change has turned out to be incorrect) Query 3 reads the (incorrectly) updated age.

23
Q

Problem Phantom Read

A

In between two transactions a second party changes the list, so the same query delivers different results.

24
Q

Multi User Synchronization

A

Serializability:
- Controlled, concurrent, interleaving execution of a set of transactions. The transactions appear to be performed in isolation

Locking:
- The data which needs to be accessed is locked for a particular transaction and unlocked if the transactions has been successfully executed (while data is locked it cannot be accessed by another transactions)

25
Q

Creating an Entity-Relationship (ER) Modell

A
  • Entity: A model of a concept that exists in the real world
  • Relation: An association among entities
  • Attribute: A property of an entity or of a relationship
  • Primary Key: Minimal set of uniquely identifying attributes of an entity
  • Cardinalities: One-to-one, One-to-many, Many-to-many