DML statements are expressions built around the following commands.
| Statement | Usage |
| SELECT | Used to query the database for records that satisfy specific criteria |
| INSERT | Used to load batches of data into the database in a single operation |
| UPDATE | Used to change the values of particular records and fields |
| DELETE | Used to remove records from a database table |
The functionality of the previous statements is enhanced by the use of Clauses and Operators (also called Predicates). Clauses are modifying conditions used to define the data you want to select or manipulate. The following table lists the most common clauses you can use:
| Clause | Usage |
| FROM | Used to name the table from which records are to be selected |
| WHERE | Used to specify the condition(s) the records must meet to be selected |
| GROUP BY | Used to separate the selected records into specific groups |
| HAVING | Used to state the condition to be satisfied by each group |
| ORDER BY | Used to sort the selected records according to a specified order |
| UNION | Used to combine two separate result data sets to produce one single result data set |
There are two kinds of Operators or Predicates in SQL: Logical Operators and Comparison Operators.
Logical Operators are used to connect expressions, usually within a WHERE clause. For example:
SELECT *
FROM Mytable
WHERE condition1 AND condition2
Here the AND operator connects the expressions condition1 and condition2 to specify that both conditions must be met to satisfy the selection criteria. The logical operators include:
| Relational Operator | Usage |
| AND | Result is true if both conditions are true |
| OR | Result is true if at least one of the conditions is true |
| NOT | Negation |
Comparison Operators are used to compare the relative value of two expressions to determine what action should be taken. For example:
SELECT *
FROM Publishers
WHERE PubId = 5
Here the '=' operator specifies that only those records that have a PubID field with a value of 5 will be selected. The comparison operators are listed in the following table.
| Operator | Usage |
| < | Less than |
| <= | Less than or equal to |
| > | Greater than |
| >= | Greater than or equal to |
| = | Equal to |
| <> | Not equal to |
| BETWEEN | Used to specify a range of values |
| LIKE | Used in pattern matching |
| IN | is used to determine whether or not a particular row of data exists in a table |
| EXISTS | used to determine whether or not a particular row of data exists in a table |
| NULL | used to determine whether or not a particular column in a row of data contains a value |