1. The construction of the table
create table table name (data type of a field [Column Properties], the second data type field [Column Properties], .........) [Table Type] [Table Character Set] [Note];
Note: MySQL command terminator is the semicolon ; .
1) Table name:
Table names can be specified in order to create a table called in a particular database db_name as db_name.tb_name,, if it is in the current database, db_name can be omitted, but with tb_name.
If you use the escape character in `mysql table and to avoid keyword conflicts mysql itself, it should have the database and table names are added`.
For example, `mydb`.`mytbl` is legal, but` mydb.mytbl` illegal.
Is ` MySQL's escape character , used to avoid column and table names and keyword conflicts mysql itself.
Some databases have a similar setup, but mysql using a `only. Which is usually used to describe the contents of the database names, table names, field names, not keywords.
For example, the SELECT * from `key` the WHERE table_name = 'key_name' ; which, mysql keyword is the key, if the column name is the key, then you need to escape it with` `.
Extended: strings need to use \ to escape the `, otherwise it will error prompt syntax error.
mysql -uUser -pPasswd -e "select * from table_name where \`key\` = 'name';"
2) common data types
https://www.cnblogs.com/-xlp/p/8617760.html
3) The column properties
mysql 6 columns attributes: null, not null, default, comment, primary key, unique key, auto_increment
https://blog.csdn.net/csxiaoyaojianxian/article/details/80793561
Some databases have a similar setup, but mysql using a `only. Which is usually used to describe the contents of the database names, table names, field names, not keywords.
For example, the SELECT * from `key` the WHERE table_name = 'key_name' ; which, mysql keyword is the key, if the column name is the key, then you need to escape it with` `.
Extended: strings need to use \ to escape the `, otherwise it will error prompt syntax error.
mysql -uUser -pPasswd -e "select * from table_name where \`key\` = 'name';"