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.

Ascii Function In Sql in SQL

Ascii Function In Sql in SQL

? ASCII() Function in SQL

The ASCII() function in SQL returns the numeric ASCII code of the first character in a string.


? Syntax

ASCII(string)
  • string: A string expression.

  • Returns an integer (ASCII code of the first character).


? Example Queries

? 1. Single Character

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

? 2. String

SELECT ASCII('Hello');  -- Returns 72 (ASCII of 'H')

? 3. Lowercase Character

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

? 4. Special Character

SELECT ASCII('#');  -- Returns 35

? 5. Empty String

SELECT ASCII('');  -- May return NULL or error depending on DB

? Common ASCII Values

CharASCII
A65
Z90
a97
z122
048
957
space32
@64

? Use Cases

  • Sorting or filtering based on character code

  • Data validation (e.g., checking if input is a letter)

  • Creating custom collation rules


Let me know if you’d like the REVERSE of ASCII (using CHAR() or CHR() function) too!

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