TAILIEUCHUNG - Joe Celko s SQL for Smarties - Advanced SQL Programming P21

Joe Celko s SQL for Smarties - Advanced SQL Programming P21. In the SQL database community, Joe Celko is a well-known columnist and purveyor of valuable insights. In Joe Celko's SQL for Smarties: Advanced SQL Programming, he picks up where basic SQL training and experience leaves many database professionals and offers tips, techniques, and explanations that help readers extend their capabilities to top-tier SQL programming. Although Celko denies that the book is about database theory, he nevertheless alludes to theory often to buttress his practical points. This title is not for novices, as the author points out. Instead, its intended audience. | 172 CHAPTER 5 CHARACTER DATA TYPES IN SQL Problems of String Grouping Because the equality test has to pad out the shorter of the two strings you will often find doing a group by on a VARCHAR n has unpredictable results CREATE TABLE Foobar x VARCHAR 5 NOT NULL INSERT INTO Foobar VALUES a a a a Now execute the query SELECT x CHAR_LENGTH x FROM Foobar GROUP BY x The value for CHAR_LENGTH x will vary for different products. The most common answers are 1 4 or 5 in this example. A length of 1 is returned because it is the length of the shortest string or because it is the length of the first string physically in the table. A length of 4 is returned because it is the length of the longest string in the table and a length of 5 because it is the greatest possible length of a string in the table. You might want to add a constraint that makes sure to trim the trailing blanks to avoid problems. Standard String Functions SQL-92 defines a set of string functions that appear in most products but with vendor-specific syntax. You will probably find that products will continue to support their own syntax but will also add the Standard SQL syntax in new releases. String concatenation is shown with the operator taken from PL I. The SUBSTRING string FROM start FOR length function uses three arguments the source string the starting position of the substring and the length of the substring to be extracted. Truncation occurs when the implied starting and ending positions are not both within the given string. DB2 and other products have a left and a right function. The LEFT function returns a string consisting of the specified number of leftmost characters of the string expression and the right well that is kind of obvious. O Standard String Functions 173 The fold functions are a pair of functions for converting all the lowercase characters in a given string to uppercase UPPER string or all the uppercase ones to lowercase LOWER string . TRIM trim specification trim character

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.