mysql> create table index_tab03( -> id int, -> col01 varchar(20), -> index index_01(col01) -> )engine=InnoDB default charset=utf8; Query OK, 0 rows affected (0.01 sec) mysql> desc index_tab03; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | col01 | varchar(20) | YES | MUL | NULL | | +-------+-------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql> show index from index_tab03\G *************************** 1. row *************************** Table: index_tab03 Non_unique: 1 Key_name: index_01 Seq_in_index: 1 Column_name: col01 Collation: A Cardinality: 0 Sub_part: NULL Packed: NULL Null: YES Index_type: BTREE Comment: 1 row in set (0.00 sec) m
mysql> alter table index_tab01 add primary key(id,col01); Query OK, 0 rows affected (0.01 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table index_tab01 add index indx_01(col01); Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table index_tab01 add fulltext indx_02(col01,col02(300)); ERROR 1214 (HY000): The used table type doesn't support FULLTEXT indexes mysql> alter table index_tab01 engine=MyISAM; Query OK, 0 rows affected (0.01 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table index_tab01 add fulltext index_02(col01,col02(30)); Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> show index from index_tab01\G *************************** 1. row *************************** Table: index_tab01 Non_unique: 0 Key_name: PRIMARY Seq_in_index: 1 Column_name: id Collation: A Cardinality: NULL Sub_part: NULL Packed: NULL Null: Index_type: BTREE Comment: *************************** 2. row *************************** Table: index_tab01 Non_unique: 0 Key_name: PRIMARY Seq_in_index: 2 Column_name: col01 Collation: A Cardinality: 0 Sub_part: NULL Packed: NULL Null: Index_type: BTREE Comment: *************************** 3. row *************************** Table: index_tab01 Non_unique: 0 Key_name: index_un Seq_in_index: 1 Column_name: col01 Collation: A Cardinality: 0 Sub_part: NULL Packed: NULL Null: Index_type: BTREE Comment: *************************** 4. row *************************** Table: index_tab01 Non_unique: 1 Key_name: indx_01 Seq_in_index: 1 Column_name: col01 Collation: A Cardinality: NULL Sub_part: NULL Packed: NULL Null: Index_type: BTREE Comment: *************************** 5. row *************************** Table: index_tab01 Non_unique: 1 Key_name: index_02 Seq_in_index: 1 Column_name: col01 Collation: NULL Cardinality: NULL Sub_part: NULL Packed: NULL Null: Index_type: FULLTEXT Comment: *************************** 6. row *************************** Table: index_tab01 Non_unique: 1 Key_name: index_02 Seq_in_index: 2 Column_name: col02 Collation: NULL Cardinality: NULL Sub_part: NULL Packed: NULL Null: YES Index_type: FULLTEXT Comment: 6 rows in set (0.00 sec)
mysql> alter table index_tab01 drop primary key; Query OK, 0 rows affected (0.01 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table index_tab01 drop index index_02; Query OK, 0 rows affected (0.01 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> drop index index_01 on index_tab01;
如对本文有疑问, 点击进行留言回复!!
MySQL-关系代数-并、交、差、等值连接、自然连接、左连接。。。
【MySQL牛客】10.获取所有非manager的员工emp_no
网友评论