Quiz 1 Flashcards

1
Q

Relational Model

A

Collection of Tables to represent both data and relationships

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

Tables

A

Have unique names and fixed set of columns.

AKA “Relations:

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

Relation

A

In math terminology, it is a set of tuples

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

Tuple

A

In laymens terms it is referred to as a row but can also be described as a sequence (or list) of values.

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

Attribute

A

Column

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

Domain of the attribute

A

Set of allowed values for an attribute

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

Atomicity

A

indivisible

phone numbers and addresses are not atomic

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

Null value

A

A special value that is unknown or does not exist.
e.g. in the instructor table, someone might not have a phone number and therefore that field will be left as null for that person.
They can cause difficulties when we access or update databases so we try to eliminate them as much as possible

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

Relation Schema

A

A list of attributes and their corresponding domains.
e.g.
Instructor ( ID, name, dept_name, salary)
Department (dept_name, building, budget)

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

Relation instances

A

Current values of a relation

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

Does order of tuples matter?

A

No

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

Should two tuples have the same value for all attributes?

A

No

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

SuperKey

A

A set of one or more attributes that uniquely identify a tuple
e.g. ID or Name but ID is better because someone can have the same name

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

If K is a SuperKey then:

A

Any superset of K is also a superKey. So if ID is a superkey then any combination of ID and name is also a superkey.

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

Candidate Key

A

Special kind of superkey (minimal superkey). Any proper subset of candidate key can’t be a superkey.
e.g. ID and name are possible candidate keys because all other subsets of that key is not a superkey, which in this case is just zero.

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

Primary Key

A

A candidate key
Chosen by DB designer
its attributes values are never, or very rarely changed.
e.g. SSN
and ID or unique identitifier might not be good when say two enterprisees merge and then id values may overlap but in our instructor table/relation that is the best we got…

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

Primary Key Relation Schema

A

department(dept_name, buildings, budget)

Primary key underlined and before all other attributes

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

Foreign Key

A

dept_name is a primary key for the department relation but also exists in the instructor relation so it is therefore referred to as a Foreign key. The department relation is being referenced by the instructor relation.

19
Q

Referential Integrity

A

An attribute in referencing relation should be an attribute in referenced relation.
Foreign key constraints are most common form of referential integrity.

20
Q

Relational Query languages

A

A language in which a user requests information from a database.
Higher level than standard programming language
Two types:
Procedural:user instructs system to perform a sequence of operations on DB. e.g. Relational Algebgra
Nonprocedural: User describes desired information without giving a procedure. e.g. SQL

21
Q

Relational Algebra

A

A set of operations on relations

Parallel to usual Algebra

22
Q

Usual Algebra examples

A

Operations: addition, subtraction or multiplication
Input: One or more numbers
Output: A number
e.g. z = 3x + 4y + 10

23
Q

Relational Algebra examples

A

Operations: select, project, union, set difference, cartesian product, rename, set intersection, natural join, assignment
Input: one or more relations
Output: A relation (table)
sigma_salary>=85000(instructor)

24
Q

σ (selection)

A

Return rows of the input relation that satisfy the predicate.
σ_salary>=85000(instructor)

25
Q

π (projection)

A

Output specified attributes from all rows of the input relation. Remove duplicate tuples from the output.
π_ID,salary(instructor)

26
Q

BowTie (Natural Join)

A

Output pairs of rows from the two input relations (regardless of whether or not they have the same values on common attributes)
Instructor BowTie deparment

27
Q

x (cartesian product)

A

Ouput all pairs or rows from the two input relations (regardless of whether or not they have the same values on common attributes)
Instructor x department

28
Q

U (Union)

A

Output the union of tuples from the two input relations.

π_name(instructor)U π_name(student)

29
Q

Enitity-Relationship (ER) Model

A

E-R data model hekps to design DB schema.

30
Q

Object based data models

A

Extends E-R model with encapsulation, methods/functions, Object Identity

31
Q

Problems with Relation Model?

A

Support limited data type.

  • Complex domain requires complex data types (e.g. nested record structures, multivalued attributes, and inheritance)
    2. Difficulty in accessing data from C++ or Java Programs
32
Q

XML

A

Extensible Markup Language

A great way to exchange data, not just documents

33
Q

Database

A

Collection of structured and interrelated data

34
Q

File Systems

A

Organizations used to store data in file systems but not anymore!

35
Q

File System drawbacks

A

Get more complex over time. e.g. adding new majors and departments
Data redundancy: Can have the same data in two files
Data Inconsistency: May be updated in one department but not the other
Difficulty in accessing data: have to parse through everything to get the data that you want which takes time or you are always writing new programs to solve the problem
Data Isolation: Data can be scattered in different files or files could be in different formats which makes retrieving the data difficult
Integrity Problems: if new constraints are added or existing ones need to be changed then you might run into issues with aforementioned formatting and what not.
What happens if system fails during the transaction? Chaos
Concurrent-Access Anomalies
Security Problems: people having access to information that they shouldn’t be able to view. Hard to protect/limit in file Systems.

36
Q

DBMS

A

A collection of interrelated data (database) and a set of programs that allow users to access and modify these data.
AKA Database System
Examples: Oracle, Microsoft SQL server, IBM DB2, MySQL, PostgreSQL

37
Q

DBMS Top part

A

Users and interfaces

Who is who and who is allowed to do what

38
Q

DBMS Bottom Part

A
Disk Storage
Data is stored here
Indices
Data Dictionary (Metadata)
Statistical Data
DBMS hides details of how data stored & maintained which is important for Data Abstraction
39
Q

DBMS Middle part

A

Query processor helps DBMS to simplify and facilitate access to data.
Storage manager is important because DB typically requires a large storage space.

40
Q

Query Processor

A

Processes the Queries
Query: A statement requesting information
Queries are represented by a language (DB language)
Two parts:
- Data definition Language (DDL)
- Data Manipulation Language (DML)

41
Q

Four components of Storage Manager

A
  1. Buffer Manager: fetches data from disk into main memory and decides what data to cache in the main memory.
  2. File manager: Manages space allocation on disk storages
  3. Authorization and integrity manager: Tests for satisfaction of integrity constraints and checks authority of users access to data.
  4. Transaction Manager: A unit of program that accesses and updates data items.
    Ensures ACID properties
    Transactions are initiated by SQL or programming language using ODBC/JDMC
42
Q

ACID

A

Atomicity, Consistency, Isolation, and Durability
Atomicity: all or none transaction
Consistency: preserves consistency of DB, e.g. Value sum of the balances of A and B must be preserved.
Durability: After a successful funds transfer, new values of A and B must persist, even if system fails.
Isolation: Each transaction is unaware of other transactions executing concurrently in system.
For two transactions Ti and Tl, it appears to Ti that either Tj finished execution before Ti started or Tj started execution after Ti finished

43
Q

DBMS structure

A
  1. More complexity
  2. Data redundancy
  3. Data Inconsistency
  4. Difficulty in accessing data
  5. Data Isolation
  6. Integrity Problem
  7. Atomicity Problem
  8. Concurrent-Access anomalies
  9. Security Problems
44
Q

Database Architecture

A

Influenced by computer system on which DB is running.
Centralized vs Distributed:
Database is located on single computer or data is physically divided among several several computers connected by a network