Database fundamentals Flashcards
Name five features of a relational database.
- Consists of tables with columns and rows.
- Uses keys: primary, foreign.
- Uses relationships: one-to-many.
- Uses transactions.
- Uses SQL.
What do columns and rows in a database table represent?
Columns: Represent the data that should be in the DB. These are the structure and rules for the data.
Rows: The actual data.
What is a primary key?
A unique piece of data. Can be naturally unique or system generated piece of data. It is identified by the column and makes each row unique. Allows you to connect tables together (form relationships between tables).
What are the three kinds of table relationships?
- One-to-many: most common
- Many-to-many: not too common but used. Uses a junction or linking table between the two tables.
- One-to-one: not common
How is a transaction defined?
A transaction is a combined unit of work. Think of a simple money transfer.
What is the ACID test?
A: Atomic (indivisible) - All or nothing.
C: Consistent - Take the DB from one valid state to another valid state based on the rules of the DB.
I: Isolated - The data and the transaction are locked while the transaction is occurring.
D: Durable - Robust. Once the transaction is done, it is guaranteed.
All transactions must pass the ACID test.
What is SQL?
Structured Query Language. It is a declarative query language so you describe what you want and the DMS figures out the procedural stuff: SELECT * FROM Books WHERE ListPrice > 40.
Uses C-R-U-D.
PLSQL: Oracle SQL
T-SQL: Microsoft SQL server