Common MySQL skills: bitsCN.com
Common MySQL skills regular expression -- whether to start with a select 'abcdefg' REGEXP '^ a' -- whether to end with fg select 'abcdefg' REGEXP 'fg $' -- wow, select STAFF_Name, STAFF_NAME REGEXP '^ Test' from g_staffselect STAFF_Name from g_staff where STAFF_NAME REGEXP '^ Liu' = 1 --". "match any single character select 'abcdefg' REGEXP '. h', 'abcdefg' REGEXP '. g' -- "[...] "match any character in the brackets select 'abcdefg' regexp '[weh] 'select' abcdefg' REGEXP' ^ [ead] '--" [^...] "match any character in the brackets select 'e Fg 'regexp '[^ XYZ]', 'X' REGEXP '[^ XYZ] 'select * from user where email REGEXP' @ 163.com$ 'use rand () extract random rows -- select * from tf_f_user order by rand () limit 5 with rollup bit_or bit_and with group, the case sensitivity of databases and table names is always used to create and reference database names and table names in lower case or in upper case. MySQL uses the case sensitivity rules for database names, table names, column names, and alias names in Linux. of: 1. the database name and table name are case sensitive. 2. the table alias is case sensitive; 3. column names and column aliases are case-insensitive in all cases; 4. variable names are case-sensitive; MySQL is case-insensitive in Windows. Example 1: Ubuntu is used as an example. After mysql is installed in Ubuntu, the default value is: case-sensitive for table names, not case-sensitive for column names. 2. after logging on with the root account, in/etc/mysql/my. add lower_case_table_names = 1 after [mysqld] in cnf and restart the MYSQL service. The settings are successful: case insensitive to table names; lower_case_table_names parameter description: lower_case_table_names = 0 0: case Sensitive, 1: case insensitive ------------------------------------------------------------------------------ ---------------------- 3. if you want to query the case sensitivity of the time zone field value, you must set the BINARY attribute for the field value. you can set multiple methods: A. set at creation: create table t (a varchar (10) BINARY); B. use alter to MODIFY: ALTER TABLE 'tablename' MODIFY COLUMN 'cloname' VARCHAR (45) BINARY; c. select BINARY in mysql table editor. Note: In mysql, the InnoDB storage engine supports checking the constraints of external keywords. For tables of other storage engines, you can use reference when using the reference table_name (colomn_name) clause to define columns, but this clause has no practical effect, only serves as a memo or watch to remind the user to execute one column in another table as the column currently being defined. Author bengdabitsCN.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service