Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
A query is a single SQL statement that does Select, Update, Insert or Delete of rows.A transaction is a consecutive sequence of SQL statements (from the application viewpoint) that have the "ACID" properties:
Query is a single statement ,
Transaction is a set of queries that are all run or all rejected , if a query of transaction rejected , all other queries (of transaction) are rejected also
As we know, query is a single SQL statement that does Select, Update, Insert or Delete of rows. A transaction is a consecutive sequence of SQL statements (from the application viewpoint) that have the "ACID" properties: Atomicity: All statements or none are executed. Consistency: Data integrity is always maintained.
The query is simple set of insert,update,delete statement where as transaction is a set of statement which follows ACID properties.
Hello,
To give a very simple explanation on transaction and query:
Lets take an example where there are3 queries that execute and we execute these queries in2 different ways, With and Without Transaction.
Now when these queries are executed, assume that Query1 and2 is executed successfully, but Query3 fails, and we need to make sure that the data is committed to the database only if all three Queries are executed successfully.
Scenario1: when we execute the3 queries without a transaction, Query1 and2 will be executed successfully and Query3 fails to execute and so the data update only up to Query2 is committed to the database leaving it in an in-consistent state.
Scenario2: when we execute the3 queries with a transaction, Query1 and2 will be executed successfully and Query3 fails to execute and now the entire transaction will be rolled back leaving the data in the state as it was before Query1 was executed, and so the data is in a consistent state.
Hope this was useful to understand, if there are any queries / doubts, please let me know.
Thanks.
A query is usually used to get data from a db, while the transaction can contain many queries and statements that all either success or fail, in other words a transaction either makes its all effects or does nothing e.g. money transfer between two accounts ( subtraction and addition) either together or none
transactions more on either computers and written but query seems like talking
A query is a single sql statement that does either insert, update or delete certain attributes or rows.
A transaction is a group of statements, that obeys the ACID property. ACID stands for Atomicity, Consistency, Isolation, Durability.
Atomicity: these group of statements are considered to be single unit, either they have to be executed completely or none.
Consistency: The database should always be in a consistent state.
Isolation: Atransaction should not affect other transaction in any way.
Durability: Once a transaction is commited, its affects are permanent in the database.
A Query which is written to perform a task onset of records called query, not necessarily have to be made permanent in the database.
The transaction we call anything between two DDL.
that means a transaction which ran between two DDL's and committed or reverted back.
Query is a single SQL statement and transaction is a set of SQL statements.
a query is a single SQL statement against database like(select , update , insert , delete ) .
A transaction is a single unit of work ( group of statements ).
If a transaction is successful, all of the data modifications made during the transaction are committed and become a permanent part of the database.
If a transaction encounters errors and must be canceled or rolled back, then all of the data modifications are erased.
A query is a single statement to manipulate data.(eg: SELECT, UPDATE, INSERT ,DELETE)
While a transaction is a series of statements which is defined by ACID.
Atomiticy - All statement will be executed or none
Consistency - Maintain Data integrity
Isolation - transaction A shall not affect transaction B
Durability - Able to persist data even if system failure occurs