Change table SQL

//Add a column as the primary key of the table
ALTER TABLE personal_views ADD views_id BIGINT AUTO_INCREMENT PRIMARY KEY;

//Modify a column as the primary key of the table
ALTER TABLE business_account ADD PRIMARY KEY(business_account_id);

//Modify the primary key of the table
ALTER TABLE personal_v_account CHANGE v_account_id v_account_id BIGINT PRIMARY KEY AUTO_INCREMENT;

//Add unique index
ALTER TABLE personal_views ADD UNIQUE uq_member_id(member_id);

//Add table field
ALTER TABLE business_account ADD business_account_id BIGINT;

//Modify data type
ALTER TABLE personal_views MODIFY member_id BIGINT;

//Delete index
ALTER TABLE business_account DROP INDEX member_id;

//Delete the primary key
ALTER TABLE business_account DROP PRIMARY KEY

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326926241&siteId=291194637