|
The SQL syntax for ALTER TABLE Drop Constraint is
ALTER TABLE "table_name"
DROP [CONSTRAINT|INDEX] "CONSTRAINT_NAME"
Let's look at the example. Assuming our starting point is the "customer" table created in the CREATE TABLE section:
Table customer
| Column Name | Data Type |
| First_Name | char(50) |
| Last_Name | char(50) |
| Address | char(50) |
| City | char(50) |
| Country | char(25) |
| Birth_Date | date |
Assume we want to drop the UNIQUE constraint on the "Address" column. To do this, we type in the following:
MySQL:
ALTER TABLE customer DROP INDEX con_first;
Note that MySQL uses DROP INDEX for index-type constraints such as UNIQUE. con_first is the name of the constraint.
Oracle:
ALTER TABLE customer DROP CONSTRAINT con_first;
SQL Server:
ALTER TABLE customer DROP CONSTRAINT con_first;
SQL DROP TABLE >>
Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.
Copyright 2010 1keydata.com. All Rights Reserved. Privacy Policy
|