I ran the following SQL code
-- create a table
CREATE TABLE DEPT (
ID NUMBER(7) PRIMARY KEY,
NAME VARCHAR2(25)
);
-- -- insert some values
INSERT INTO DEPT (ID , NAME) VALUES (40, 'Sales') ;
ALTER TABLE DEPT ADD Manager_ID NUMBER(5) ;
ALTER TABLE DEPT ADD City VARCHAR2(30);
This works fine but when i try to add a unique constraint to the city column with the following command
ALTER TABLE DEPT
ADD CONSTRAINT UC_ffg UNIQUE(city);
I get the following error
1 near “CONSTRAINT”: syntax error
How can i add a unique constraint to a column