... The AND Operator 72
The OR Operator 73
Using Parentheses 73
Multiple Sets of Parentheses 75
The NOT Operator 76
The BETWEEN Operator 79
The IN Operator 80
Boolean Logic ... area of expertise is with data warehouse
systems and reporting tools. He recently developed a suite of BI tools for ASA P
Software, a subsidiary of Dell Inc. He holds an MBA from the University of
Chi...
... 'Random Value'
When you change the value of the seed argument, it will return a different value.
The
PI function merely returns the value of the mathematical number pi.
(Think back to your ... purposes and satisfy the basic desire of users to view data in some sort
of order. With the sort, we will begin to think of the entire way in which our
information is...
... However, if the same list
were sorted alphabetically, then you could quickly locate the desired customer.
The idea of sorting data alphabetically applies to many situations, even when the
data isn’t ... to emphasize the fact that the sort is ascending, as
opposed to descending.
Sorting in Descending Order
The DESC keyword sorts in an order opposite to ASC. Instead of ascendi...
... space has been inserted between the phrase LOVE and the percent
(%) wildcards on either side. This ensures that there is at least one space on
either side of the word. The data brought back from this ... Says I Love You
Wildcards
The percent (%) symbol is the most common wildcard used with the LIKE
operator. However, there are a few other possibilities. These include the und...
... counting the number of distinct values for the FeeType col-
umn. The result is:
Number of Fee Types
3
This means that there are three different values found in the FeeType column.
Grouping Data
The ... examples of aggregation functions are interesting, but of somewhat
limited value. The real power of the aggregation functions will become evident
after we introduce the...
... several forms of aggregation, starting with the sim-
plest—that of eliminating duplicates. We then introduced a number of aggregate
functions, which are a different class of functions from the scalar ... BY Student
The resulting data is:
Student Grade Type Average Grade
Kathy Quiz 71.5
Susan Quiz 93.5
Now that we’ve added the HAVING clause to the mix, let’s recap the gener...
... from the CustomerID
field of the Customers table to the CustomerID field of the Orders table. This
arrow indicates that the link between the Customers and Orders tables is possibly
one-sided in the ... Ahead
The ability to join tables together in query is an essential feature of SQL. Rela-
tional databases would be of little use without joins. This chapter focused on...
... Calculated Column
The final general use of subqueries is as a calculated column. Let’s say we would
like to see a list of customers, along with a count of the number of orders they
have placed.
This ... format, the IN operator merely lists a number of values in parentheses.
There is also a second format for the
IN, one in which an entire SELECT state-
ment is inserted inside...
... parentheses on the
CREATE
PROCEDURE
line. Then each SQL statement listed between the BEGIN and END keywords
must have a semicolon at the end of the statement. The dollars signs are written after the
END
keyword ... a
specification
and a
body.
The specification component specifies how to communicate with the body
component. The body component contains the SQL statements,...
... consisting of the first line, indicates that the update is to be done on
the Customers table.
The second section of the statement specifies how the State column is to be
updated. The update is ... indexes.
Data Definition Language
Way back in Chapter 1, we mentioned that there are three main components of
the SQL language: DML (Data Manipulation Language) , DDL (Data...