Relational Algebra Flashcards

1
Q

What is an information system?

A

An information system is a set of interrelated components that collect, manipulate, store and disseminate data and information and provide a feedback mechanism to meet an objective.

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

Explain the five components of an information system.

A

Collect - gather and capture raw data
Manipulate - covert or transform data into useful information.
Store - Keep data and information available for future use.
Disseminate - Produce useful information
Feedback - Is information from the system that is used to make changes to the collection or manipulation of data.

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

Distinguish between information and data?

A

Data consists of raw facts.
Information is a collection of facts organised so that they have additional value.

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

What do the following stand for?
IS
DB
DBMS

A

Information Systems
Database
Database Management System

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

What is a DB?

A

A DB is a collection of logically related data of interest to the IS.

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

What is DBMS?

A

Is a software package used to define, create, use and maintain a database.

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

What is a database system?

A

The combination of a DBMS and a DB.

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

What should a DBMS be able to manage (3) and how should it do it (2)?

A

Large datasets
Shared datasets (multiple users)
Persistent datasets (data lasts beyond program execution)

Reliably
With privacy
With Efficiency (using the appropriate amount of resources) & Effectively (supporting the productivity of its users)

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

How is inconsistency in data avoided in relation to DBMS?

A

Integration of dataset and sharing allows a reduction of redundancy and the consequent possibility of inconsistency.

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

What is the principle of concurrency in relation to DBMS?

A

Concurrency involves facilitating multiple accesses that can be simultaneous to data which is suitably organised for this purpose.

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

What is a Database approach?

A

A database approach is a method of implementing DBMS, which has an integrated resource for multiple departments, avoids inconsistency and allows concurrency.

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

What is a file-based approach?

A

Every application program/department stores its data in its dedicated files. Duplicated or redundant information is stored. Inconsistency between departments, lack of concurrency.

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

Why is database approach superior to file-based approach?

A

Database approach has efficiency, consistency and concurrency. Loose coupling between applications and data makes DBMS much easier to maintain. Data format can be changed without having to massively alter application program and vica-versa.

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

List the four elements of a database system.

A

Data model
Database schemas versus instances
Database languages
Database users

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

What is a data model?

A

A data model is a set of concepts and constructs used to describe and organise data items, their characteristics and relationships. There are two types conceptual and logical model.

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

Distinguish between conceptual and logical model.

A

Conceptual:
- Early stages
- Abstract description of data items, characteristics and relationships.
- Independent of implementation environment.
- Entity-Relationship Model (ER)

Logical:
- Late stages
- Translates concept into specific implementation environment.
- Specific to implementation environment but abstracts from physical structures.
- Relational Model (R)

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

Give an example of feedback in an information system.

A

A payroll system will trigger an error if an employee in a grocery store is being paid 200 euro an hour, so the model can be changed as this is obviously incorrect.

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

Explain the difference between database schema and database instance.

A

Database Schema: Description of the data including data items, characteristics, relationships, constraints. Invariant in time.

Database Instance: Made up of actual data. Changes with time.

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

Define the two types of database languages.

A

Data definition language (DDL): used to define database schemas and access authorisations.
Data manipulation language (DML): used to retrieve and update database instances.

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

Name five types of database users.

A

-Information Architects
-Database Designers
-Database Administrators
-Application Developers
-Business Users

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

What is the relational model?

A

A logical model where a DB is represented as a collection of relations.

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

What is the set of attributes of a relation called?

A

Schema

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

What is a relation?

A

A relation is a set of tuples, each of which represents a real-world entity.

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

What are tuples? What is true of all tuples in a relation.

A

A tuple is an ordered list of attribute values describing aspects of the entity. All tuples in a relation are homogeneous (same type).

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

In a relation represented as a table what do the table, rows, datatype, columns and set of attributes correspond to in the relational model.

A

Table = Relation
Row = tuple
Datatype = domain
Column = Attribute (Name)
Set of Attributes = Database Schema

26
Q

What is a database schema?

A

Contains multiple schemas from its relations (tables)

27
Q

Differentiate between the degree and the cardinality of a relation.

A

The degree of a relation is the number of attributes (columns) of that relation.
The cardinality of a relation is the number of tuples (rows) contained in the relation.

28
Q

There is a relation R with attributes A1, A2 … Ak define the schema and a generic tuple. Find the value of Attribute Ai for tuple t.

A

Schema = R(A1, A1 , … , Ak)
t = (v1, v2, …, vk)
To find value t[Ai]

29
Q

What is null value?

A

A special value which denotes an absence of information

30
Q

What is the key of a relation?

A

Is the set of attributes that uniquely identifies tuples of the relation.

31
Q

Define key of a relation more formally.

A

A set X of attributes of a relation R is a key of R if
- for each instance of R, no pair of distinct tuples t’ and t’’ exist in R such that t’ and t’’ have same value for all attributes in X.
- no proper subset of X satisfies property.

32
Q

List the two key conditions.

A

A key cannot have null values
A relation may have more than one key.

33
Q

What is a primary key?

A

The selected key used to identify tuples in the relation. Can only be one.

34
Q

What is a foreign key?

A

Links tuples of two different relations and provides a mechanism to model associations between entities in the relations.

R = internal relation
S = external relation
X = set of attributes of R
Y = set of attributes that is key of S

Y is the foreign key of R on S if Y is a subset of X.

35
Q

Which way does a foreign key always point.

A

To the external relation’s key. Has to be key.

36
Q

Give another name for external relation.

A

Referenced.

37
Q

What is relational algebra?

A

Is a formal procedural language that provides the theoretical foundation of relational databases.

38
Q

What is a procedural language?

A

Data retrieval functions are specified by describing the procedure that must be followed to obtain the result.

39
Q

Explain the closure property in relational algebra.

A

Application of an operator always produces a relation as the result.

40
Q

Define union-compatibility.

A

P and Q have the same degree.
Corresponding attributes of P and Q are based on the same domain.

41
Q

Which attribute name is taken by convention?

A

The first relation’s name is always taken first by convention.

42
Q

T or F. The degree of R U Q is the same as the degree of R and the degree of Q.

A

True.

43
Q

T or F. The degree of P / Q is the same as the degree of P and the degree of Q

A

True

44
Q

T or F, For P X Q, P and Q must be union compatible.

A

False

45
Q

What is the degree of P x Q?

A

d(P) + d(Q)

46
Q

What condition applies to cartesian product?

A

For P x Q, if P and Q have attributes with the same name, it is necessary to rename those attributes in one of the two relations.

47
Q

What is projection? And informally? And another name?

A

Relation of tuples who only have specified attributes.

Getting rid of some columns

Vertical decomposition

48
Q

What is selection? And informally? And another name?

A

Relation containing all tuples in P that satisfy some predicate

Getting rid of some rows

Horizontal decomposition

49
Q

Name one condition of the renaming operator.

A

New attribute names must be unique

50
Q

T or F. Union, difference and intersection all require union compatible relations.

A

True.

51
Q

What is the join operator?

A

The join operator allows combining tuples of two relations P and Q base d on specific conditions. The result of a join is a combined effect of a Cartesian product followed by a selection.

52
Q

Distinguish between natural join and standard join.

A

In standard join, the related columns are joined together but are included twice with different names. In natural join, two identically named attributes are shown as one column in the resulting table so all values must match.

53
Q

T or F. Relational Algebra is a declarative language.

A

False.

54
Q

T or F. It is NOT possible to apply the relational algebra operation intersection between two relations that have different cardinality.

A

False

55
Q

T or F. The key of a relation can be composed of more than one attribute.

A

True

56
Q

T or F. The degree of a relation is the number of attributes in the relation.

A

True

57
Q

What is the referential integrity constraint in relation to foreign keys?

A

Referential integrity constraint: foreign key guarantees that values in internal relation refer to actual values in internal relation. Cannot insert rows in table where foreign key is not defined with the given value.

58
Q

Distinguish between Relational Algebra and Sql?

A

RA:
- Formal
- Procedural
- DML

SQL:
- practical, implemented, commercial
- declarative (primarily)
- DDL + DML

59
Q

Syntax when projecting two attributes.

A

pi x , y ()

60
Q

When undertaking a natural join where names are not identical for the columns being overwritten what must be specified beneath the natural join symbol?

A

column_name_a = column_name_b