Fixing `PRIMARY_KEY` `NULL` constraint (#4465)

pull/4408/head^2
Akash Sharma 1 year ago committed by GitHub
parent b565ce9bce
commit 79a656e171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/data/roadmaps/sql/content/105-data-constraints/102-unique.md

@ -2,7 +2,7 @@
The `UNIQUE` constraint ensures that all values in a column are different; that is, each value in the column should occur only once. The `UNIQUE` constraint ensures that all values in a column are different; that is, each value in the column should occur only once.
Both the `UNIQUE` and `PRIMARY KEY` constraints provide a guarantee for uniqueness for a column or set of columns. However, a primary key can contain only `NULL`, and each table can have only one primary key. On the other hand, a `UNIQUE` constraint allows for one `NULL` value, and a table can have multiple `UNIQUE` constraints. Both the `UNIQUE` and `PRIMARY KEY` constraints provide a guarantee for uniqueness for a column or set of columns. However, a primary key cannot contain `NULL` since it uniquely identifies each row, and each table can have only one primary key. On the other hand, a `UNIQUE` constraint allows for one `NULL` value, and a table can have multiple `UNIQUE` constraints.
## Syntax ## Syntax
```sql ```sql
@ -51,4 +51,4 @@ ALTER TABLE table_name
DROP CONSTRAINT constraint_name; DROP CONSTRAINT constraint_name;
``` ```
Here, `constraint_name` is the name of the `UNIQUE` constraint that you want to drop. Here, `constraint_name` is the name of the `UNIQUE` constraint that you want to drop.

Loading…
Cancel
Save