TAILIEUCHUNG - SQL VISUAL QUICKSTART GUIDE- P18

SQL VISUAL QUICKSTART GUIDE- P18: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 Finding Substrings with POSITION To find a substring Type POSITION substring IN string substring is the string to search for and string is the string to search. Each argument is a string expression such as a column that contains character strings a string literal or the result of an operation or function that returns a string. POSITION returns the lowest integer position in string in which substring occurs or zero if substring isn t found Listings and Figures and . Listing List the position of the substring e in the authors first names and the position of the substring ma in the authors last names. See Figure for the result. Listing SELECT au_fname POSITION e IN au_fname AS Pos e au_lname POSITION ma IN au_lname AS Pos ma FROM authors Listing List the books whose titles contain the letter u somewhere within the first 10 characters sorted by descending position of the u. See Figure for the result. Listing SELECT title_name POSITION u IN title_name AS Pos FROM titles WHERE POSITION u IN title_name BETWEEN 1 AND 10 ORDER BY POSITION u IN title_name DESC au_fname Pos e au_lname Pos ma Sarah 0 Buchman 5 Wendy 2 Heydemark 6 Hallie 6 Hull 0 Klee 3 Hull 0 Christian 0 Kells 0 0 Kellsey 0 Paddy 0 O Furniture 0 Figure Result of Listing . title_name Pos Not Without My Faberge Egg 10 Spontaneous Not Annoying 10 How About Never 8 Ask Your System Administrator 7 But I Did It Unconsciously 2 Just Wait Until After School 2 Figure Result of Listing . 150 Operators and Functions Tips You can use POSITION in SELECT WHERE and ORDER BY clauses or anywhere an expression is allowed. The SQL standard also defines the function OVERLAY to replace substrings. The syntax is OVERLAY string PLACING substring FROM start_position FOR length For example OVERLAY Txxxxas PLACING horn FROM 2 FOR4 is Thomas . The equivalent functions in the DBMSs are REPLACE Microsoft Access Microsoft SQL Server DB2 and MySQL REGEXP_REPLACE Oracle and

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.