Returns only the values of rows that meet the conditions specified in the WHERE clause.
Example:
SELECT customer_name FROM table_customers WHERE gender = "M"
Operators
|
Description
|
= |
Equal
|
!= |
Not Equal
|
<> |
Different
|
> |
Greater
|
< |
Less
|
<! |
No Minor
|
!> |
No greater
|
>= |
Greater Than or Equal
|
<= |
Less Than or Equal
|
Each of them can be used in search conditions to form the relational predicates.
BETWEEN - AND: Specifies data included in a certain range.
Can be used with numbers as with dates:
SELECT CustomerID, Name FROM Customer WHERE table_customers DateNasc BETWEEN "1997-01-01" AND "04/31/1997"
SELECT CustomerID, Name FROM Customer WHERE table_customers suppliersID BETWEEN 1 AND 9
IS NUL: Allows you to select rows where the contents of the field is null (BLANK).
SELECT CustomerID FROM WHERE table_Requests DateRequests IS NULL
LIKE: Allows you to use masking characters to compare data in a search condition on text values. We use two characters
Mask
Replace a single character: _ or ;
Replace a sequence of characters: % or *.
SELECT FROM table_customers WHERE nameCustomers LIKE "RIC%";
SELECT FROM table_customers WHERE nameCustomers LIKE "J_A_";
IN: Allows you to select data that fit a set or more list of values
SELECT CustomerID, customer-name FROM table_nameCustomers WHERE CustomerID IN ("ABCDE", "ZXED", "WW3CD")
Amanda Santos (Migrated deleted Agent)
Comments