TAILIEUCHUNG - SQL VISUAL QUICKSTART GUIDE- P14

SQL VISUAL QUICKSTART GUIDE- P14:SQL (pronounced es-kyoo-el) is the standard programming language for creating, updating, and retrieving information that is stored in databases. With SQL, you can turn your ordinary questions (“Where do our customers live?”) into statements that your database system can understand (SELECT DISTINCT city, state FROM customers;) | Chapter 4 Dissecting WHERE Clauses If your WHERE clause isn t working you can debug it by displaying the result of each condition individually. To see the result of each comparison in Listing for example put each comparison expression in the SELECT clause s output column list along with the values you re comparing SELECT type type history AS Hist type biography AS Bio price price 20 AS 20 FROM titles This query runs on Microsoft Access MySQL and PostgreSQL. If your DBMS interprets the symbol as an assignment operator rather than as a comparison operator you must substitute equivalent expressions for the logical comparisons. In Oracle for example you can replace type history with INSTR type history . The query s result is Dissecting WHERE Clauses type Hist Bio price 20 history 1 0 0 history 1 0 1 computer 0 0 0 psychology 0 0 1 psychology 0 0 1 biography 0 1 1 biography 0 1 0 children 0 0 1 children 0 0 1 biography 0 1 NULL NULL psychology 0 0 1 biography 0 1 1 history 1 0 0 The comparison columns display zero if the comparison is false nonzero if it s true or null if it s unknown. 110 Retrieving Data from a Table Tips The examples in this section show the AND OR and NOT operators used with comparison conditions but these operators can be used with any type of condition. If your search condition contains only AND operators your query will run faster if you put the conditions least likely to be true first. If col1 A is less likely than col2 B then WHERE col1 A AND col2 B is faster than WHERE col2 B AND col1 A because the DBMS won t bother to evaluate the second expression if the first is false. For search conditions that contain only OR operators do the reverse Put the most likely conditions first. If the conditions are equally likely put the least complex expression first. This logic depends on your DBMS s optimizer reading WHERE clauses from left to right which most do. Oracle s cost-based .

TỪ KHÓA LIÊN QUAN
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.