Databases Flashcards

1
Q

Flat file DB

A

One single table contains all the information.

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

Relational DB

A

Several linked tables, each representing an entity in the system. Each piece of data stored only once and then looked up via links from other tables. Tables and relationships between them are managed by a DBMS (DataBase Management System).

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

Relational (v.s. Flat File)

A

Avoids data redundancy (storing same data item in more than one place) and inconsistency (two versions may be different).

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

Advantages of ff

A

Simple to construct.

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

Disadvantages of ff

A

Tedious duplicate entry of data, data redundancy, inconsistency, less integrity, hard sharing data, less control over user access

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

Advantages of relational

A

Reduced data duplication and data redundancy. Improves data consistency, data integrity and security. Control access to data.

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

Disadvantages of relational

A

More complex to set up than flat file. Need a good DBMS to ensure users only see the data relevant to them.

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

Entity

A

A thing about which data is stored e.g. customer, employee, stock).

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

Relationship

A

A link between two entities (1-1, 1-many…).

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

Normalisation

A

Resolves many to many relationships and ensures data is stored in one place and in the best place.

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

1NF

A

First Normal Form requires that there be no multivalued / repeating attributes.

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

2NF

A

Second Normal Form requires that any non-key attribute be dependent on the entire key.

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

3NF

A

The rule of Third Normal Form (3NF) states that no non-key attribute can be dependent on another non-key attribute.

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

Showing table design

A

CAPITAL letters for the name of the table, Underline the key field, Overline the foreign keys.
e.g. PATIENTS (-PatientID-, Surname, Forename, Disease, WardID ).

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

Primary key

A

A unique identifier in a table. Can consist of one or more fields. If more than one field it is known as a composite primary key.

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

Composite key

A

2 or more attributes that uniquely identify an entity occurrence.

17
Q

Secondary key

A

An attribute which can be used to search for information or allows records to be sorted (accessed in a different order).
Secondary keys are indexed which allows for fast searching of the data in a database.

18
Q

Foreign key

A

Is a primary key from one table used as an attribute in another to link the tables. They represent many to one relationships.

19
Q

DBMS

A

SW handling the complexities of managing a database. May provide a user interface and use SQL to communicate with other programs. It provides different views of the data for different users.

20
Q

Tasks performed by DBMS

A

Finds data, adds new data, updates data, maintains indexes, enforces data integrity rule, manages access rights.

21
Q

DBMS Access rights

A

Controls what data each user is allowed to see. Also controls what they are allowed to do with the data (view, update etc).

22
Q

Database schema

A

Is the structure of the database that defines the objects in the database.

23
Q

Data dictionary

A

A file containing descriptions of data in a database, used by database managers when altering database structure, uses metadata to define the tables.

24
Q

Data dictionary - examples

A

Names of tables, characteristics (length, data type…), restrictions of values in columns, meaning of data columns, relationships between data, which programs can access the data. Identifies: primary and foreign keys, indexes and defines access rights.

25
Q

Data Description Language

A

DDL - is used to create the database, the tables, the users, their access rights, alter a table (e.g. define a foreign key).
It records the attributes, data types, validation used and the relationship between entities, creates users grants access rights.

26
Q

DDL SQL Commands

A

CREATE DATABASE, CREATE TABLE, CREATE USER, GRANT, ALTER TABLE, ALTER TABLE_ ADD CONSTRAINT_…FOREIGN KEY, DROP.

27
Q

SQL DROP

A

Destroys an existing database, table, index, or view.

28
Q

Data Manipulation Lang.

A

DML - is used to query, sort, add data to the database and manipulate the data in it (update and delete).

29
Q

DML SQL Commands

A

SELECT, SELECT…FROM…ORDER BY, INSERT INTO, UPDATE, DELETE.

30
Q

SQL – CREATE

A

CREATE TABLE tablename (column_name data_type attributes…,column_name data_type attributes…,… )

31
Q

SQL – INSERT

A

INSERT INTO tablename (column_name,…) VALUES (value,…)

32
Q

SQL – SELECT

A

SELECT column,… FROM table,… WHERE condition GROUP BY group_by_expression HAVING condition ORDER BY order_exp

33
Q

SQL – DELETE

A

DELETE FROM table WHERE condition

34
Q

SQL – UPDATE

A

UPDATE table SET column=expression WHERE condition

35
Q

SQL – DROP

A

DROP TABLE tablename

36
Q

SQL – Views

A

You can use “CREATE VIEW” to create a virtual table from a SELECT statement. E.g.
CREATE VIEW contactview AS (SELECT name,phone,zip FROM people,phonenumbers,address WHERE people.id=phonenumbers.id AND people.addressid=address.addressid)

37
Q

Reports

A

Are presentation of selected data usually in the form of a table. It may be defined in advance so the user does not need to set it up. Features of a report definition include: a query and a display order.