Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL: How to convert values to lower case and append an s?

I'd like to do this but I know this isn't the right syntax:

INSERT INTO
               TBL1 SELECT 
               Col1.ToLower + 's'
FROM
               TBL2
like image 869
wil Avatar asked Oct 22 '10 13:10

wil


People also ask

How do I convert a value to lowercase in SQL?

Use the SQL LOWER() function if you want to convert a string column to lowercase. This function takes only one argument: the column whose values you want to lowercase. This function is a good choice if your database is case sensitive and you want to select only records matching a particular string.

How do you change capitalization in SQL?

If you want to display a string in uppercase, use the SQL UPPER() function. This function takes only one argument: the string column that you want to convert to uppercase.

How do you do case insensitive comparison in SQL?

To do a case-insensitive comparison, use the ILIKE keyword; e.g., column ILIKE 'aBc' and column ILIKE 'ABC' both return TRUE for 'abc' . In contrast, MySQL and MS SQL Server have case-insensitive behaviors by default. This means WHERE column = 'abc' returns TRUE for e.g., 'abc' , 'ABC' , or 'aBc' .

Can SQL be written in lowercase?

All Caps SQL Commands For readability, all SQL commands should be written in uppercase letters. This allows the reader to identify the keywords in the SQL statement and easily determine what the query is executing.


2 Answers

INSERT INTO TBL1 SELECT LOWER(Col1) + 's'
FROM TBL2
like image 119
Lucero Avatar answered Oct 01 '22 02:10

Lucero


Like this:

INSERT INTO TBL1 SELECT LOWER(Col1) + 's'
FROM TBL2 
like image 26
SLaks Avatar answered Oct 01 '22 00:10

SLaks