--CREATE database Db_std_mgr_sys; UseDb_std_mgr_sys;Create TableStudent (std_idbigint not NULLAuto_increment,std_namevarchar(Ten) not NULL default "', Std_codevarchar( -) not NULL default "'Comment'study number, the value is unique', Std_sexvarchar(8) not NULL default "', Std_phonevarchar( -) not NULL default "', school_idbigint not NULL default -1Comment'Your School ID', grade_idBIGINT not NULL default -1Comment'your Grade ID', cls_idbigint not NULL default -1Comment'Your class ID',Primary Key(std_id)) engine=Innodb,charset='UTF8', comment='Student Table';
Table II:
UseDb_std_mgr_sys;Create Table`User' (UIDbigint not NULLAuto_increment,usernamevarchar( -) not NULL, ' password 'varchar( +) not NULL, Phonevarchar( -) not NULL, emailvarchar( -) not NULL,Primary Key(UID),Unique Key(username),Unique Key(phone),Unique Key(email)) Engine=INNODB CharSet=Utf8
/* Note that there must be () behind the key and not directly the primary key UID, where the key is the index meaning,
And the front of the primary, unique is a modification, the primary key is also a kind of index, if only key is not decorated means that the index is a normal index;
If unique key uq_username (username), then the index is named Uq_username, otherwise the index name and the index column name is the same as username*/
Create a table with a primary key that automatically increments with a default value that is not an empty comment by sql