I created a table in a MySQL database via the following:
CREATE TABLE `newsubscriptions_orderspecification` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`display_name` varchar(256) NOT NULL,
`sub_def_id` integer UNSIGNED NOT NULL,
`source_code_id` integer UNSIGNED NOT NULL,
`order_code_id` integer UNSIGNED NOT NULL,
`rate` numeric(5, 2) NOT NULL,
`type` varchar(4) NOT NULL,
`region` varchar(4) NOT NULL,
`term` varchar(4) NOT NULL,
`buyer_type` varchar(4) NOT NULL,
`is_active` bool NOT NULL,
UNIQUE (`sub_def_id`, `buyer_type`, `rate`, `is_active`)
)
;
How can I remove the uniqueness constraint?
Sometimes we want to add a unique key to the column of an existing table; then, this statement is used to add the unique key for that column. Following are the syntax of the ALTER TABLE statement to add a unique key: ALTER TABLE table_name ADD CONSTRAINT constraint_name UNIQUE(column_list);
You can drop a foreign key constraint using the following ALTER TABLE syntax: ALTER TABLE tbl_name DROP FOREIGN KEY fk_symbol; If the FOREIGN KEY clause defined a CONSTRAINT name when you created the constraint, you can refer to that name to drop the foreign key constraint.
To modify a unique constraintIn the Object Explorer, right-click the table containing the unique constraint and select Design. On the Table Designer menu, click Indexes/Keys.... In the Indexes/Keys dialog box, under Selected Primary/Unique Key or Index, select the constraint you wish to edit.
use this:
ALTER TABLE `newsubscriptions_orderspecification` DROP INDEX `sub_def_id`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With