TAILIEUCHUNG - The Language of SQL- P34

The Language of SQL- P34:Research has shown that, being pressed for time, most readers tend to skip the introduction of any book they happen to read and then proceed immediately to the first real chapter. With that fact firmly in mind, we will only cover relatively unimportant material in the introduction, such as an explanation of what you will and will not learn by reading this book. | Looking Ahead 151 WHERE AS Number of Orders FROM Customers ORDER BY Notice that in this case the subquery is a correlated subquery. The subquery is used as a calculated column in the SELECT columnlist. In other words after the subquery is evaluated it returns a single value which is then included in the columnlist. Here s a general format of the above statement SELECT CustomerName AS Customer Name SubqueryResult AS Number of Orders FROM Customers ORDER BY Looking Ahead In this chapter we ve seen subqueries used in three different ways as a data source in selection criteria and as a calculated column. We ve also seen examples of both correlated and uncorrelated subqueries. We ve really only touched on some of the uses and abuses of subqueries. What complicates the matter is that many subqueries can be expressed in other ways. Whether or not you choose to utilize subqueries depends on your personal taste and sometimes on the performance of the statement. In general SELECT statements with subqueries tend to run more slowly than an equivalent statement without a subquery. We ll leave it to more advanced SQL books to discuss the various advantages and disadvantages of using subqueries. Through our use of joins and subqueries we ve explored numerous ways to select data from multiple tables. In our next chapter Set Logic we re going to look at a way to combine entire queries into a single SQL statement. This is a special type of logic that allows us to merge multiple data sets into a single result. As will be seen set logic procedures are sometimes necessary in order to display sets of data that are only partially related to each other. As with subqueries the techniques of set logic provide additional flexibility and logical possibilities for your SQL statements. This page intentionally left blank CHAPTER 15 Set Logic Keywords Introduced UNION UNION ALL INTERSECT EXCEPT MINUS The various .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.