Start networking and exchanging professional insights

Register now or log in to join your professional community.

Emad Mohammed said abdalla
by Emad Mohammed said abdalla , ERP & IT Software, operation general manager . , AL DOHA Company

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:

  • Atomicity: All statements or none are executed.
  • Consistency: Data integrity is always maintained.
  • Isolation: Transaction A can never affect Transaction B.
  • Durability: Changes that are committed by a transaction persist, even in event of system failure.

Abdessamed HACENE
by Abdessamed HACENE , J2EE Developper , ELIT SPA

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

Mohammed Aamir Murthaza
by Mohammed Aamir Murthaza , Software Quality Assurance Engineer , Cognizant Technology and Solutions

 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.

Jay Joshi
by Jay Joshi , Database Developer , Accion Labs [Client: Amway]

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.

Mourhaf Alhalabi
by Mourhaf Alhalabi , Data analyst

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

erwin cailing
by erwin cailing , Finance Officer , Marikita City

transactions more on either computers and written but query seems like talking

Sahada Sherin B
by Sahada Sherin B , ERP ANALYST , Silicon Pvt. Ltd

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.

 

Javed Khan
by Javed Khan , Technical Lead , MetricStream

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.  

Sadik Shaik
by Sadik Shaik , IT Analyst , TATA CONSULTANCY SERVICES

Query is a single SQL statement and transaction is a set of SQL statements.

Adel Ezat Fawzy Ellozy
by Adel Ezat Fawzy Ellozy , Webdeveloper. , Saudi Arabian Maritiem Sports Federation

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.

Jason Morales
by Jason Morales , C#.net Programmer / Software Developer , Cebupacific Airline

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

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.