Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (41.79 KB, 3 trang )
Building Queries Using Enterprise Manager
You can build your own queries to examine rows in tables using Enterprise Manager. In
this section, you'll learn how to build and run a query to view the orders placed by the
customer with a CustomerID of ALFKI, along with the order details and products for the
order with an OrderID of 10643. Specifically, you'll be selecting the following columns:
•
The CustomerID and CompanyName columns from the Customers table
•
The OrderID and OrderDate columns from the Orders table
•
The ProductID and Quantity columns from the Order Details table
To start building the query, select the Customers table in Enterprise Manager from the
Tables node of the Databases folder for the Northwind database. Click the right mouse
button and select Open Table ➣ Query. This opens the query builder, as shown in Figure
2.18.
Figure 2.18: The query builder
The upper pane is called the Diagram Pane, and it shows the tables that are used in the
query. As you can see, the Customers table is initially shown in the Diagram Pane. The
pane below is called the Grid Pane, and it shows the details for the columns and rows to
be retrieved from the tables. Initially, all rows are to be retrieved from the Customers
table, as indicated by the asterisk (*) in the Grid Pane. Below the Grid Pane is the SQL
Pane, and it shows the SQL statement for the query.
Note SQL is a text-based language for accessing a database, and you'll learn all about
SQL in the next chapter
. For now, you can click the SQL button on the toolbar to
hide the SQL Pane-unless you want to view the SQL statement that is constructed
by the query builder.
Below the SQL Pane is the Results Pane, which shows any rows retrieved by the query.