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.

Right Function In Sql in SQL

Right Function In Sql in SQL

? RIGHT() Function in SQL

The RIGHT() function returns the rightmost (last) n characters from a string.


? Syntax:

RIGHT(string, number_of_characters)
  • string: The input string.

  • number_of_characters: How many characters to extract from the right.


? Example 1: Basic Usage

SELECT RIGHT('Database', 4) AS result;

? Output:

result
base

? Example 2: Extract last 2 digits of a number (as a string)

SELECT RIGHT('2025', 2) AS year_suffix;

Output:

year_suffix
25

? Supported In:

  • MySQL

  • SQL Server

  • PostgreSQL (using RIGHT() or substring())


? Related Functions:

FunctionDescription
LEFT()Returns characters from the start of a string
SUBSTRING() / SUBSTR()Extracts any part of a string

Want a comparison of LEFT(), RIGHT(), and SUBSTRING() with examples?

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