mysql表属性、索引、约束
时间:2021-07-01 10:21:17
帮助过:2人阅读
create table item_properties_table(
-> id
int auto_increment
primary key,
-> name
varchar(
20)
not null unique key,
-> pwd
varchar(
48)
not null,
-> age
tinyint default 18,
-> email
varchar(
50) comment
‘电子邮件‘
-> );
Query OK, 0 rows affected (
0.02 sec)
/*查看表结构,主要是为了查看comment*/
mysql> show
full columns
from item_properties_table;
+-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+--------------+
| Field
| Type
| Collation
| Null | Key | Default | Extra
| Privileges | Comment
|
+-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+--------------+
| id
| int(
11)
| NULL | NO
| PRI
| NULL | auto_increment
| select,
insert,
update,
references | |
| name
| varchar(
20)
| utf8_general_ci
| NO
| UNI
| NULL | | select,
insert,
update,
references | |
| pwd
| varchar(
48)
| utf8_general_ci
| NO
| | NULL | | select,
insert,
update,
references | |
| age
| tinyint(
4)
| NULL | YES
| | 18 | | select,
insert,
update,
references | |
| email
| varchar(
50)
| utf8_general_ci
| YES
| | NULL | | select,
insert,
update,
references | 电子邮件
|
+-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+--------------+
5 rows
in set (
0.00 sec)
mysql>
2、索引
mysql表属性、索引、约束
标签: