What is a transaction in a database system?
a) A group of SQL statements that are executed as a single unit
b) A log of all changes made to the database
c) A backup of the database structure
d) A query that modifies multiple tables
Answer:
a) A group of SQL statements that are executed as a single unit
Explanation:
A transaction in a database system is a group of one or more SQL statements that are executed as a single unit. Transactions follow the ACID properties (Atomicity, Consistency, Isolation, Durability) to ensure that either all operations in the transaction are successfully completed or none are.
Transactions are essential for maintaining data integrity, especially in multi-user environments. They ensure that operations such as updates, inserts, or deletes do not leave the database in an inconsistent state.
Examples of transactional operations include transferring funds between accounts or updating multiple related records in a database.