How does MySQL dynamically add a pruning column field, as sql:
Dynamically add column fields:
ALERT TABLE table1 Add transactor varchar (a) not Null;
To delete a column field dynamically:
ALERT TABLE tablename drop column field_id;
To modify a column field dynamically:
ALERT TABLE table_name Change old_field_name new_field_name field_type;
Dynamically modifying table Structures
ALERT TABLE table_name MODIFY field_name Field_type
Add after creating table: ALTER TABLE tablename add ID int auto_increment PRIMARY key
Set the self-add field initial value: ALTER TABLE tablename auto_increment =x;
Set PRIMARY key: ALTER TABLE TableName add primary key (Field_name);
Creating a composite primary key: CREATE TABLE tablename (
Studentno int,
CourseID int,
score int,
primary KEY (Studentno,courseid);
Set composite PRIMARY key: ALTER TABLE TableName add PRIMARY key (column 1, column 2, column 3);
Renaming table: ALTER TABLE table_old_name rename Table_new_name;
Change the type of field: ALTER TABLE tablename modify Field_name Field_type;
Rename field: ALTER TABLE tablename change Old_field_name new_field_name new_field_type;
Delete field: ALTER TABLE tablename drop column field_name;
Add a new field: ALTER TABLE tablename add New_field_name field_type;
New field with default value of 0, Non-empty: ALTER TABLE tablename add New_field_name field_type NOT null default ' 0 ';
New field with default value of 0, Non-null, Tabelname, PRIMARY key: ALTER TABLE add New_field_name field_type default 0 NOT NULL auto_increment, add primary Key (New_field_name);
To modify a field type:
ALTER TABLE tablename change Filed_name filed_name new_type;