mysql 建立 刪除 索引和更改表

2021-06-10 19:28:58 字數 299 閱讀 2580

原:

primary key  (`imageid`),-本表的imageid作為主鍵 

key `categoryid` (`categoryid`),-本表的categoryid欄位與categoryid表categoryid欄位建立外來鍵 

key `userid` (`userid`)-本表的userid欄位與userid表userid欄位建立外來鍵 

key 'uerid'('userid'):括號外是建立外來鍵的對應表,括號內是對應字段

3.4 建立、刪除、索引和更改表

表的建立 更改和刪除

必須給出以下資訊 1 新錶的名字 2 表列的名字和定義,用逗號分隔 e.g.create table customers cust id int not null autoz increment,cust name char 50 not null primary key cust id engin...

mysql 建立索引和刪除索引

索引的建立可以在create table語句中進行,也可以單獨用create index或alter table來給表增加索引。刪除索引可以利用alter table或drop index語句來實現。1 使用alter table語句建立索引。語法如下 alter table table name ...

mysql 建立索引和刪除索引

索引的建立可以在create table語句中進行,也可以單獨用create index或alter table來給表增加索引。刪除索引可以利用alter table或drop index語句來實現。1 使用alter table語句建立索引。語法如下 alter table table name ...