If we have to use distinct entries in a specific column, then we use the command UNIQUE.
Here, we are using the command ‘CREATE TABLE’ in our example;
(NID integer Unique,
Here, the column NID has a distinct constraint. Due to this constrain, there is no chance of same entries. But we can not use this constraint for the columns related to names. The given table has three different rows.
1 James Sandy
2 Johnson Gina
3 Henry Ralph
When the given command will run;
Then the output will show us an error. The reason is that ‘2’ is used for another entry. So, it is impossible that any row of UNIQUE command can have a value which is present in any other row.
It is important to know that a column having primary key ought to be distinct. On the other hand, the column which has distinct value can or can not have primary key. Further on, many constraints related to UNIQUE command can be used.