Theory Flashcards

1
Q

Desirable attributes of data

A

Sharable, Transportable, Accurate, Relevant, Timely and Secure

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

Common features of a database

A

Storage medium, structure and rapid data entry & retrieval

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

Problems with data management

A

Redundancy (same data stored in multiple places)
Poor interface (data difficult to access or understand)
Lack of reality (poor model of the real world)
Lack of data integration (data dispersed across different systems)
Delays (waiting to gather data)
Lack of data control (data poorly managed)

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

What is hardness of information?

A

Hardness indicated the accuracy of the data. The softer the data, the more resources the manager needs in order to verify that the information is correct

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

What is the richness of data?

A

Richness is related to the way the data is communicated. If the information gathered comes directly from the source (face-to-face), the data is rich. If it is communicated via another person over email, not so rich

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

Types of information sought by manager during change

A

Goal setting information: information related to external environment changes and use that to set a new goal
Gap information: information showing the gap between where company stands now and goal they want to achieve
Change information: shows what happens when a particular change is made

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

Definition entity

A

An entity is a table in a database

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

Definition instance

A

An instance is a row in a table

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

Definition primary key

A

The primary key is the unique identifier of an entity in a database

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

Definition foreign key

A

The foreign key refers to the primary key in the other table of a relationship.

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

How to create a table

A

CREATE <Table> (

<attribute> datatype
" (how many attributes you have)
PRIMARY KEY (<Name>));
</Name></attribute>

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

Assign values to a table

A

INSERT INTO <Table>(
(<column>, <column>, etc.)
VALUES
(value1, value2, etc.)</column></column>

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

SELECT * FROM <Table name>

A

Shows entire table selected

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

SELECT * FROM <Table name> WHERE <column></column>

A

Shows rows where column condition is met

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

WHERE + AND or OR

A

Where can be combined with AND or OR to allow for multiple conditions on multiple columns

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

ORDER BY

A

Order by can be used to display the data in a specific order. Automatically does so in ascending (ASC) order, but when DESC is typed, it does so in descending order

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

UPDATE <Table name>
SET <Columns> = 'new value'
WHERE <PK> = 'value'</PK></Columns>

A

Used to update existing data points in an entity

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

DELETE

A

Is used to delete an instance in an entity. The PK is used to make sure that only that instance is removed

19
Q

Functions in query statements

A

Functions that can be used are for example COUNT, AVG, SUM, MIN, MAX, etc. These can be used to avoid abundance of data, through calculating a value for a new column using the value of another column

20
Q

REGEXP

A

Can be used to match to a particular string in instances. Combined with:
? Match zero or one instance of the string
^ Match starting at beginning of string
$ Match starting at end of string
[abc] Match any of the enclosed characters

21
Q

Assign FK to table

A

CONSTRAINT <name> FOREIGN KEY (<column>) REFERENCES <primary key table(column primary key)></column></name>

22
Q

Create a view

A

CREATE VIEW <Name> (<columns>) AS SELECT <columns> FROM <original></original></columns></columns></Name>

23
Q

Joining two tables

A

SELECT * FROM <table1, table2> WHERE <column_table1> = <column_table2></column_table2></column_table1>

or

SELECT * FROM <table1> JOIN <table2> ON <column_table1> = <column_table2></column_table2></column_table1></table2></table1>

24
Q

GROUP BY

A

The group by clause allows for grouping of rows that have the same value for a specified column / columns. Can be accompanied by HAVING to select for certain groups to comply to a condition

25
Q

Why use subqueries?

A

Once you run a query, the values are not saved. If you need to use a query’s value in another query, you need to use a subquery

26
Q

IN used in query after WHERE

A

Selects only columns that have the string applied after IN in it’s instance

27
Q

SELECT DISTINCT

A

emits duplicates from SELECT clause

28
Q

m:m relationship creation

A

An associate entity is created which has two 1:m relationship (it is the many side). It has two FK from the original tables. If it’s PK is not unique enough, it has to be strenghted by one of the original table’s PKs.
If PK is strengthed using a strenghted PK from original table, those two or more PKs are included in the new table.

29
Q

Find all type of questions solution

A

Double NOT EXISTS

30
Q

UNION

A

is used to combine the results from two separate queries. Not both queries have to be true for all instances (OR equivalent). Duplicates are excluded

31
Q

INTERSECT

A

Combines the results from two queries where both have to be true (AND equivalent). Duplicates are excluded.

32
Q

How to create a 1:1 recursive relationshiop

A

create a table as usual, define PK, define FK as follows:
CONSTRAINT <name> FOREIGN KEY (<foreign key(s)> in same table) REFERENCES <table name>(<PK>)</PK></name>

33
Q

Well-formed

A

Construction rules are obeyed and no ambiguity present:
- everything is named
- names are meaningful to client
- name entity == PK
- name relationship == FK

34
Q

High fidelity image

A

Faithfully describes the world it is supposed to represent
Relationships are of correct degree
Data model is complete and understandable
Data model makes sense

35
Q

Cardinality and degree

A

Cardinality is the number of rows and degree is the number of columns. Only cardinality should be able to change, since new instances can be added to entities

36
Q

Entity types

A

Independent
Dependent
Associate: created as third entity in m:m relationship
Aggregate: created as supertype or generalization when there are multiple instances that have similar attributes
Subordinate: subtype of another instance (often aggregate)

37
Q

Aggregation of entities

A

Shared aggregation: One entity owns another but can be owned by other entities as well (denoted by open diamond next to entity)
Composition aggregation: One entity exclusively owns the other entity (denoted by closed diamond next to entity)

38
Q

Integrity rules

A

entity integrity rule: no component of the primary key can be null
referential integrity rule: foreign key cannot have a value that is not present in the PK of the relationship

39
Q

types of SQL JOINS

A

INNER JOIN : default, overlapping values
FULL OUTER INCLUSIVE JOIN: all values including overlapping values
FULL OUTER EXCLUSIVE JOIN: all values excluding overlapping values
RIGHT/LEFT EXCLUSIVE JOIN: values from right/left table excluding overlapping values with other table
RIGHT/LEFT INCLUSIVE JOIN: values from right/left table including overlapping values with other table

40
Q

What is a domain?

A

A domain is a set of values within a database with the same data type

41
Q

Difference primary-, candidate- and alternate key

A

Primary key is the unique identifier used in an entity
Candidate key is an attribute that could serve as the primary key
Alternate key is the candidate key not chosen as the primary key in an entity

42
Q

Why and how do you use SQL routines?

A

They are used to add flexibility, improve the productivity of the programmer and facilitatie enforcement of business rules. Once the function is invoked, it returns a value.

CREATE FUNCTION <function_name>(<name> REAL)
RETURNS REAL
RETURN <calculation to be made using name return value;</name></function_name>

To evoke the function: SELECT <function_name>(value)</function_name>

43
Q

CAST and MELT functions

A

CAST converts a long format data into some aggregated form of data, MELT converts aggregated data into a long format