-
September 19th, 2022, 12:17 AM
#1
PRIMARY KEY vs. UNIQUE restrictions in MySQL
The distinction between a PRIMARY KEY constraint and a UNIQUE constraint, according to the MySQL documentation, is that a PK constraint does not permit NULL values whereas a UQ constraint does. One may generate both PK and UQ for the same column in a MySQL table!
What use does it serve to add a UNIQUE constraint to a column that already has a PK constraint?
Why won't MySQL let me add a unique constraint to a column with a PK constraint already?
Also, I want to ask according to internet definitions the join condition in equi join is equality (=), whereas inner join can contain additional operators such as less than () or larger than (>). A non-equi join is a sort of join in which the join condition does not employ equals. Does this imply that non-equi joins and inner joins are the same?
Last edited by 2kaud; December 17th, 2022 at 11:27 AM.
Reason: Web site reference removed
-
October 27th, 2022, 11:22 AM
#2
Re: PRIMARY KEY vs. UNIQUE restrictions in MySQL
In SQL language, NULL simply means "unknown value" or "not yet set value". Because a primary key is intended to (unique) identify a record in a table, a NULL PK has no sense, so is not permitted.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|