[Go] mysql adds, modifies, and deletes columns. ALTERTABLE: add, modify, and delete table columns, constraints, and other table definitions. View column: desc table name; Modify Table Name: altertablet_bookrenametobbb; add column: altertable table name addcolumn column name varchar (30); delete column: altertable table name dropc
[Go] mysql adds, modifies, and deletes columns. Alter table: add, modify, and delete TABLE columns, constraints, and other TABLE definitions. View column: desc table name; Modify table Name: alter table t_book rename to bbb; add column: alter table name add column name varchar (30); delete column: alter table Name drop c
[Go] mysql adds, modifies, and deletes columns.
Alter table: add, modify, and delete TABLE columns, constraints, and other TABLE definitions.
- View column: desc table name;
- Alter table t_book rename to bbb;
- Add column: alter table name add column name varchar (30 );
- Delete column: alter table Name drop column name;
- Alter column name MySQL: alter table bbb change nnnnn hh int;
- Modify the column name SQLServer: exec sp_rename 't_ student. name', 'nn ', 'column ';
- Modify the column name Oracle: lter table bbb rename column nnnnn to hh int;
- Alter table t_book modify name varchar (22 );
Sp_rename: the built-in Stored Procedure of SQL Server, which is used to modify the table definition.
?
?
View constraints in MySQL, add constraints, delete constraints, add columns, Modify columns, and delete Columns
?
- View the table field information: desc table name;
- View All table information: show create table name;
- Add primary key constraint: alter table name add constraint primary key (for example, PK _ table name) primary key table name (primary key field );
- Add foreign key constraint: alter table from table add constraint foreign key (for example: FK _ slave table _ master table) foreign key from table (foreign key field) references primary table (primary key field );
- Delete primary key constraint: alter table Name drop primary key;
- Delete foreign key constraints: alter table Name drop foreign key (case sensitive );
- Alter table t_book rename to bbb;
- Add column: alter table name add column name varchar (30 );
- Delete column: alter table Name drop column name;
- Alter column name MySQL: alter table bbb change nnnnn hh int;
- Modify the column name SQLServer: exec sp_rename 't_ student. name', 'nn ', 'column ';
- Alter column name Oracle: alter table bbb rename column nnnnn to hh int;
- Alter table t_book modify name varchar (22 );
Sp_rename: the built-in Stored Procedure of SQL Server, which is used to modify the table definition.
The first floor fanjf queries the mysql table emp constraints 10 hours ago:
SELECT * FROM information_schema. 'table _ CONSTRAINTS 'a WHERE
A. TABLE_NAME = 'emp ';
Fanjf created the index 10 hours ago on the second floor:
Create table mm (m1 CHAR (10), m2 VARCHAR (10), n1 VARCHAR (10 ));
Create index my_mm_idx ON mm (m1 );
DESC mm; 3 floor fanjf 10 hours ago oracle bitmap index:
Bitmap index: a large amount of data is stored in a table, but the enumerated values of a field are few.
Create bitmap index bit_emp on emp (sex)