SQL SUM() for Beginners

In SQL, the SUM() function is an aggregate function that returns the sum of all values in a given expression.

It can also be used to return the sum of all distinct (unique) values in an expression.

The expression must be numeric (it cannot be character string, bit string, or datetime).

Below are some basic examples to demonstrate how it works.

Continue reading

SQL Transactions Tutorial

In SQL, transactions are used to maintain data integrity by ensuring that a sequence of SQL statements execute completely or not at all.

Transactions manage sequences of SQL statements that must be executed as a single unit of work, so that the database never contains the results of partial operations.

When a transaction makes multiple changes to the database, either all the changes succeed when the transaction is committed, or all the changes are undone when the transaction is rolled back.

Continue reading