TAILIEUCHUNG - The Language of SQL- P20

The Language of SQL- P20: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. | The IN Operator 81 or you can use this equivalent statement that utilizes the IN operator SELECT CustomerName State FROM Orders WHERE State IN IL NY In either case the data retrieved is CustomerName State William Smith IL Brenda Harper NY Notice that commas are used to separate all values within the parentheses following the IN keyword. The usefulness of the IN operator may not be obvious in this example where only two states are listed. However the IN can just as easily be used in situations where you want to list dozens of specific values. This greatly reduces the amount of typing required for such a statement. Another handy use for the IN operator comes in situations where you want to use data from Excel in a SQL statement. If you want to obtain multiple values from adjacent cells in a spreadsheet for your SQL statement Excel allows you to copy those values with a comma delimiter. This result can then be pasted inside the parentheses following the IN operator. As with the BETWEEN operator the NOT operator can be used with the IN as shown in this example SELECT CustomerName State FROM Orders WHERE State NOT IN IL NY This retrieves this data CustomerName State Natalie Lopez CA 82 Chapter 8 Boolean Logic One final note about the IN operator. There is a second way to use the IN which is substantially different from the syntax just discussed. In the second format of the IN operator an entire SELECT statement is specified within the parentheses allowing the individual values to be created logically when needed. This is called a subquery and it will be covered in detail in Chapter 14. Boolean Logic and NULL Values At the start of this chapter I stated that the Boolean logic in SQL evaluates complex expressions as either true or false. This assertion was not completely correct. When evaluating the conditions in a WHERE clause there are actually three possibilities true false and unknown. The possibility of unknown derives from the fact that columns in SQL databases are

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.