tailieunhanh - Sams Teach Yourself Database Programming with Visual C++ 6 in 21 Days phần 2

Có những hạn chế trên các thông số cho một lớp thuộc tính. Bạn có thể sử dụng các loại đơn giản, chẳng hạn như bool, byte, char, ngắn, int, float, dài, và tăng gấp đôi. Ngoài ra, bạn có thể sử dụng chuỗi, , và enum. Một thông số cũng có thể được định nghĩa như là một mảng một chiều, miễn là | Teach Yourself Database Programming with Visual C 6 in 21 days -- Day 3-Retrieving Data Through Structured Query Language SQL The easiest way to create this new query is to open a new query window to the Customers table. Press the SQL buSimpoPDF Merge andSplit UnregisterecnVersion -Chttp WHERE clause so the query looks like the following SELECT Customers . FROM Customers WHERE custnumber IN Then select the text of the orders query copy it to the Clipboard and paste it inside the parentheses at the end of the WHERE clause in the customers query like this SELECT Customers . FROM Customers WHERE custnumber IN SELECT Orders .customernumber FROM Orders WHERE OrderDate d 1998-11-11 When you run the query you can see in Figure that two customers have placed orders since November 11 1998. The code you would have to write in C to retrieve this same information from a binary data file or even from a record manager is considerably more complex. SQL is made to work with data and that is where it excels. Figure The customers with orders since November 11 1998. Another helpful query to learn is which order in the database is the most recent order. One way to find this is to select all the orders and include an ORDER BY OrderDate DESC clause. SELECT Orders . FROM Orders ORDER BY orderdate DESC The first record is the most recent order. Another way to find the most recent order is to ask the database for the order in which the date is equal to the maximum date in the table. Asking for the maximum date in the table is easy. You do it like this SELECT MAX orderdate FROM Orders MAX is an aggregate function meaning that it operates on multiple records but returns a single value. You can embed this SQL statement as a subquery in another SELECT statement to find the most recent order see Figure . Figure The most recent order. You can also perform a join with the Customers table to find the customer who placed the most recent order. http .