Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Char Function In Sql in SQL

Char Function In Sql in SQL

? CHAR() Function in SQL

The CHAR() function returns the character represented by the ASCII code (or Unicode code) number you provide.


? Syntax

CHAR(integer_code)
  • integer_code: An integer representing the ASCII/Unicode value.

  • Returns a single character string.


? Examples

1. Get character for ASCII code 65

SELECT CHAR(65);-- Returns 'A'

2. Get character for ASCII code 97

SELECT CHAR(97);-- Returns 'a'

3. Concatenate characters using ASCII codes

SELECT CONCAT(CHAR(72), CHAR(105));-- Returns 'Hi'

? Notes

  • CHAR() is available in many SQL dialects like MySQL, SQL Server, Oracle, etc.

  • In some databases, the function can take multiple codes to return a string (e.g., CHAR(72, 105) returns 'Hi' in SQL Server).

  • Useful when you want to insert special or non-printable characters by their ASCII codes.


Want me to explain the opposite function ASCII() that returns the ASCII code of a character?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql