Download Study Guide for Mid

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Global serializability wikipedia , lookup

IMDb wikipedia , lookup

Microsoft Access wikipedia , lookup

Relational algebra wikipedia , lookup

Oracle Database wikipedia , lookup

Commitment ordering wikipedia , lookup

Functional Database Model wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Ingres (database) wikipedia , lookup

SQL wikipedia , lookup

Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Serializability wikipedia , lookup

PL/SQL wikipedia , lookup

ContactPoint wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Concurrency control wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Study Guide for the Final Exam
CPSC260
Data, Information and Knowledge – understand the differences, be able to give
original examples.
To be useful, data must be: accurate, relevant and timely. Be able to explain why
for each of these characteristics of data.
Meta-data/data dictionary
Advantages of DBMS - pg. 7
Functions of a DBMS – pg. 20
Structural and data dependence and independence
Logical data format and physical data format
Anomalies
Update, Insert and Delete – be able to explain
Parts of a database system from a general management point of view (5 parts)
Relationships
One-to-one, One-to-Many, Many-to-Many – be able to give an example of
each and to model using ERD.
Business rule – what is its role in database design?
Relational model – table based representation of data
Characteristics of a Relational Table – Table 3.1 on pg. 62
Keys
Concept of determination and functional dependence
Superkey, candidate key, primary key, secondary key, composite key, foreign
key, surrogate key
Integrity rules
Entity integrity, Referential integrity – understand how to determine if a
particular table or group of tables have entity and referential integrity
Relational Set Operations
Understand and be able to perform Select, Project, Join, Product operations
Understand the difference between a natural and a left or right outer join
operation
Understand how to represent 1:1 and 1:M relationships in relational tables
Understand how to convert one M:N relationship into two 1:M relationships using a
bridge entity
Index, unique index – what are these and when would they be used in the design of
a database?
Multi-valued attributes – what are they and how can they be included into a
database design (2 alternatives)
Derived attributes – what are they and what is the tradeoff that needs to be
considered with respect to derived attributes?
Existence dependence – give an example of two entities in which one entity is
existence dependent on the other
Strong and weak relationships / identifying and non-identifying relationships –
understand the difference in the way they are represented on an ERD diagram
Weak and Strong entities
Optional and Mandatory relationships – how are these represented on an ERD?
Normalization – if presented with a table, be able to determine which, if any,
normal form it is in. (Must understand the conditions necessary for each of
the normal forms 1NF, 2NF and 3NF. Don’t need to know BCNF or 4NF)
Also, need to be able to convert a table not in normal form to 1NF, a 1NF
table to 2NF, and a 2NF table to 3NF.
Understand database design considerations beyond normal forms:
Evaluating the primary key (determine if a surrogate key should be used)
Attribute atomicity
Maintaining historical accuracy
Evaluate use of derived attributes
Understand what denormalization is and why you might make a decision to
denormalize a table in a design.
Authorization and Authentication – how might the data required for these system
functions be modeled in a database design. (Hint: Covered this in class.
Information is not in the book).
What is a domain table? What is it used for? Give an example. (Hint: Covered this
in class. Information is not in the book).
Supertypes and Subtypes
- know how to represent in an ERD and how to implement in SQL.
- Subtype discriminator
- Disjoint and Overlapping subtypes
- Partial complete and total complete subtypes
Desirable Characteristics of a primary key (PK)
- unique values, no embedded intelligence, time invariant, single attribute,
numeric, security compliant
2 cases when composite key should be used:
1. bridge entity
2. weak entity
SQL – Structured Query Language
- SQL-99 – ANSI/ ISO standard
DDL commands
CREATE TABLE
CREATE INDEX
CREATE VIEW
DROP TABLE
DROP INDEX
DML commands
INSERT
UPDATE
DELETE
COMMIT
ROLLBACK
Data Types
Integer, SmallInt, Byte, Counter, Money, Number, Real, Char, Varchar, Date,
Logical
CREATE TABLE
PRIMARY KEY
FOREIGN KEY
Constraints
NOT NULL
UNIQUE
DEFAULT
CHECK
PRIMARY KEY
FOREIGN KEY
ON UPDATE CASCADE
ON DELETE CASCADE
SELECT queries
WHERE clause
- wildcards
- LIKE operator
- IN operator
- EXISTS operator
Aggregate functions – COUNT, MAX, MIN, SUM, and AVG
GROUP BY
HAVING
ORDER BY
Natural join
Creating aliases
Subqueries
Correlated Subqueries
Given an ERD model, be able to generate the CREATE TABLE commands to
generate the tables in the ERD.
Given a set of tables, be able to generate SELECT command to extract data
View – does not duplicate data
- once created can be used like any other table
Anonymous code blocks – nameless SQL code block that includes procedural
programming language statements
- used only once
Triggers – procedures associated with specific tables and specific events
- triggers fire when specified event occurs on specified table
- stored in the database
- statement-level trigger vs. row-level trigger (FOR EACH ROW)
- Difference between BEFORE and AFTER triggers
- :New attribute reference
Stored Procedures
- named SQL code block that includes procedural programming language
code
- stored in the database
- may be reused many times
- 2 reasons the use of stored procedures is advisable
o Reduced network traffic
o Reduce code duplication
Cursors
- used in procedural code blocks to process multi-row results of a SELECT
command.
- Open, Fetch, Close commands
Embedded SQL
- ADO.NET
- ODBC
- JDBC
Microsoft Access
-
single user database
non-standard SQL interface
no concurrency control
no transaction management
no views
no triggers or stored procedures
Oracle - best selling commercial, multi-user database
- PL-SQL (Procedural SQL)
Microsoft SQL Server
- T-SQL (Transact SQL)
IBM DB2
SDLC – System Development Life Cycle – pg. 362
- know the phases and what is done in each phase
DBLC – Database Life Cycle – pg 365
- know the phases and what is done in each phase
Database Transaction – a logical unit of work consisting of one or more database
requests that must be completed as a unit.
Transaction Properties (ACIDS)
1. Atomicity
2. Consistency
3. Isolated
4. Durability
5. Serializability
Transaction log – what data is stored therein
- what role does in play in a database management system
Concurrency control
Potential problems with concurrent execution of transactions
1. Lost updates
2. Uncommitted data
3. Inconsistent retrievals
Concurrency control mechanisms
1. Locks
2. Time-stamping methods
3. Optimistic methods
Locks
Binary locks
Shared/Exclusive locks
Granularity of locks
- understand the tradeoff between concurrency and overhead (storage and
processing)
2 phase locking
- ensures serializability of concurrent transactions
- does not prevent deadlock
Deadlock – condition which can arise if transactions are allowed to hold locks
while at the same time waiting for others
3 strategies for controlling deadlock
1. Prevention – at time of lock request, if deadlock possible, rollback one
or more transactions
2. Detection - periodically check if one or more transactions are not
completing within a reasonable amount of time due to waiting on locks.
If so, rollback one or more transactions.
3. Avoidance – institute rules that would prevent deadlock from ever
occurring – like requiring all locks to be obtained in a specific,
sequential order.
Time-stamping methods (used with locks)
- each transaction assigned a time-stamp based on when the transaction starts
- all operations associated with the same transaction share the same time
stamp
- timestamps are unique and monotonically increasing in value
Schemes for preventing deadlock
1. Wait/Die scheme
2. Wound/Wait scheme
Optimistic method – used when there are relatively few conflicting operations
3 phases – read, validation, write
Database Recovery Management
Backups
1. Full backup
2. Differential backup
3. Transaction log backup
Data buffering
- databases perform updates in RAM
- periodically write RAM copy of table to permanent storage (checkpoint)
Checkpoints
1. Consistent database checkpoint – no new transactions started, existing
ones allowed to complete
2. Inconsistent database checkpoint – snapshot of RAM copy of database
tables