What is the difference between primary key & unique index ?
Answer Posted / uddipto banerji
1. Primary Key is a column or a set of columns that uniquely identifies a row.Its purpose RECORD UNIQUENESS
2. Primary Key will not allow duplicate values.
3. Primary Key will not allow null.
4. Primary Key is not compulsory but recommended.
5. Primary Key helps to identify one record from another.
6. Only One Primary Key is allowed per table.
7. Unique Indexes is created automatically if there is Primary Key.
8. One table can combine upto 16 columns in a Composite Primary Key.
9. A table can have more than one Unique Key which is not possible in a Primary Key.
| Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one variable at a time, SELECT can make multiple assignments at once. If assigning from a query, SET can only assign a scalar value. If the query returns multiple values/rows then SET will raise an error. SELECT will assign one of the values to the variable and hide the fact that multiple values were returned (so you'd likely never know why something was going wrong elsewhere - have fun troubleshooting that one) When assigning from a query if there is no value returned then SET will assign NULL, where SELECT will not make the assignment at all (so the variable will not be changed from it's previous value) As far as speed differences - there are no direct differences between SET and SELECT. However SELECT's ability to make multiple assignments in one shot does give it a slight speed advantage over SET.
What does runstats do in db2?
What is a page in db2?
What is nvl in db2?
Why do we need reorg in db2?
How can you quickly find out the # of rows updated after an update statement?
What is database manager in db2?
Is it possible using max on a char column?
How to find primary key of a table in db2?
How many databases are there?
What is the use of db2 optimizer?
What are foreign keys in db2?
How can we read records for specific member in CL? AND rpg?
What is the physical storage length of timestamp data type?
What does db2 plan contain?