Mysql ltrim() function
Содержание:
- Purpose of the TRIM, LTRIM, and RTRIM Functions
- Examples of the TRIM Function
- Example 1 – Trailing Spaces
- Example 2 – Leading Spaces
- Example 3 – Leading and Trailing
- Example 4 – LEADING Keyword
- Example 5 – TRAILING Keyword
- Example 6 – BOTH Keyword
- Example 8 – Newline and Carriage Return
- Example 9 – Update Statement
- Example 10 – Simple LTRIM and RTRIM
- Example 11 – LTRIM and RTRIM with Specific Value
- Example 12 – LTRIM and RTRIM with Several Characters
- Example 13 – LTRIM and RTRIM on Table Columns
- Example 14 – LTRIM and RTRIM Zeroes
- Example 15 – LTRIM and RTRIM Combined
- Example 16
- SQL Справочник
- LTRIM() Function in SQL
- SQL Справочник
- How Can Oracle Trim Newline Characters Or Trim a Carriage Return?
- SQL Учебник
- MySQL TRIM() function examples
- RTRIM() Function in SQL
- SQL Учебник
- Introduction to the MySQL TRIM() function
- TRIM() Function in SQL Server
- SQL References
- SQL References
Purpose of the TRIM, LTRIM, and RTRIM Functions
The Oracle TRIM function will remove characters from the start or the end of a supplied string. It’s often used to remove space characters, such as where users enter an extra space that is not needed.
The Oracle LTRIM function will remove a specified character from the left side of a string. The L in LTRIM stands for “Left”, and is the opposite of the RTRIM or “Right” Trim function
Finally, the Oracle RTRIM function removes a specified character from the right side of a string.
This is most often used when you want to remove spaces from the right side of the string. However, it can be used for other characters as well, depending on the data.
Let’s take a look at the syntax of these three functions.
Examples of the TRIM Function
Here are some examples of the TRIM function. I find that examples are the best way for me to learn about code, even with the explanation above.
Example 1 – Trailing Spaces
This example removes the trailing spaces from a string.
Result:
TRIMMED |
Jack |
The spaces at the end of “Jack ” are removed.
Example 2 – Leading Spaces
This example removes the leading spaces from a string.
Result:
TRIMMED |
John |
The spaces at the start of ” John” are removed.
Example 3 – Leading and Trailing
This example removes the leading and trailing spaces from a string.
Result:
TRIMMED |
Julie |
The spaces at the start and end of ” Julie ” are removed.
Example 4 – LEADING Keyword
This example removes the leading spaces from a string by specifying LEADING.
Result:
TRIMMED |
Julie |
The spaces at the start of ” Julie ” are removed, but the spaces at the end remain. You might not be able to see it on the page here unless you highlight the text.
Example 5 – TRAILING Keyword
This example removes the trailing spaces from a string by specifying TRAILING.
Result:
TRIMMED |
Julie |
The spaces at the end of ” Julie ” are removed, but the spaces at the start remain. You might not be able to see it on the page here unless you highlight the text.
Example 6 – BOTH Keyword
This example removes the leading and trailing spaces from a string by specifying BOTH.
Result:
TRIMMED |
Julie |
The spaces at the start and end of ” Julie ” are removed.
This example removes an underscore from the provided string.
Result:
TRIMMED |
Jordan |
Example 8 – Newline and Carriage Return
This example converts the newline, carriage return, and tab characters to spaces and removes them from a string.
Result:
FULL_STRING | TRIMMED |
first line after tabnext line another line |
first line after tab next line another line |
The newline, carriage return, and tab characters are converted to spaces, and the entire result is then trimmed to ensure there is no spaces either side of the string, which is a possibility if there is a new line at the end of a string.
Example 9 – Update Statement
This example updates a value in the customers table.
First, let’s see what is in the customers table.
Result:
FIRST_NAME |
Jason |
Now, let’s update the first_name to remove spaces
Now, let’s have another look at the customers table.
Result:
FIRST_NAME |
Jason |
The space has been removed from this value. You might not be able to see it on the page here unless you highlight the text.
Example 10 – Simple LTRIM and RTRIM
This example demonstrates a simple LTRIM and RTRIM with no trim value specified.
Result:
LTRIM_EXAMPLE | RTRIM_EXAMPLE |
Database Star | Database Star |
The extra spaces are removed from the original value.
Example 11 – LTRIM and RTRIM with Specific Value
This example uses a specific value to trim.
Result:
LTRIM_EXAMPLE | RTRIM_EXAMPLE |
Database Star | Database Star |
The underscores are removed from the original value.
Example 12 – LTRIM and RTRIM with Several Characters
This example uses LTRIM with several characters as the string to trim.
Result:
LTRIM_EXAMPLE | RTRIM_EXAMPLE |
Database Star | Database Star |
Both the spaces and semicolons are removed from the original value.
Example 13 – LTRIM and RTRIM on Table Columns
This example uses LTRIM and RTRIM on data in a table, instead of providing a value.
Result:
COUNTRY | LTRIM_EXAMPLE | RTRIM_EXAMPLE |
USA | SA | US |
France | France | France |
Canada | Canada | Canada |
UK | K | UK |
Norway | Norway | Norway |
The capital U is removed from the left of several values, and the capital A is removed from the right of several values.
Example 14 – LTRIM and RTRIM Zeroes
This example uses LTRIM and RTRIM with 0 as the parameter.
Result:
LTRIM_EXAMPLE | RTRIM_EXAMPLE |
Database Star | Database Star |
The zeroes are removed from the original value.
Example 15 – LTRIM and RTRIM Combined
This example uses both LTRIM and RTRIM in the one expression.
Result:
LTRIM_RTRIM_EXAMPLE |
Database Star |
The underscores are removed from both sides of the original value.
Example 16
This example uses Unicode characers as the trim parameter.
Result:
LTRIM_EXAMPLE | RTRIM_EXAMPLE |
Database Star | Database Star |
The accented “e” character is removed from the original value.
SQL Справочник
SQL Ключевые слова
ADD
ADD CONSTRAINT
ALTER
ALTER COLUMN
ALTER TABLE
ALL
AND
ANY
AS
ASC
BACKUP DATABASE
BETWEEN
CASE
CHECK
COLUMN
CONSTRAINT
CREATE
CREATE DATABASE
CREATE INDEX
CREATE OR REPLACE VIEW
CREATE TABLE
CREATE PROCEDURE
CREATE UNIQUE INDEX
CREATE VIEW
DATABASE
DEFAULT
DELETE
DESC
DISTINCT
DROP
DROP COLUMN
DROP CONSTRAINT
DROP DATABASE
DROP DEFAULT
DROP INDEX
DROP TABLE
DROP VIEW
EXEC
EXISTS
FOREIGN KEY
FROM
FULL OUTER JOIN
GROUP BY
HAVING
IN
INDEX
INNER JOIN
INSERT INTO
INSERT INTO SELECT
IS NULL
IS NOT NULL
JOIN
LEFT JOIN
LIKE
LIMIT
NOT
NOT NULL
OR
ORDER BY
OUTER JOIN
PRIMARY KEY
PROCEDURE
RIGHT JOIN
ROWNUM
SELECT
SELECT DISTINCT
SELECT INTO
SELECT TOP
SET
TABLE
TOP
TRUNCATE TABLE
UNION
UNION ALL
UNIQUE
UPDATE
VALUES
VIEW
WHERE
MySQL Функции
Функции строк
ASCII
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
CONCAT_WS
FIELD
FIND_IN_SET
FORMAT
INSERT
INSTR
LCASE
LEFT
LENGTH
LOCATE
LOWER
LPAD
LTRIM
MID
POSITION
REPEAT
REPLACE
REVERSE
RIGHT
RPAD
RTRIM
SPACE
STRCMP
SUBSTR
SUBSTRING
SUBSTRING_INDEX
TRIM
UCASE
UPPER
Функции чисел
ABS
ACOS
ASIN
ATAN
ATAN2
AVG
CEIL
CEILING
COS
COT
COUNT
DEGREES
DIV
EXP
FLOOR
GREATEST
LEAST
LN
LOG
LOG10
LOG2
MAX
MIN
MOD
PI
POW
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SUM
TAN
TRUNCATE
Функции дат
ADDDATE
ADDTIME
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DATE
DATEDIFF
DATE_ADD
DATE_FORMAT
DATE_SUB
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
FROM_DAYS
HOUR
LAST_DAY
LOCALTIME
LOCALTIMESTAMP
MAKEDATE
MAKETIME
MICROSECOND
MINUTE
MONTH
MONTHNAME
NOW
PERIOD_ADD
PERIOD_DIFF
QUARTER
SECOND
SEC_TO_TIME
STR_TO_DATE
SUBDATE
SUBTIME
SYSDATE
TIME
TIME_FORMAT
TIME_TO_SEC
TIMEDIFF
TIMESTAMP
TO_DAYS
WEEK
WEEKDAY
WEEKOFYEAR
YEAR
YEARWEEK
Функции расширений
BIN
BINARY
CASE
CAST
COALESCE
CONNECTION_ID
CONV
CONVERT
CURRENT_USER
DATABASE
IF
IFNULL
ISNULL
LAST_INSERT_ID
NULLIF
SESSION_USER
SYSTEM_USER
USER
VERSION
SQL Server функции
Функции строк
ASCII
CHAR
CHARINDEX
CONCAT
Concat with +
CONCAT_WS
DATALENGTH
DIFFERENCE
FORMAT
LEFT
LEN
LOWER
LTRIM
NCHAR
PATINDEX
QUOTENAME
REPLACE
REPLICATE
REVERSE
RIGHT
RTRIM
SOUNDEX
SPACE
STR
STUFF
SUBSTRING
TRANSLATE
TRIM
UNICODE
UPPER
Функции чисел
ABS
ACOS
ASIN
ATAN
ATN2
AVG
CEILING
COUNT
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MAX
MIN
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SQUARE
SUM
TAN
Функции дат
CURRENT_TIMESTAMP
DATEADD
DATEDIFF
DATEFROMPARTS
DATENAME
DATEPART
DAY
GETDATE
GETUTCDATE
ISDATE
MONTH
SYSDATETIME
YEAR
Функции расширений
CAST
COALESCE
CONVERT
CURRENT_USER
IIF
ISNULL
ISNUMERIC
NULLIF
SESSION_USER
SESSIONPROPERTY
SYSTEM_USER
USER_NAME
MS Access функции
Функции строк
Asc
Chr
Concat with &
CurDir
Format
InStr
InstrRev
LCase
Left
Len
LTrim
Mid
Replace
Right
RTrim
Space
Split
Str
StrComp
StrConv
StrReverse
Trim
UCase
Функции чисел
Abs
Atn
Avg
Cos
Count
Exp
Fix
Format
Int
Max
Min
Randomize
Rnd
Round
Sgn
Sqr
Sum
Val
Функции дат
Date
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Day
Format
Hour
Minute
Month
MonthName
Now
Second
Time
TimeSerial
TimeValue
Weekday
WeekdayName
Year
Другие функции
CurrentUser
Environ
IsDate
IsNull
IsNumeric
SQL ОператорыSQL Типы данныхSQL Краткий справочник
LTRIM() Function in SQL
LTRIM() function is given in the following format.
Syntax |
Table 4. LTRIM Function
Where Column is the text consider to remove spaces. It is a required parameter.
LTRIM() function allows us to remove the left spaces from a column or a string.
Example 2. LTRIM() Function in SQL
Using this example we can remove the left spaces from “Code” and “Number” columns.
SQL Script:
UPDATE Employees SET Code = LTRIM(Code), Number = LTRIM(Number); SELECT * FROM Employees;
Script 3. To Remove Left Spaces
Above query updates employee data in the following format.
Result:
Id | Code | Number |
1 | “N227” | “6758” |
2 | “#643” | “3245” |
3 | “No456” | “6789” |
4 | “125” | “2322” |
5 | “N-142” | “4354” |
6 | “No632” | “6687” |
7 | “No.234” | “1223” |
8 | “N.336” | “6654” |
9 | “N551” | “2343” |
10 | “#122” | “4245” |
Table 5. Result after Removing Left Spaces
SQL Справочник
SQL Ключевые слова
ADD
ADD CONSTRAINT
ALTER
ALTER COLUMN
ALTER TABLE
ALL
AND
ANY
AS
ASC
BACKUP DATABASE
BETWEEN
CASE
CHECK
COLUMN
CONSTRAINT
CREATE
CREATE DATABASE
CREATE INDEX
CREATE OR REPLACE VIEW
CREATE TABLE
CREATE PROCEDURE
CREATE UNIQUE INDEX
CREATE VIEW
DATABASE
DEFAULT
DELETE
DESC
DISTINCT
DROP
DROP COLUMN
DROP CONSTRAINT
DROP DATABASE
DROP DEFAULT
DROP INDEX
DROP TABLE
DROP VIEW
EXEC
EXISTS
FOREIGN KEY
FROM
FULL OUTER JOIN
GROUP BY
HAVING
IN
INDEX
INNER JOIN
INSERT INTO
INSERT INTO SELECT
IS NULL
IS NOT NULL
JOIN
LEFT JOIN
LIKE
LIMIT
NOT
NOT NULL
OR
ORDER BY
OUTER JOIN
PRIMARY KEY
PROCEDURE
RIGHT JOIN
ROWNUM
SELECT
SELECT DISTINCT
SELECT INTO
SELECT TOP
SET
TABLE
TOP
TRUNCATE TABLE
UNION
UNION ALL
UNIQUE
UPDATE
VALUES
VIEW
WHERE
MySQL Функции
Функции строк
ASCII
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
CONCAT_WS
FIELD
FIND_IN_SET
FORMAT
INSERT
INSTR
LCASE
LEFT
LENGTH
LOCATE
LOWER
LPAD
LTRIM
MID
POSITION
REPEAT
REPLACE
REVERSE
RIGHT
RPAD
RTRIM
SPACE
STRCMP
SUBSTR
SUBSTRING
SUBSTRING_INDEX
TRIM
UCASE
UPPER
Функции чисел
ABS
ACOS
ASIN
ATAN
ATAN2
AVG
CEIL
CEILING
COS
COT
COUNT
DEGREES
DIV
EXP
FLOOR
GREATEST
LEAST
LN
LOG
LOG10
LOG2
MAX
MIN
MOD
PI
POW
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SUM
TAN
TRUNCATE
Функции дат
ADDDATE
ADDTIME
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DATE
DATEDIFF
DATE_ADD
DATE_FORMAT
DATE_SUB
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
FROM_DAYS
HOUR
LAST_DAY
LOCALTIME
LOCALTIMESTAMP
MAKEDATE
MAKETIME
MICROSECOND
MINUTE
MONTH
MONTHNAME
NOW
PERIOD_ADD
PERIOD_DIFF
QUARTER
SECOND
SEC_TO_TIME
STR_TO_DATE
SUBDATE
SUBTIME
SYSDATE
TIME
TIME_FORMAT
TIME_TO_SEC
TIMEDIFF
TIMESTAMP
TO_DAYS
WEEK
WEEKDAY
WEEKOFYEAR
YEAR
YEARWEEK
Функции расширений
BIN
BINARY
CASE
CAST
COALESCE
CONNECTION_ID
CONV
CONVERT
CURRENT_USER
DATABASE
IF
IFNULL
ISNULL
LAST_INSERT_ID
NULLIF
SESSION_USER
SYSTEM_USER
USER
VERSION
SQL Server функции
Функции строк
ASCII
CHAR
CHARINDEX
CONCAT
Concat with +
CONCAT_WS
DATALENGTH
DIFFERENCE
FORMAT
LEFT
LEN
LOWER
LTRIM
NCHAR
PATINDEX
QUOTENAME
REPLACE
REPLICATE
REVERSE
RIGHT
RTRIM
SOUNDEX
SPACE
STR
STUFF
SUBSTRING
TRANSLATE
TRIM
UNICODE
UPPER
Функции чисел
ABS
ACOS
ASIN
ATAN
ATN2
AVG
CEILING
COUNT
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MAX
MIN
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SQUARE
SUM
TAN
Функции дат
CURRENT_TIMESTAMP
DATEADD
DATEDIFF
DATEFROMPARTS
DATENAME
DATEPART
DAY
GETDATE
GETUTCDATE
ISDATE
MONTH
SYSDATETIME
YEAR
Функции расширений
CAST
COALESCE
CONVERT
CURRENT_USER
IIF
ISNULL
ISNUMERIC
NULLIF
SESSION_USER
SESSIONPROPERTY
SYSTEM_USER
USER_NAME
MS Access функции
Функции строк
Asc
Chr
Concat with &
CurDir
Format
InStr
InstrRev
LCase
Left
Len
LTrim
Mid
Replace
Right
RTrim
Space
Split
Str
StrComp
StrConv
StrReverse
Trim
UCase
Функции чисел
Abs
Atn
Avg
Cos
Count
Exp
Fix
Format
Int
Max
Min
Randomize
Rnd
Round
Sgn
Sqr
Sum
Val
Функции дат
Date
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Day
Format
Hour
Minute
Month
MonthName
Now
Second
Time
TimeSerial
TimeValue
Weekday
WeekdayName
Year
Другие функции
CurrentUser
Environ
IsDate
IsNull
IsNumeric
SQL ОператорыSQL Типы данныхSQL Краткий справочник
How Can Oracle Trim Newline Characters Or Trim a Carriage Return?
Using the TRIM function to remove newline characters or a carriage return can be done with Oracle. This can work if you only have a newline character or only a carriage return, as you can use the CHR function.
Will remove new line characters.
Will remove carriage return characters.
CHR(10) returns a new line character and CHR(13) returns a carriage return character.
But what if you have both? Or it is mixed with spaces and tab characters (CHR(9))?
The main issue is that TRIM only removes one type of character – you can only specify a single character for TRIM to remove.
What if you use a recursive TRIM function?
This can work, but it could be slow, especially if you have it inside a loop or a large query.
An approach recommended by users at Stack Overflow is the TRANSLATE function, to translate all occurrences of a string into a space, and then TRIM the string of spaces. See the examples below on how to do this.
You can also use a REGEXP_REPLACE function, which is a bit more flexible but more complicated.
SQL Учебник
SQL ГлавнаяSQL ВведениеSQL СинтаксисSQL SELECTSQL SELECT DISTINCTSQL WHERESQL AND, OR, NOTSQL ORDER BYSQL INSERT INTOSQL Значение NullSQL Инструкция UPDATESQL Инструкция DELETESQL SELECT TOPSQL MIN() и MAX()SQL COUNT(), AVG() и …SQL Оператор LIKESQL ПодстановочныйSQL Оператор INSQL Оператор BETWEENSQL ПсевдонимыSQL JOINSQL JOIN ВнутриSQL JOIN СлеваSQL JOIN СправаSQL JOIN ПолноеSQL JOIN СамSQL Оператор UNIONSQL GROUP BYSQL HAVINGSQL Оператор ExistsSQL Операторы Any, AllSQL SELECT INTOSQL INSERT INTO SELECTSQL Инструкция CASESQL Функции NULLSQL ХранимаяSQL Комментарии
MySQL TRIM() function examples
Let’s take some examples of using the MySQL function.
A) Using MySQL function to remove both leading and trailing spaces
The following statement uses the function to remove both leading and trailing spaces from a string.
B) Using MySQL function to remove only leading spaces
The following statement uses the function to remove only leading spaces.
It is equivalent to the following statement that uses function:
C) Using MySQL function to remove only trailing spaces
The following statement uses the function to remove only trailing spaces from a string.
It is equivalent to the following statement that uses the function:
D) Using MySQL function to remove the newline characters
The following statements remove the newline characters at the end of a string.
Note that based on the platform, the new line could be \n (Unix or Linux), \r (Mac), or both (\r\n).
E) Using MySQL function to update data in a table
In case the data already in the database and you want to clean up the spaces or any other unwanted characters, you can use the function in the statement.
We will take the table from the sample database for the demonstration.
The following statement uses the TRIM() function to remove all spaces from column in the table.
Notice that the function only removes the unwanted leading and/ or trailing characters from a string. If you want to remove the unwanted characters in the middle of a string, you should use the REPLACE function instead.
RTRIM() Function in SQL
RTRIM() function is given in the following format.
Syntax |
Table 2. RTRIM Function
Where Column is the text consider to remove spaces. It is a required parameter.
RTRIM() function allows us to remove the right spaces from a column or a string.
Example 1. RTRIM() Function in SQL
Using the below query we can remove the right spaces from “Code” and “Number” columns.
SQL Script:
UPDATE Employees SET Code = RTRIM(Code), Number= RTRIM(Number); SELECT * FROM Employees;
Script 2. To Remove Right Spaces
Above query updates employee data in the following format.
Result:
Id | Code | Number |
1 | ” N227″ | ” 6758″ |
2 | “#643” | ” 3245″ |
3 | “No456” | ” 6789″ |
4 | ” 125″ | “2322” |
5 | “N-142” | “4354” |
6 | “No632” | ” 6687″ |
7 | “No.234” | “1223” |
8 | “N.336” | ” 6654″ |
9 | ” N551″ | “2343” |
10 | “#122” | “4245” |
Table 3. Employee Data after Removing Right Spaces
SQL Учебник
SQL ГлавнаяSQL ВведениеSQL СинтаксисSQL SELECTSQL SELECT DISTINCTSQL WHERESQL AND, OR, NOTSQL ORDER BYSQL INSERT INTOSQL Значение NullSQL Инструкция UPDATESQL Инструкция DELETESQL SELECT TOPSQL MIN() и MAX()SQL COUNT(), AVG() и …SQL Оператор LIKESQL ПодстановочныйSQL Оператор INSQL Оператор BETWEENSQL ПсевдонимыSQL JOINSQL JOIN ВнутриSQL JOIN СлеваSQL JOIN СправаSQL JOIN ПолноеSQL JOIN СамSQL Оператор UNIONSQL GROUP BYSQL HAVINGSQL Оператор ExistsSQL Операторы Any, AllSQL SELECT INTOSQL INSERT INTO SELECTSQL Инструкция CASESQL Функции NULLSQL ХранимаяSQL Комментарии
Introduction to the MySQL TRIM() function
The data from the user’s input is typically not what we expected. Sometimes, it is not well-formed, for example, wrong cases, or some even contain leading and trailing spaces and also other unwanted characters.
To keep the data in the correct format, before inserting or updating data in the database, you need to clean it up. One of the most important tasks in data cleansing is to remove the unwanted leading and trailing characters.
MySQL provides a very useful string function named to help you clean up the data. The following illustrates the syntax of the function.
The function provides a number of options. You can use the , , or option to explicitly instruct the function to remove leading, trailing, or both leading and trailing unwanted characters from a string.
By default, the function uses the option.
The is the string that you want to remove. If you don’t specify a specific string, the function removes spaces only.
The r is the string that you want to remove the .
The function returns a string that has unwanted characters removed.
Note that to remove the leading spaces from a string, you use the function. And to remove trailing spaces from a string, you use the function.
TRIM() Function in SQL Server
TRIM() function is given by one of the following formats.
Syntax(s) |
Table 6. TRIM Function
Where Column is the text consider to remove spaces or characters. It is a required parameter.
Characters are the string of removable characters. It is an optional parameter.
TRIM() function allows us to remove outer spaces or characters from a column or a string.
Example 2. TRIM() Function in SQL
Using the below query we can remove unwanted characters from the “Code” column.
SQL Script:
UPDATE Employees SET Code = TRIM('#No-.' FROM Code); SELECT * FROM Employees;
Script 4. To Remove Unwanted Characters
Above query updates employee data in the following format.
Result:
Id | Code | Number |
1 | “227” | “6758” |
2 | “643” | “3245” |
3 | “456” | “6789” |
4 | “125” | “2322” |
5 | “142” | “4354” |
6 | “632” | “6687” |
7 | “234” | “1223” |
8 | “336” | “6654” |
9 | “551” | “2343” |
10 | “122” | “4245” |
Table 7. Result after Removing Unwanted Characters
SQL References
SQL Keywords
ADD
ADD CONSTRAINT
ALTER
ALTER COLUMN
ALTER TABLE
ALL
AND
ANY
AS
ASC
BACKUP DATABASE
BETWEEN
CASE
CHECK
COLUMN
CONSTRAINT
CREATE
CREATE DATABASE
CREATE INDEX
CREATE OR REPLACE VIEW
CREATE TABLE
CREATE PROCEDURE
CREATE UNIQUE INDEX
CREATE VIEW
DATABASE
DEFAULT
DELETE
DESC
DISTINCT
DROP
DROP COLUMN
DROP CONSTRAINT
DROP DATABASE
DROP DEFAULT
DROP INDEX
DROP TABLE
DROP VIEW
EXEC
EXISTS
FOREIGN KEY
FROM
FULL OUTER JOIN
GROUP BY
HAVING
IN
INDEX
INNER JOIN
INSERT INTO
INSERT INTO SELECT
IS NULL
IS NOT NULL
JOIN
LEFT JOIN
LIKE
LIMIT
NOT
NOT NULL
OR
ORDER BY
OUTER JOIN
PRIMARY KEY
PROCEDURE
RIGHT JOIN
ROWNUM
SELECT
SELECT DISTINCT
SELECT INTO
SELECT TOP
SET
TABLE
TOP
TRUNCATE TABLE
UNION
UNION ALL
UNIQUE
UPDATE
VALUES
VIEW
WHERE
MySQL Functions
String Functions
ASCII
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
CONCAT_WS
FIELD
FIND_IN_SET
FORMAT
INSERT
INSTR
LCASE
LEFT
LENGTH
LOCATE
LOWER
LPAD
LTRIM
MID
POSITION
REPEAT
REPLACE
REVERSE
RIGHT
RPAD
RTRIM
SPACE
STRCMP
SUBSTR
SUBSTRING
SUBSTRING_INDEX
TRIM
UCASE
UPPER
Numeric Functions
ABS
ACOS
ASIN
ATAN
ATAN2
AVG
CEIL
CEILING
COS
COT
COUNT
DEGREES
DIV
EXP
FLOOR
GREATEST
LEAST
LN
LOG
LOG10
LOG2
MAX
MIN
MOD
PI
POW
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SUM
TAN
TRUNCATE
Date Functions
ADDDATE
ADDTIME
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DATE
DATEDIFF
DATE_ADD
DATE_FORMAT
DATE_SUB
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
FROM_DAYS
HOUR
LAST_DAY
LOCALTIME
LOCALTIMESTAMP
MAKEDATE
MAKETIME
MICROSECOND
MINUTE
MONTH
MONTHNAME
NOW
PERIOD_ADD
PERIOD_DIFF
QUARTER
SECOND
SEC_TO_TIME
STR_TO_DATE
SUBDATE
SUBTIME
SYSDATE
TIME
TIME_FORMAT
TIME_TO_SEC
TIMEDIFF
TIMESTAMP
TO_DAYS
WEEK
WEEKDAY
WEEKOFYEAR
YEAR
YEARWEEK
Advanced Functions
BIN
BINARY
CASE
CAST
COALESCE
CONNECTION_ID
CONV
CONVERT
CURRENT_USER
DATABASE
IF
IFNULL
ISNULL
LAST_INSERT_ID
NULLIF
SESSION_USER
SYSTEM_USER
USER
VERSION
SQL Server Functions
String Functions
ASCII
CHAR
CHARINDEX
CONCAT
Concat with +
CONCAT_WS
DATALENGTH
DIFFERENCE
FORMAT
LEFT
LEN
LOWER
LTRIM
NCHAR
PATINDEX
QUOTENAME
REPLACE
REPLICATE
REVERSE
RIGHT
RTRIM
SOUNDEX
SPACE
STR
STUFF
SUBSTRING
TRANSLATE
TRIM
UNICODE
UPPER
Numeric Functions
ABS
ACOS
ASIN
ATAN
ATN2
AVG
CEILING
COUNT
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MAX
MIN
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SQUARE
SUM
TAN
Date Functions
CURRENT_TIMESTAMP
DATEADD
DATEDIFF
DATEFROMPARTS
DATENAME
DATEPART
DAY
GETDATE
GETUTCDATE
ISDATE
MONTH
SYSDATETIME
YEAR
Advanced Functions
CAST
COALESCE
CONVERT
CURRENT_USER
IIF
ISNULL
ISNUMERIC
NULLIF
SESSION_USER
SESSIONPROPERTY
SYSTEM_USER
USER_NAME
MS Access Functions
String Functions
Asc
Chr
Concat with &
CurDir
Format
InStr
InstrRev
LCase
Left
Len
LTrim
Mid
Replace
Right
RTrim
Space
Split
Str
StrComp
StrConv
StrReverse
Trim
UCase
Numeric Functions
Abs
Atn
Avg
Cos
Count
Exp
Fix
Format
Int
Max
Min
Randomize
Rnd
Round
Sgn
Sqr
Sum
Val
Date Functions
Date
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Day
Format
Hour
Minute
Month
MonthName
Now
Second
Time
TimeSerial
TimeValue
Weekday
WeekdayName
Year
Other Functions
CurrentUser
Environ
IsDate
IsNull
IsNumeric
SQL Quick Ref
SQL References
SQL Keywords
ADD
ADD CONSTRAINT
ALTER
ALTER COLUMN
ALTER TABLE
ALL
AND
ANY
AS
ASC
BACKUP DATABASE
BETWEEN
CASE
CHECK
COLUMN
CONSTRAINT
CREATE
CREATE DATABASE
CREATE INDEX
CREATE OR REPLACE VIEW
CREATE TABLE
CREATE PROCEDURE
CREATE UNIQUE INDEX
CREATE VIEW
DATABASE
DEFAULT
DELETE
DESC
DISTINCT
DROP
DROP COLUMN
DROP CONSTRAINT
DROP DATABASE
DROP DEFAULT
DROP INDEX
DROP TABLE
DROP VIEW
EXEC
EXISTS
FOREIGN KEY
FROM
FULL OUTER JOIN
GROUP BY
HAVING
IN
INDEX
INNER JOIN
INSERT INTO
INSERT INTO SELECT
IS NULL
IS NOT NULL
JOIN
LEFT JOIN
LIKE
LIMIT
NOT
NOT NULL
OR
ORDER BY
OUTER JOIN
PRIMARY KEY
PROCEDURE
RIGHT JOIN
ROWNUM
SELECT
SELECT DISTINCT
SELECT INTO
SELECT TOP
SET
TABLE
TOP
TRUNCATE TABLE
UNION
UNION ALL
UNIQUE
UPDATE
VALUES
VIEW
WHERE
MySQL Functions
String Functions
ASCII
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
CONCAT_WS
FIELD
FIND_IN_SET
FORMAT
INSERT
INSTR
LCASE
LEFT
LENGTH
LOCATE
LOWER
LPAD
LTRIM
MID
POSITION
REPEAT
REPLACE
REVERSE
RIGHT
RPAD
RTRIM
SPACE
STRCMP
SUBSTR
SUBSTRING
SUBSTRING_INDEX
TRIM
UCASE
UPPER
Numeric Functions
ABS
ACOS
ASIN
ATAN
ATAN2
AVG
CEIL
CEILING
COS
COT
COUNT
DEGREES
DIV
EXP
FLOOR
GREATEST
LEAST
LN
LOG
LOG10
LOG2
MAX
MIN
MOD
PI
POW
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SUM
TAN
TRUNCATE
Date Functions
ADDDATE
ADDTIME
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DATE
DATEDIFF
DATE_ADD
DATE_FORMAT
DATE_SUB
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
FROM_DAYS
HOUR
LAST_DAY
LOCALTIME
LOCALTIMESTAMP
MAKEDATE
MAKETIME
MICROSECOND
MINUTE
MONTH
MONTHNAME
NOW
PERIOD_ADD
PERIOD_DIFF
QUARTER
SECOND
SEC_TO_TIME
STR_TO_DATE
SUBDATE
SUBTIME
SYSDATE
TIME
TIME_FORMAT
TIME_TO_SEC
TIMEDIFF
TIMESTAMP
TO_DAYS
WEEK
WEEKDAY
WEEKOFYEAR
YEAR
YEARWEEK
Advanced Functions
BIN
BINARY
CASE
CAST
COALESCE
CONNECTION_ID
CONV
CONVERT
CURRENT_USER
DATABASE
IF
IFNULL
ISNULL
LAST_INSERT_ID
NULLIF
SESSION_USER
SYSTEM_USER
USER
VERSION
SQL Server Functions
String Functions
ASCII
CHAR
CHARINDEX
CONCAT
Concat with +
CONCAT_WS
DATALENGTH
DIFFERENCE
FORMAT
LEFT
LEN
LOWER
LTRIM
NCHAR
PATINDEX
QUOTENAME
REPLACE
REPLICATE
REVERSE
RIGHT
RTRIM
SOUNDEX
SPACE
STR
STUFF
SUBSTRING
TRANSLATE
TRIM
UNICODE
UPPER
Numeric Functions
ABS
ACOS
ASIN
ATAN
ATN2
AVG
CEILING
COUNT
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MAX
MIN
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
SQUARE
SUM
TAN
Date Functions
CURRENT_TIMESTAMP
DATEADD
DATEDIFF
DATEFROMPARTS
DATENAME
DATEPART
DAY
GETDATE
GETUTCDATE
ISDATE
MONTH
SYSDATETIME
YEAR
Advanced Functions
CAST
COALESCE
CONVERT
CURRENT_USER
IIF
ISNULL
ISNUMERIC
NULLIF
SESSION_USER
SESSIONPROPERTY
SYSTEM_USER
USER_NAME
MS Access Functions
String Functions
Asc
Chr
Concat with &
CurDir
Format
InStr
InstrRev
LCase
Left
Len
LTrim
Mid
Replace
Right
RTrim
Space
Split
Str
StrComp
StrConv
StrReverse
Trim
UCase
Numeric Functions
Abs
Atn
Avg
Cos
Count
Exp
Fix
Format
Int
Max
Min
Randomize
Rnd
Round
Sgn
Sqr
Sum
Val
Date Functions
Date
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Day
Format
Hour
Minute
Month
MonthName
Now
Second
Time
TimeSerial
TimeValue
Weekday
WeekdayName
Year
Other Functions
CurrentUser
Environ
IsDate
IsNull
IsNumeric
SQL Quick Ref