Quantcast
Channel: SQL Archives - SQL Authority with Pinal Dave
Viewing all articles
Browse latest Browse all 594

PostgreSQL – Storing Unicode Characters is Easy

$
0
0

One of the interesting features of PostgreSQL database is the ability to handle Unicode characters. In SQL Server, to store non-English characters, we need to use NVARCHAR or NCAHR data type. In PostgreSQL, the varchar data type itself will store both English and non-English characters.

PostgreSQL - Storing Unicode Characters is Easy unicodepostgresql

Let us explore this with the following example. Create a table in PostgreSQL database as shown below

CREATE TABLE TESTING1(COL VARCHAR(100))
INSERT INTO TESTING1 (COL)
SELECT 'ЯНВАРЬ'

The above example adds a string of Russian characters (It means January in English)

Now let us SELECT the column value and see what it returns

SELECT COL FROM TESTING1

The result is

PostgreSQL - Storing Unicode Characters is Easy pg_varchar_result

As you see, with just varchar data type, the PostgreSQL engine is able to store multi-language characters without any additional approaches

Also, read this post to know how to add multi-language characters in the SQL Server Engine SQL SERVER – Storing Data in Hindi, Chinese, Gujarati, and Tamil (or any other) Language in the Same Table

Let me know if any other Database Engine has this type of feature, I will be happy to learn from you and post on this blog with due credit to you.

Here are few of the blog post I wrote earlier about PostgreSQL.

Reference: Pinal Dave (https://blog.sqlauthority.com)

First appeared on PostgreSQL – Storing Unicode Characters is Easy


Viewing all articles
Browse latest Browse all 594

Trending Articles