I'm attempting to understand unique id and primary key. Here is my understanding so far: Unique id, when applied to a column, states that no two rows can have the same data.
Primary key, when applied to a column, uniquely identifies every row. This means that the data in each row in the primary key column is unique. Thus, the primary key column is also a unique column, correct?
First, is my above understanding correct? Assuming I am, then is it required to explicity declare the primary key column as having a unique id when creating a table?
So if my primary key column was 'col1', would I have to add 'Unique id(col1)' when I declare the table?
Please clear this up as best as possible.
Thanks
Prasanna
Primary key, when applied to a column, uniquely identifies every row. This means that the data in each row in the primary key column is unique. Thus, the primary key column is also a unique column, correct?
First, is my above understanding correct? Assuming I am, then is it required to explicity declare the primary key column as having a unique id when creating a table?
So if my primary key column was 'col1', would I have to add 'Unique id(col1)' when I declare the table?
Please clear this up as best as possible.
Thanks
Prasanna