Week 8 Flashcards
What does DCL stand for?
DCL stands for Data Control Language.
What are the two main commands of DCL?
The two main commands of DCL are GRANT and REVOKE.
What is the purpose of the GRANT command in DCL?
The purpose of the GRANT command in DCL is to give users specific privileges or permissions on database objects such as tables, views, or procedures.
What is the purpose of the REVOKE command in DCL?
The purpose of the REVOKE command in DCL is to take back or remove previously granted permissions or privileges from users.
How does DCL help in database security?
DCL helps in database security by controlling user access to database objects and enforcing restrictions, thus preventing unauthorized operations.
What does TCL stand for?
TCL stands for Transaction Control Language
What are the main commands of TCL?
The main commands of TCL are COMMIT, ROLLBACK, SAVEPOINT, and SET TRANSACTION.
What is the purpose of the COMMIT command in TCL?
The purpose of the COMMIT command in TCL is to permanently save the changes made during a transaction to the database.
What is the purpose of the ROLLBACK command in TCL?
The purpose of the ROLLBACK command in TCL is to undo changes made during a transaction before they are committed.
What is the difference between SAVEPOINT and ROLLBACK?
The difference between SAVEPOINT and ROLLBACK is that SAVEPOINT sets a point in a transaction to which you can later rollback, whereas ROLLBACK undoes all changes made since the beginning of the transaction or since a specified savepoint.
What is a transaction in a database system?
A transaction in a database system is a unit of work that is performed against the database, which can include multiple operations like insertions, updates, and deletions, and must be executed in full or not at all.
What are the four properties of a transaction?
The four properties of a transaction are ACID: Atomicity, Consistency, Isolation, and Durability.
Why are transactions important for database integrity?
Transactions are important for database integrity because they ensure that the database remains in a consistent state, even in cases of failures, by allowing only complete operations to be committed.
How does a transaction help ensure data consistency?
A transaction helps ensure data consistency by ensuring that all operations within the transaction are successfully executed before changes are committed, or none at all.
What happens if a transaction fails?
If a transaction fails, the database can revert to its previous state using ROLLBACK, undoing all operations within the transaction.
What does ACID stand for in the context of transactions?
ACID stands for Atomicity, Consistency, Isolation, and Durability.
What is the ‘Atomicity’ property in ACID?
The Atomicity property ensures that all operations within a transaction are completed successfully or none are applied at all.
What is the ‘Consistency’ property in ACID?
The Consistency property ensures that a transaction brings the database from one valid state to another, maintaining database integrity.
What is the ‘Isolation’ property in ACID?
The Isolation property ensures that transactions are executed independently without interference from other concurrent transactions.
What is the ‘Durability’ property in ACID?
The Durability property ensures that once a transaction is committed, its changes are permanently stored in the database, even in the case of a system failure.
What does the COMMIT command do in a transaction?
The COMMIT command in a transaction saves all changes made during the transaction to the database permanently.
What does the ROLLBACK command do in a transaction?
The ROLLBACK command in a transaction undoes all changes made since the beginning of the transaction or since a savepoint.
What are transaction isolation levels?
Transaction isolation levels define the degree to which transactions are isolated from each other in terms of visibility of data changes.
What is the ‘Read Uncommitted’ isolation level?
The Read Uncommitted isolation level allows a transaction to read uncommitted changes made by other transactions, potentially leading to dirty reads.
What is the ‘Read Committed’ isolation level?
The Read Committed isolation level ensures that a transaction can only read committed data changes made by other transactions, avoiding dirty reads.
What is the ‘Repeatable Read’ isolation level?
The Repeatable Read isolation level ensures that if a transaction reads the same data multiple times, the data remains consistent throughout the transaction, preventing non-repeatable reads.
What is the ‘Serializable’ isolation level?
The Serializable isolation level ensures complete isolation from other transactions, preventing dirty reads, non-repeatable reads, and phantom reads.
Which isolation level offers the highest level of data integrity?
The Serializable isolation level offers the highest level of data integrity.
What is an aggregate function in SQL?
An aggregate function in SQL performs a calculation on a set of values and returns a single value, such as SUM or AVG.
What does the COUNT function do?
The COUNT function returns the number of rows in a set.
What does the SUM function do?
The SUM function returns the total sum of a numeric column.
What does the AVG function do?
The AVG function returns the average value of a numeric column.
What does the MAX function do?
The MAX function returns the maximum value from a set of values.
What does the MIN function do?
The MIN function returns the minimum value from a set of values.
What is a scalar function in SQL?
A scalar function in SQL returns a single value based on the input values, such as UPPER or LOWER.
What does the UPPER function do?
The UPPER function converts a string to uppercase.
What does the LOWER function do?
The LOWER function converts a string to lowercase.
What does the LEN function do?
The LEN function returns the length of a string.
What does the ROUND function do?
The ROUND function rounds a numeric value to a specified number of decimal places.
What does the GETDATE function return?
The GETDATE function returns the current date and time.
What is a sequence in SQL?
A sequence in SQL is an object that generates a sequence of numeric values.