Databases Flashcards
How can a many-to-many relationship be expressed?
By both tables in the relationship having one-to-many relationships to a common table
What is an entity?
A thing about which data is to be stored, for example: a customer. Each row in the table is an entity
What is an attribute?
Characteristics or other information about entities, for example: the customer’s name or address: Each column in the table is an attribute
What is a composite primary key?
A primary key made up of multiple attributes
What is a foreign key?
A key in a table which is the primary key in another table, used to link those two tables
What is a primary key?
A primary key is an attribute that provides an unique identifier for every entity in a table
[PPQ] What does it mean when a database is normalised?
The data is atomic and has no transitive dependencies [?}
What are the advantages of normalised databases?
Faster to search and sort, easier to manage, number of update, insertion and deletion anomalies reduced
What is first normal form?
When a database conforms to first normal form, it contains no repeating attributes. The database’s data can be referred to as atomic (meaning that no single column contains more than one value).
[PPQ] Describe an example of a problem that could occur if no system were in place to
manage concurrent access to the database
Two users read and edit the same record simultaneously. They both edit the record and then send it back and save, meaning only one set of changes is kept
What is second normal form?
Ensuring the database is in 1NF and removing attributes that depend upon part but not all of the primary key by creating additional tables
What is third normal form?
Ensuring the database is in 2NF and removing non-key attributes that depend on other non-key attributes
What is a client-server database?
A database that is stored on a server and can be accessed by various users from their workstations
How can simultaneous access problems be avoided?
Record locks: when a transaction on a record starts, there’s a temporary exclusive lock on that record, and other users cannot edit the data until the lock is removed
Timestamp ordering: Timestamps are generated for each transaction, database records timestamp of the last time the record was written to, and aborts the transaction if it will result in loss of data integrity
Creating a table
CREATE TABLE TableName { AttribName1 datatype (length), AttribName2 datatype (length), PRIMARY KEY (AttribName1) };