Languages
[Edit]
EN

PostgreSQL - make column values unique

0 points
Created by:
Tehya-Blanchard
474

In this article, we would like to show you how to make column values unique in PostgreSQL.

Quick solution:

or

Practical example

Edit

To show how to make column values unique, we will use the following table:

PostgreSQL - example data used to make column values unique
PostgreSQL - example data used to make column values unique

Example 1 - make single column unique

Edit

In this example, we will make name column unique.

Query:

Result:

Using query

PostgreSQL - make column value unique - result
PostgreSQL - make column value unique - result

Using HeidiSQL

PostgreSQL - make column value unique - result 
PostgreSQL - make column value unique - result

Example 2 - make multiple columns unique

Edit

In this example, we will make name and country columns unique.

Query:

Result:

Using query

PostgreSQL - make multiple column values unique - result
PostgreSQL - make multiple column values unique - result 

Using HeidiSQL:

PostgreSQL - make multiple column values unique - result
PostgreSQL - make multiple column values unique - result 
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

PostgreSQL - problems

PostgreSQL - make column values unique
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join