1.3.2 - Databases Flashcards
What is SQL
Structured query language.
Declaritive language used for querying, creating and updating tables in relational databases.
SELECT…FROM…WHERE…ORDER BY
SELECT - Select field(s) to be displayed
FROM - State the table(s) the data will come from
WHERE - State the search criteria/condition
ORDER BY - Sort the result EG. Ascending order
List conditions unique to SQL
IN - Equal to a value within a set of values
BETWEEN…AND - Within a range defined by the two values
LIKE - Similar to
IS NULL - Field does not contain a value
Transaction processing: Define ACID
Atomicity
Consistency
Isolation
Durability
Explain Atomicity
Atomicity requires that a transaction must be processed in its entirety or not at all. Atomicity must gurantee that in any situation, including power cuts or hard dick crashes, it is not possible to process only part of a transaction.
Explain Consistency in relation to ACID
Ensures that no transaction can violate any defined validation rules for maining the referential integrity of the database.
Explain isolation in relation to ACID
Ensures that concurrent execution of transactions leads to the same results as if transactions were processed one after the other.
Explain durability in relation to ACID
Ensures that once a transaction has been committed, it will remain so, even in the event of a power cut.
What is record locking, and when is it used?
The technique of preventing simultaneous access to objects in a database in order to prevent updates being lost or inconsistencies in the data arising.
In simple terms, a record is locked whenever a user retrieves it for editing or updating.
Problems with record locking.
If two users are attempting to update two records, a situation can occur in which neither proceed, known as deadlock. EG A bank clerk is trying to transfer money from account A to account B. Another bank clerk is trying to transfer money from account B to account A - both clerks beed access to the other persons account, which is locked.
What is redundancy?
Maintaining multiple identical systems in different geographical locations, so that every transaction is written to multiple storage facilities. This built-in hardware redundancy protects against loss of data in the event of power failure or other disasters. Back up systems.