Information Technology Reference
In-Depth Information
Figure 5.13
Query by Example
Some databases use Query-by-
Example (QBE) to generate reports
and information.
Table 5.6
SQL Command
Description
Examples of SQL Commands
SELECT ClientName, Debt FROM
Client WHERE Debt > 1000
This query displays all clients (ClientName)
and the amount they owe the company (Debt)
from a database table called Client for clients
who owe the company more than $1,000
(WHERE Debt > 1000).
SELECT ClientName, ClientNum,
OrderNum FROM Client, Order WHERE
Client.ClientNum=Order.ClientNum
This command is an example of a join
command that combines data from two tables:
the client table and the order table
(FROM Client, Order). The command creates a
new table with the client name, client number,
and order number (SELECT ClientName,
ClientNum, OrderNum). Both tables include
the client number, which allows them to be
joined. This is indicated in the WHERE clause,
which states that the client number in the
client table is the same as (equal to) the client
number in the order table (WHERE Client.Client
Num= Order.ClientNum).
This command is an example of a security
command. It allows Bob Guthrie to insert new
values or rows into the Client table.
GRANT INSERT ON Client to Guthrie
SQL lets programmers learn one powerful query language and use it on systems ranging
from PCs to the largest mainframe computers (see Figure 5.14). Programmers and database
 
 
Search WWH ::




Custom Search