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


Please Help Members By Posting Answers For Below Questions

What is dclgen in db2?

678


What is difference between alias and synonym in db2?

643


How does cobol compile db2 program?

608


Explain dclgen.

724


How will you return the number of records in table?

516






What does runstats do in db2?

607


Can you tell me how can you find out the # of rows updated after an update statement?

612


What is the maximum size of varchar data type in db2?

645


How do I start db2 in windows?

565


How do you eliminate duplicate values in db2?

686


How many types of page locks can be held in db2?

592


What is db2 bind process?

757


Which command is used to remove all rows from a table?

553


How do I connect my db2 database to ibm?

602


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.

2155