Hi, I'm looking into setting constraints with an sql query instead of visually in programs such as sqlYog. My question is what (if any) is the difference between doing: CREATE TABLE test ( test_name char(20), test_email varchar2(20), test_tel_no number(11), CONSTRAINT test_unique UNIQUE (test_name) ); Code (markup): and CREATE TABLE test ( test_name char(20) unique, test_email varchar2(20), test_tel_no number(11) ); Code (markup): Thanks
Both the syntax will add UNIQUE key on test_name field. You can use either of them. I would however suggest to use proper syntax of adding index.