Operators

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter 27.  SQL Primer


In the previous section, you were introduced to the use of the "&" operator. Operators are used in programming languages to aid in the evaluation of expressions. The following table lists operators that you should be familiar with:

* The multiplication operator is used when multiplying fields or values.
/ The divide operator is used when dividing fields or values.
The minus operator is used when subtracting fields or values.
> The greater-than operator is used in Where clauses to determine whether a first value is greater than the second, such as Select * From Customers Where CustomerID > 10. The result would return all the CustomerIDs after 10.
< The less-than operator is used in Where clauses to determine whether a first value is less than the second, such as Select * From Customers Where CustomerID < 10. The result would return CustomerIDs 1 9.
>= The greater than or equal to operator is used in Where clauses to determine whether a first value is greater than or equal to the second, such as Select * From Customers Where CustomerID >= 10. The result would return CustomerIDs 1 10.
<= The less than or equal to operator is used in Where clauses to determine whether a first value is less than or equal to the second, such as Select * From Customers Where CustomerID <= 10. The result would return all the CustomerIDs starting from 10.
<>, != Used to check whether a value is not equal to a second.
AND Used with the Where clause in the Select statement. The AND operator returns a second value, such as Select * From Customers Where CustomerID = 1 AND CustomerID = 2.
OR Used with the Where clause in the Select statement. The OR operator can be used when a certain condition needs to be met or when you can settle for a second, such as Select * From Customers Where CustomerID = 1 OR CustomerID > 2.
LIKE The LIKE operator is used with Where clauses when a wildcard needs to be performed, such as Select * From Customers Where LastName LIKE 'Smi%', which would return all customers whose last names start with "Smi."
NOT Typically used in conjunction with the LIKE operator, the NOT operator is used when a value is not going to be LIKE the value of a second, such as Select * From Customers Where LastName NOT LIKE 'Smi%'.
_ The underscore operator is used with Where clauses and is performed when you do not know the second value, such as Select * From Customers Where BillingState LIKE 'A_', which would return all customers' states that begin with A, such as AK, AL, AR, AZ, and so on.
% The multiple character operator is similar to the underscore operator except that it allows for multiple characters, whereas the underscore operator allows only for two.


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net