Flashcards
SCC 201
Flashcards do conjunto (56)
- 1DMBS Terminologyf
- 2What is data independence?Data independence is a type of data transparency which separates the logical view from the physical view
- 3Why have the data independent of each other?1. Physical data independence
ability to modify the physical schema without causing an application to be re-written
2. Logical data independence
ability to add/remove to/from a table without affecting the user's view - 4Relational Databases TerminolgyThe reason this card is here is because terminology is used in different contexts throughout the course, allows us to differentiate
- 5Define an entity and give an exampleAn entity represents a specific object (Abstract or real)
E.g. if we have a Cars DB, then a car would be an entity - 6Define an attribute and give an exampleAn attribute is a property describing an entity (column header in a table)
E.g. A car would have a model, colour etc. Model and colour are attributes - 7Define a relationship and give an exampleA relationship is an association among entities
E.g. Car x is driven by Person p
driven is the relationship between car & person - 8Define a tupleA tuple is a row in a table and represents a collection of related data values
- 9Define a record and give an exampleA record describes entities and their relationships
Imagine a small Cars DB, with these attributes
E.g. Model | Colour
ST | Blue
"ST", "Blue" would be a record - 10Define relational schema and give an exampleA relation schema is a named relation followed by a set of attributes (an relations if has any)
R(A1, A2)
E.g.
(SQL example)
Planets(Planet_id, VARCHAR etc - 11Define a database schema and give an exampleA database schema is a set of relation schema's for the DB
DBR(R1, R2)
(SQL example)
E.g. for LSH we had
heroes(hero_id ...
planets(planet_id ...
etc - 12Define the domain and give an exampleSet of atomic values
E.g.
Dom(Model) = {ST} - 13Define the degree of a relationThe degree of a relation is the number of attributes of it's relation schema
E.g. Cars degree is 2 - 14What is a superkey?A superkey is a subset of attributes where two tuples will never be the same
Every relation has a default superkey (all attributes) - 15What is a key?Minimum set of a attributes that will return a unique value
- 16What is a candidate key?One or more keys in a relation schema, these are called candidate keys
- 17What is a primary key?If a relation has just one key, this will become the default primary key. If a relation has multiple keys (candidate keys), you can select which one you'd like to be the primary key
- 18What is a foreign key?An attribute (or collection of attributes) in a table that uniquely identifies a tuple in another table.
Defined in another table but references the primary key in the first table - 19What are the integrity constraints?Entity integrity
Domain integrity
Referential integrity - 20Define referential integrityReferential integrity rule states that any foreign-key value can only be in one of two states
1. Foreign-key values refers to Primary-key value
2. NULL (meaning no relationship is present) - 21Define domain integrityAll attributes must be have their data types, data format and range of values declared upon defining the domain
- 22Define entity integrityEntity integrity rule states that EVERY table must have a primary key and that the column (attribute) chosen must be unique
- 23Relational Algebrak
- 24SELECTSelects rows
Selects a subset of tuples from a relation based on a condition
Denoted Sigma
Sigma R
Result = relation
Resulting relation = same attributes as R - 25PROJECTSelects columns
Selects a subset of attributes from a relation
Denoted Pi
Pi R
Result = relation
Resulting relation = selected attributes in the same order as the table - 26Concurrency terminologyk
- 27Define a transactionA transaction is logical unit of database processing which includes one or more database access operators
E.g. Read/write - 28What causes the 'lost update' problem?Two different transactions trying to update the same column on the same row within a database at the same time. The result of the first transaction is then lost due to being overwritten
- 29What causes the 'temporary update' problem?The updating of a database by a transaction which fails, this is then updated by another transaction before returning to it's original value (Aka dirty read)
- 30What is the 'incorrect summary' problem?A transaction is performing an aggregate function on a select number of records while another transaction is simultaneously updating these records
- 31What is meant by 'atomicity of transactions'?Either every instruction in a transaction occurs or none of them do
- 32What does the abbreviation 'ACID' mean in the context of transactions?A - atomicity
C - consistency preservation -
A transaction execution should take the
database from one consistent state to another
I - isolation -
A transaction execution should not be
interfered with by any other concurrent
transactions
D - durability -
changes applied to the database by a
committed transaction must persist - 33What is meant by a 'schedule' in the context of transactions?(Broad term)
Ordering of the operations of the transactions
S = T1, T2, Tn - 34What is meant by a 'serial schedule' in the context of transactions?Ordering of the operations of transactions but NO interleaving can occur
E.g.
T1
T2
T3
T4 - 35What is meant by a 'nonserial schedule' in the context of transactions?Interleaving can take place
E.g.
T1
T3
T2
T4 - 36Define the term serializabilityA transaction schedule is serializable if its outcome is equal to the outcome of its transactions executed sequentially, i.e. without overlapping in time
- 37Why do we need concurrency control techniques?To ensure the isolation of concurrently executing transactions
- 38What is a shared lock?A shared lock is a read lock and can be held by multiple transactions
- 39What is an exclusive lock?An exclusive lock is a write lock and can only be held by one transaction at a time
- 40How does the process of lock conversion work?If a transaction is the only transaction holding a read lock it can convert the lock to a write lock ('upgrade')
A transaction can do vice-versa as well ('downgrade') - 41What is the difference between fine and coarse granularity in the context of concurrency?The coarser the granularity the lower the degree of concurrency that is permitted
The finer the granularity higher the degree of concurrency that is permitted - 42What is two-phase locking?A protocol which is split into two phases
Expanding - allows new locks to be required, but non to be release (if lock conversion (upgrading) is permitted, has to be carried out during this phase)
Shrinking - Existing locks can be released, but no new ones can be acquired
(If lock conversion permitted (downgrading) has to be carried out here) - 43ER Model Terminologyh
- 44Entity notation
- 45Relationship notation
- 46Attribute notation
- 47Key attributes notation
- 48Relationship attributes notation
- 49Composite attributes notatione.g. name - first name - last name
- 50Multi-valued attributes
- 51ER Model to Relation mappingr u rdy
- 52What is the 1st step in ER-to-Relational mapping?For each entity in ER schema create a relation that includes all the simple attributes
- 53What is the 2nd step in ER-to-Relational mapping?(Skip if no 1:1)
if there is a 1:1 binary relationship between S & T
Select one of the two relations and include a foreign key, enabling the other relation the ability to reference it - 54What is the 3rd step in ER-to-Relational mapping?For a binary relationship 1:N between S & T
Take the primary key of relation that is representing the 1 side (S in this case) and include it as the foreign key in relation representing entity on N-side - 55What is the 4th step in ER-to-Relational mapping?For a binary relationship M:N create a new relation S to represent many-to-many relationship
Create a new relation with the primary keys (or candidate keys) from M entity and N entity (and attributes of the relationship if there are any) - 56What is the 5th step in ER-to-Relational mapping?For each multi-valued attribute
Create a new relation R with the multi-valued attribute (if also composite, use the simple attributes making the composite attribute) and the primary key of the relation (will be using as a foreign key)
Informações
- Descrição
- Degree Computer Science FlashCards sobre SCC 201, criado por Mac Howarth em 30-04-2017.
- Criado por
- Mac Howarth
- Visualizações
- 4
- Avaliação