TAILIEUCHUNG - SQL Clearly Explained- P4

SQL Clearly Explained- P4: You don’t need to be a database designer to use SQL successfully. However, you do need to know a bit about how relational databases are structured and how to manipulate those structures. | String Manipulation 149 includes rows for customers whose last names are made up of the characters S-M-I-T-H regardless of case. The UPPER function converts the data stored in the database to uppercase before making the comparison in the WHERE predicate. You obtain the same effect by using LOWER instead of UPPER. The TRIM function removes leading and or trailing characters TRIM from a string. The various syntaxes for this function and their effects are summarized in Table 6-2. You can place TRIM in any expression that contains a string. For example if you are using characters to store a serial number with leading 0s for example 0012 you can strip those 0s when performing a search SELECT item_description FROM items WHERE TRIM Leading 0 FROM item_numb 25 The SUBSTRING function extracts portions of a string. It has SUBSTRING the following general syntax SUBSTRING source_string FROM starting_posi-tion FOR number_of_characters Table 6-2 The various forms of the SQL TRIM function Function Result Comments TRIM word word Default removes both leading and trailing blanks TRIM BOTH FROM word word Removes leading and trailing blanks TRIM LEADING FROM word word Removes leading blanks TRIM TRAILING FROM word word Removes trailing blanks TRIM BOTH FROM word word Removes leading and trailing Please purchase PDF Split-Merge on to remove this watermark. 150 Chapter 6 Advanced Retrieval Operations Mixed versus Single Case in Stored Data There is always the temptation to require that text data be stored as all uppercase letters to avoid the need to use UPPER and LOWER in queries. For the most part this isn t a good idea. First text in all uppercase is difficult to read. Consider the following two lines of text WHICH CASE IS EASIER TO READ ALL CAPS OR MIXED Which case is easier to read All caps or mixed Our eyes have been trained to read mixed upper- and lowercase letters. In English for example we use letter case cues to locate the start of sentences and to identify .

TÀI LIỆU MỚI ĐĂNG
Đã 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.