Đang chuẩn bị liên kết để tải về tài liệu:
Beginning VB 2008 Databases From Novice to Professional phần 3

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Microsoft NET Framework phiên bản và Bit xanh và hội Bit Red Mô hình Như đã đề cập trong Chương 1, Visual Studio 2008 hỗ trợ nhiều phiên bản. NET Framework. Để đảm bảo khả năng tương thích này, Visual Studio 2008 có cài đặt NET 2.0 và NET 3.0 cùng với. NET 3.5. Điều hướng đến C: Framework \ \ WINDOWS \ Microsoft.NET, và bạn sẽ thấy các thư mục cá nhân cho mỗi | Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com CHAPTER 4 WRITING DATABASE QUERIES 59 Figure 4-16. Using correlation names How It Works You simplify the table references by providing a correlation name for each table. This is somewhat similar to providing column aliases but correlation names are intended to be used as alternative names for tables. Column aliases are used more for labeling than for referencing columns. You can now refer to Orders as o and to Employees as e. Correlation names can be as long as table names and can be in mixed case but obviously the shorter they are the easier they are to code. You use the correlation names in both the SELECT list select o.orderid o.customerid e.lastname and the ON clause on o.employeeid e.employeeid Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com 60 CHAPTER 4 WRITING DATABASE QUERIES Try It Out Writing an Inner Join of Three Tables Open a New Query window in SSMSE remember to make Northwind your query context . Enter the following query and click Execute. You should see the results shown in Figure 4-17. select o.orderid OrderID c.companyname CustomerName e.lastname Employee from orders o inner join employees e on o.employeeid e.employeeid inner join customers c on o.customerid c.customerid Figure 4-17. Coding an INNER JOIN of three tables How It Works First you modify the SELECT list replacing CustomerID from the Orders table with CompanyName from the Customers table select o.orderid OrderID c.companyname CustomerName e.lastname Employee Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com CHAPTER 4 WRITING DATABASE QUERIES 61 Second you add a second inner join as always with two operands the table produced by the first join and the base table Customers. You reformat the first JOIN operator splitting it across three lines simply to make it easier to distinguish the tables and joins. You can also use parentheses to enclose joins and you can make them .