To create Unique Key or Primary Key for a given table you need to go the table definition. Right click on the table that you want to modify and add new key and select "Definition" option.
Fig 1: Table Definition OptionIn table definition window go to "Key Constraints" tab and click on Add button.
Fig 2: New Key Constraint Window
In New Key Constraints window specify constraint name or leave "Constraint Name" field as it is to system generated constraint name. Then select whether you want to specify unique key or primary for the table. In "Available Columns" box you will see all available columns in the table and you can select either one of them or more than one columns for composite key. Once you select column click on Add button at middle of the window to put them into "Selected Columns" box. You can change the order of columns if you have selected more than one column, by using Move Up or Move Down buttons. If everything completed click on OK button to add this constraints to the table. You can add more that one constraint for a given table as you wish. Also note that if the table is having conflicting data to create new key constraint, you might face issues while you creating these constraints. Then find the conflicting data set and correct them possible or remove them from table so that you are able to create new constraint successfully.
No comments:
Post a Comment