TAILIEUCHUNG - Learning SQL Second Edition phần 5

Trong Chương 4, tôi giới thiệu bạn với các loại khác nhau của các điều kiện lọc và cho thấy làm thế nào bạn có thể sử dụng chúng trong mệnh đề where. Khi nhóm dữ liệu, bạn cũng có thể áp dụng các điều kiện lọc dữ liệu sau khi các nhóm đã được tạo ra. Mệnh có là nơi bạn nên đặt các loại điều kiện lọc. Hãy xem xét ví dụ sau đây: | mysql INSERT INTO string_tbl vchar_fld VALUES abed J Query OK 1 row affected sec mysql INSERT INTO string_tbl vchar_fld VALUES xyz j Query OK Irowa-ffected mysql INSERTINTOstring -tbl vchar -f Ld VALUES QRSTUV j Query OK Irowa-ffected mysql INSERTINTOstring_tbb vchar_fld VALUES qrstuv j Query OK Irowa-ffected mysql INSERT INTOstr ing -tbb vchar -fld VALUES 12345 J Query OK Irowa-ffected Here are the fiveitringsintheib sorsorder mysql SELECTvcharfld - FROMstringtbb - ORDER BY vcharfldj I vchar_fld I I 12345 I abed I QRSTUV I qrstuv I xyz 5 rows in set The next query makes rrX comparisons among the five different strings mysql SELECTSTRCMP 12345 12345 12345_12345 - STRCMPCabed xyr jabsdxyz - STRCMP abed QRSTUV abcdQRSTUV - STRCMP qrstuv QRSTUV qrstuvQRSTUV - E 23 5 yz .12345_xyz - STRCMP xyz qrstuv xyz_qrstuvj I 12345_12345 abe Jxy ab dORSHJV qituvORSHJV 12345_xyz I xyz_qrstuv I 0 I -1 -n 0 I -1 1 I 1 row in set The first compyrisony ieldr 0 which istobeexpected since I compared a string to itself. The fourth comp a ns on els o plelps e i nisied is a brt I ittp rising I in ce th e I I tings e re composed of ths samelesrsrr withone string all uppercase and the other all lowercase. The reasonfoTthis reruUttsthauMySQL sstrvupO functioned uaRe-mshuriutvs which IS somethmgsoeememhrrwhenostng thefynrtioe. Theothesfoutcornparisoes yidd either -1 orr depsydengsnwhethes uh etiheutsrng RO mfebuSoteoT oftershe fecond string in snfS osdee. nO hoarnpUe Utmep ubcd tri yielUo sheusone abed comvsbefefethestring xez . Working with String Data I 121 Download at Along with the strcmpO function MySQL also allows you to use the like and regexp operators to compare strings in the select clause. Such comparisons will yield 1 for true or 0 for false . Therefore these operators allow you to build expressions that return a number much1ikerhe functions described inthis s anexample using like mysql rELECCname

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.