Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs
    • SQL FAQ’s

MySQL ELT Function

by suresh

MySQL ELT is one of the String Functions, which returns the string expression (or string value) at the index position specified in the first argument. The basic syntax of String ELT in MySQL is as shown below:

SELECT ELT (Value, Str1, Str2,....,StrN)
FROM Source

The above string ELT in MySQL returns Str1 to StrN based on the index position given at Value argument. For example, ELT(2, ‘Hi’, ‘Hello’) return Hello as the output.

MySQL ELT Example 1

The String ELT function in MySQL returns the string at the specified position. The following ELT String Function query shows you multiple ways to use this ELT function.

-- MySQL String ELT Function Example
SELECT ELT(1, 'Learn', 'MySQL', 'Tutorial', 'at', 'tutorialgateway.org');

SELECT ELT(3, 'Learn', 'MySQL', 'Tutorial', 'at', 'tutorialgateway.org');

SELECT ELT(5, 'Learn', 'MySQL', 'Tutorial', 'at', 'tutorialgateway.org');

SELECT ELT(5, 'Learn', 'MySQL', 'Tutorial');

SELECT ELT(-2, 'Learn', 'MySQL', 'Tutorial');

OUTPUT

MySQL ELT Function Example 1

Let me show you what happen if we specify NULL values as the MySQL arguments.

-- MySQL String ELT Function Example
SELECT ELT('2', 'Learn', 'MySQL', 'Tutorial');

SELECT ELT(2, 'Learn', NULL, 'MySQL', 'Tutorial');

SELECT ELT(NULL, 'Learn', NULL, 'MySQL', 'Tutorial');

OUTPUT

MySQL ELT Function Example 2

Placed Under: MySQL

  • How to Download MySQL
  • Install MySQL on Windows
  • MySQL Create Database
  • MySQL Delete Database
  • MySQL Create Table
  • MySQL Drop Table
  • MySQL SELECT Statement
  • MySQL ALIAS Column
  • MySQL Distinct
  • MySQL Insert Statement
  • MySQL Delete
  • MySQL Truncate Table
  • MySQL WHERE Clause
  • MySQL Order By
  • MySQL Group By
  • MySQL Having Clause
  • MySQL LIMIT
  • MySQL Arithmetic Operators
  • MySQL COALESCE Function
  • MySQL AND Operator
  • MySQL NOT Operator
  • MySQL OR Operator
  • MySQL XOR Operator
  • MySQL BETWEEN Operator
  • MySQL Not Between Operator
  • MySQL GREATEST Function
  • MYSQL LEAST Function
  • MySQL LIKE Operator
  • MySQL NOT LIKE Operator
  • MySQL IFNULL Operator
  • MySQL NULLIF Operator
  • MySQL INTERVAL Operator
  • MySQL IS Operator
  • MySQL IN Operator
  • MySQL NOT IN Operator
  • MySQL IS NOT NULL
  • MySQL IS NULL
  • MySQL Inner Join
  • MySQL Cross Join
  • MySQL Right Join
  • MySQL Left Join
  • MySQL Aggregate Functions
  • MySQL Date Functions
  • MySQL Date Function
  • MySQL String Functions
  • MySQL Numeric Functions
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy