TAILIEUCHUNG - SQL VISUAL QUICKSTART GUIDE- P17

SQL VISUAL QUICKSTART GUIDE- P17: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 5 Changing String Case Changing String Case with UPPERO and LOWER Use the function UPPERO to return a string with lowercase letters converted to uppercase and use the function LOWERO to return a string with uppercase letters converted to lowercase. The functions important characteristics are A cased character is a letter that can be lowercase a or uppercase A . Case changes affect only letters. Digits punctuation and whitespace are left unchanged. Case changes have no effect on empty strings . If its argument is null UPPERO and LOWERO return null. But see the Oracle exception in the DBMS Tip in this section. Case-Insensitive Comparisons In DBMSs that perform case-sensitive WHERE-clause comparisons by default UPPERO or LOWERO often is used to make case-insensitive comparisons WHERE UPPER au_fname JOHN If you re sure that your data are clean it s faster to look for only reasonable letter combinations than to use case functions WHERE au_fname JOHN OR au_fname John UPPERO and LOWERO affect characters with diacritical marks such as accents and umlauts UPPER o is 0 for example. If your data contain such characters and you re making case-insensitive comparisons such as WHERE UPPER au_fname JOSÉ make sure that your DBMS doesn t lose the marks on conversion. UPPER José should be JOSÉ not JOSE . See also Filtering Rows with WHERE in Chapter 4. 140 Operators and Functions Listing List the authors first names in lowercase and last names in uppercase. See Figure for the result. Listing SELECT LOWER au_fname AS Lower UPPER au_lname AS Upper FROM authors Lower Upper sarah BUCHMAN wendy HEYDEMARK hallie HULL klee HULL Christian KELLS KELLSEY paddy O FURNITURE Figure Result of Listing . Listing List the titles that contain the characters MO regardless of case. All the letters in the LIKE pattern must be uppercase for this query to work. See Figure for the result. Listing SELECT title_name FROM titles WHERE UPPER title_name LIKE MO title_name 200

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