Home > Database > Mysql Tutorial > 再跟SQL谈一谈--高级篇(一)

再跟SQL谈一谈--高级篇(一)

WBOY
Release: 2016-06-07 17:38:59
Original
1107 people have browsed it

1. ① ② ③ ④ ⑤ 2. ① ② ③ ④ 3. 1.SELECT KEYWORD ①TOP 語法: SELECT TOP number|percent column_name FROM table_name number|percent:返回记录的个数或百分比,|:二选一。 column_name:列名,全部列用*、多个列用逗号隔开; 从Person表里选取头两

1.

  ①

  ②

  ③

  ④

  ⑤

2.

  ①

  ②

  ③

  ④

3.

1.SELECT KEYWORD

  ①TOP 語法: SELECT TOP number|percent column_name FROM table_name

                   number|percent:返回记录的个数或百分比,|:二选一。

                       column_name:列名,全部列用*、多个列用逗号隔开; 

       从“Person”表里选取头两条记录 ⇒ SELECT TOP 2 * FROM Person 

       从“Person”表里选取50%的记录 ⇒ SELECT TOP 50 PERCENT * FROM Person

  ②LIKE 語法: SELECT column_name FROM table_name WHERE column_name LIKE|NOT LIKE pattern

                       LIKE|NOT LIKE:筛选列中的指定模式,或筛选指定模式之外的列。

                        pattern:匹配列内容的指定模式。

                           ⇒% :替代一个或多个字符   例: abc%  以abc为开头的内容   如:abcd   abcde   abcec  abc

                                                                    %abc  以abc为结尾的内容   如:daabc   ddabc   abc

                           ⇒_ : 仅替代一个字符   例: ab_  以ab开头加任一字符的内容   如:abc  abd  abg

                                                               _bc  第一个字符之后是以bc结尾的内容  如:abc  hbc nbc

                           ⇒[charlist] : 字符列中的任何单一字符   例: _[abc]   两个字符,第一个字符之后是abc其中一个字符的内容   如:db da  hc ja

                                                                                   [abc]_    两个字符,,第一个字符是abc中的一个后续接任一字符的内容   如:ad  an  bd  ca

                                                                                   [abc]__  三个字符,第一个字符是abc中的一个后续接任意两个字符的内容   如:add  and  bod  cad

                                                                                   %[abc]   以abc任一字符结尾的内容   如:asdfa  qwerb  zxcvc

                                                                                   [abc]%   以abc任一字符开头的内容   如:azxcv basdf  cqwere

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template