Java Reference
In-Depth Information
DROP INDEX MEMBER_PROFILES.STATE_INDEX;
Notice how the name of the index has to be fully defined by prefixing it with the name
of the table to which it applies.
Formatting SQL Commands
The SQL engine ignores excess whitespace, so you can and should insert line breaks
for clarity. Conventionally major clauses such as the FROM clause and the WHERE
clause are placed on their own lines, unless the command is so brief as to be trivial. A
good basic approach when you are not quite sure how to format a command is to go
for readability.
Key words, table names, and column names are not case-sensitive, but the contents
of the records within a table are case-sensitive. This means that with a little thought,
you can use case to help make your SQL statements more readable.
Although SQL ignores case in commands, table names, column
names, and so on, case can matter when you are using a name in a
WHERE clause, so 'Corleone' and 'CORLEONE' are not necessarily
the same.
Caution
Using SQL Joins
Recall that the information in a practical database is usually distributed across several
different tables, each of which contains sets of logically related data. The example
introduced in Chapter 1 represents a typical database containing the four following
tables:
 
Customers contains customer number, name, shipping address, and billing information.
 
Inventory contains item number, name, description, cost, and quantity on hand.
 
Orders contains order number, customer number, order date, and ship date.
 
Ordered_Items contains order number, item number, and quantity.
When a customer places an order, an entry is made in the Orders Table, assigning an
order number and containing the customer number and the order date. Then entries
are added to the Ordered_Items Table, recording order number, item number and
quantity. To fill a customer order, combine the necessary information from each of
these tables.
A few rows of each of these tables are shown in Tables 3-10 through 3-13 .
Table 3-10: Customer Table
Customer_Number First_Name MI
Last_Name Street
City
S tate
Zip
 
Search WWH ::




Custom Search