美文网首页
mysql英文参考手册some keys

mysql英文参考手册some keys

作者: lukexw | 来源:发表于2016-10-21 20:53 被阅读21次

    MySQL参考手册版本:refman-5.6-en.a4.pdf
    下载地址:http://dev.mysql.com/doc/index-archive.html

    • Options on the command line take precedence over values specified in option files and environmentvariables, and values in option files take precedence over values in environment variables. [2.12]
    • On character type columns, sorting—like all other comparison operations—is normally performed in a case-insensitive fashion.This means that the order is undefined for columns that are identical except for their case. You can force a case-sensitive sort for a column by using BINARY like so: ORDER BY BINARY col_name. [3.3.4.4]
      简译:对于字符型列来说,排序是不区分大小写的。如果想让字符型列排序区分大小写可以使用BINARY,如:ORDER BY BINARY col_name
    • TIMESTAMPDIFF(YEAR,birth,CURDATE()) as age =》计算年龄
    • MONTH(birth) = MOD(MONTH(CURDATE()), 12) + 1;=》选择得到生日在下个月。MOD()进行取模运算[3.3.4.6]
    • You cannot use arithmetic comparison operators such as =, <, or <> to test for NULL. [3.3.4.6] =>计算符号对NULL是没有任何意义的
    • In MySQL, 0 or NULL means false and anything else means true. The default truth value from a boolean operation is 1. =》在MySQL中,0或者NULL都是false的意思,其他的则为true。从bool运算中得到true值是用1表示
    • Two NULL values are regarded as equal in a GROUP BY.
    • When doing an ORDER BY, NULL values are presented first if you do ORDER BY ... ASC and last if you do ORDER BY ... DESC.
    • A common error when working with NULL is to assume that it is not possible to insert a zero or an empty string into a column defined as NOT NULL, but this is not the case. =》使用NULL一个常见的错误就是以为对声明为NOT NULL的列不能插入0或者空字符串,其实是可以的。
    • SQL pattern matching enables you to use “_” to match any single character and “%” to match an arbitrary number of characters (including zero characters).=>SQL正则表达式允许使用"_"来匹配任意单个字符,使用“%”来匹配任意个数字符,包括0个。[3.3.4.7]
    • In MySQL, SQL patterns are caseinsensitive by default.=》MySQL中正则表达式对大小写并不敏感。
    • SELECT * FROM pet WHERE name REGEXP '^b';
    • If you really want to force a REGEXP comparison to be case sensitive, use the BINARY keyword to make one of the strings a binary string.SELECT * FROM pet WHERE name REGEXP BINARY '^b';
    • If you want to get the interactive output format in batch mode, use mysql -t. To echo to the output the statements that are executed, use mysql -v. =》如果想在批处理模式也就是source file这种模式下的输出和登录MySQL的输出一样是表状的,那么就是用mysql -t选项。如果你想同时在输出时同时打印执行的sql,使用-v选项。
    • MySQL does not perform any sort of CHECK to make sure that col_name actually exists in tbl_name (or even that tbl_name itself exists).[3.6.6]=>MySQL的references tbl_name(col_name)语法不会做任何col_name是否存在的检查,即使tal_name是存在的。这里只是说references这个语法,并不是说创建外键时不检查目标表和目标列的存在.
    • When you insert any other value into an AUTO_INCREMENT column, the column is set to that value and the sequence is reset so that the next automatically generated value follows sequentially from the largest column value.
    • For a multiple-row insert, LAST_INSERT_ID() and mysql_insert_id() actually return the AUTO_INCREMENT key from the first of the inserted rows.
    • --column-names option that determines whether or not to display a row of columnnames at the beginning of query results. [4.2.5 ] =>这样子来说的话,--column-names这个参数在用来执行select一个表数据时还是蛮好用的。因为默认是会把列名一起导出来的
    #enalbled
    --disable-column-names
    --skip-column-names
    --column-names=0 
    #disabled
    --column-names
    --enable-column-names
    --column-names=1 
    
    • A MySQL program started with the --no-defaults option reads no optionfiles other than .mylogin.cnf [4.2.6 ]
    • !include directives in option files to include other option files and !includedir to search specific directories for option files. **Any files to be found and included using the !includedir directive on Unixoperating systems must have file names ending in .cnf. **
    !include /home/mydir/myopt.cnf 
    !includedir /home/mydir 
    

    相关文章

      网友评论

          本文标题:mysql英文参考手册some keys

          本文链接:https://www.haomeiwen.com/subject/trhcuttx.html