TAILIEUCHUNG - Using SQL phần 2

Figure : Products where ProductName is like 'Cha%' The next SELECT statement uses the LIKE operator to retrieve products where the ProductName column | Figure Products where ProductName is like Cha The next SELECT statement uses the LIKE operator to retrieve products where the ProductName column is like ABC SELECT ProductID ProductName FROM Products WHERE ProductName LIKE ABC Figure shows the results of this SELECT statement. LIKE ABC matches products with a name that starts with any of the letters A B or C and ends with any number of characters. Figure Products where ProductName is like ABC The next SELECT statement uses the LIKE operator to retrieve products where the ProductName column is like AABC SELECT ProductID ProductName FROM Products WHERE ProductName LIKE AABC Figure shows the results of this SELECT statement. LIKE AABC matches products with names that don t start with any of the letters A B or C and end with any number of characters. Figure Products where ProductName is like AABC The next SELECT statement uses the LIKE operator to retrieve products where the ProductName column is like A-E SELECT ProductID ProductName FROM Products WHERE ProductName LIKE A-E Figure shows the results of this SELECT statement. LIKE A-E matches products with names that start with any of the letters A through E and end with any number of characters. Figure Products where ProductName is like A-E Specifying a List of Values You use the IN operator in a WHERE clause to retrieve rows with columns that contain values in a specified list. For example the following SELECT statement uses the IN operator to retrieve products with a ProductID of 1 2 5 15 20 45 or 50 SELECT ProductID ProductName QuantityPerUnit UnitPrice FROM Products WHERE ProductID IN 1 2 5 15 20 45 50 Here s another example that displays the OrderID column from the Orders table for the rows where the CustomerID column is in the list retrieved by a subquery the subquery retrieves the CustomerID column from the Customers table where the CompanyName is like Fu SELECT OrderID FROM Orders WHERE CustomerID IN SELECT CustomerID FROM Customers .

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.