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.

Mid Function In Sql in SQL

Mid Function In Sql in SQL

MID Function in SQL

The MID() function extracts a substring from a given string, starting at a specified position for a specified length.


? Syntax:

MID(string, start_position, length)
  • string: The original string.

  • start_position: The starting position (1-based index).

  • length: Number of characters to extract.


? Example:

SELECT MID('Hello World', 7, 5) AS substring;

Result:

substring
World

? Notes:

  • MID() is synonymous with SUBSTRING() in MySQL.

  • In some databases (like SQL Server and Oracle), use SUBSTRING() instead.

  • If length exceeds the string length, it returns until the end of the string.


Equivalent in other SQL dialects:

  • MySQL: MID() or SUBSTRING()

  • SQL Server: SUBSTRING()

  • Oracle: SUBSTR()


If you want, I can show examples with SUBSTRING() or SUBSTR() 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