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.

Ord Function In Sql in SQL

Ord Function In Sql in SQL

ORD Function in SQL

The ORD() function returns the numeric code of the leftmost character of a string. It essentially gives the ASCII (or Unicode) value of that first character.


? Syntax:

ORD(string)
  • string: The input string whose first character's code you want.


? Example:

SELECT ORD('A') AS code;

Result:

code
65

Explanation: ASCII code of 'A' is 65.


Another example:

SELECT ORD('Hello') AS code;

Returns 72 because ASCII code of 'H' is 72.


Notes:

  • Available in MySQL.

  • Only considers the first character of the string.

  • Useful for character code comparisons or conversions.


Want examples of similar functions like CHAR() or ASCII()?

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