Can a primary key have null values? If we try to insert a
null value in a primary key column, will it work or give an
error code?
Answer Posted / satya prasad n
The PRIMARY KEY cannot be null. you can insert ZERO into
that but should not be null. It will throw an error if you
try to inserts a NULL.
Is This Answer Correct ? | 8 Yes | 4 No |
Post New Answer View All Answers
What is dclgen in db2?
What is difference between alias and synonym in db2?
How does cobol compile db2 program?
Explain dclgen.
How will you return the number of records in table?
What does runstats do in db2?
Can you tell me how can you find out the # of rows updated after an update statement?
What is the maximum size of varchar data type in db2?
How do I start db2 in windows?
How do you eliminate duplicate values in db2?
How many types of page locks can be held in db2?
What is db2 bind process?
Which command is used to remove all rows from a table?
How do I connect my db2 database to ibm?
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.