For two relative queries
Transactions:A transaction is a sequence of operations performed as a single logical unit of work ( OR ) A Transaction is a Logical unit of work. Properties of Transactions: Every logical unit of work must exhibit four properties to consider that as a transaction. Those properties are called as ACID Properties. Atomicity: Consider a transaction having n number of queries either all these n no.of queries has to be successfully completed or all n no.of queries should fail. This property is called as Atomicity. Consistency: After completion of a transaction all the data should be left in a consistent state. That means when you insert a new record in a table called Students and for example if the table is having any associated indexes , after inserting the data into the table the associated indexes should be updated appropriately. Isolation: as per isolation no two concurrent transaction should be allowed to act upon a single data. Durability: After completion of a transaction the data modified by the transaction should be stored permanently in the DB even in case of system failure. sql interview questions
Transactions allow you to group SQL commands into a single unit. The transaction begins with a certain task and ends when all tasks within it are complete. The transaction completes successfully only if all commands within it complete successfully. The whole thing fails if one command fails. The BEGIN TRANSACTION, ROLLBACK TRANSACTION, and COMMIT TRANSACTION statements are used to work with transactions. A group of tasks starts with the begin statement. If any problems occur, the rollback command is executed to abort. If everything goes well, all commands are permanently executed via the commit statement.