SESSION NAME: SQL Functions - 2.
QUESTION NAME: MID FUNCTION - SCALAR FUNCTION - Column Salary.
TABLE DESCRIPTION:
MID Function:
MID Function has three parameters:
First Parameter = Column Name
Second Parameter = Start Length
Third Parameter = Length of characters to be displayed
Note: Index starts from 1.
Example:
MID(column_name, start, length) from table-name;
Write a FUNCTION to display the salary column of employee table using mid function.
The start length (index) is 1 and display total of 4 characters in salary column.
Table Name : emp
Columns
eid - Number
name - varchar
age - Number
salary - Number
MID Function has three parameters:
First Parameter = Column Name
Second Parameter = Start Length
Third Parameter = Length of characters to be displayed
Note: Index starts from 1.
Example:
MID(column_name, start, length) from table-name;
Write a FUNCTION to display the salary column of employee table using mid function.
The start length (index) is 1 and display total of 4 characters in salary column.
Table Name : emp
Columns
eid - Number
name - varchar
age - Number
salary - Number
CODE:
select mid(salary,1,4) from emp;
0 Comments