

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Lower case column names with MySQL SELECT?
Let us first create a table −
mysql> create table DemoTable ( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserFirstName varchar(20), UserLastName varchar(20), UserAge int, UserCountryName varchar(20) ); Query OK, 0 rows affected (0.27 sec)
Now check the description of table.
mysql> desc DemoTable;
This will produce the following output −
+-----------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-------------+------+-----+---------+----------------+ | UserId | int(11) | NO | PRI | NULL | auto_increment | | UserFirstName | varchar(20) | YES | | NULL | | | UserLastName | varchar(20) | YES | | NULL | | | UserAge | int(11) | YES | | NULL | | | UserCountryName | varchar(20) | YES | | NULL | | +-----------------+-------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec)
Following is the query to convert case to lower case column names while using SELECT.
mysql> SELECT LOWER(COLUMN_NAME) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'DemoTable';
This will produce the following output −
+--------------------+ | LOWER(COLUMN_NAME) | +--------------------+ | userage | | usercountryname | | userfirstname | | userid | | userlastname | +--------------------+ 5 rows in set (0.03 sec)
- Related Questions & Answers
- Make all column names lower case in MySQL with a single query
- Select column names containing a string in MySQL?
- MySQL Query to change lower case to upper case?
- How to change column names to capital letters from lower case or vice versa in R?
- Select Statement to retrieve the same first names with similar last name (but different case) using MySQL?
- Set Blank spaces in column names with MySQL?
- Are MySQL database and table names case-sensitive?
- Convert mixed case string to lower case in JavaScript
- Rename all tables and columns to lower case in MySQL?
- Java String to Lower Case example.
- Perform case insensitive SELECT using MySQL IN()?
- MySQL case statement inside a select statement?
- Implement case sensitivity in MySQL SELECT statements
- How to use special characters in column names with MySQL?
- How to convert Lower case to Upper Case using C#?
Advertisements