
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Can a number be used to name a MySQL table column?
Yes, we can include a number for column name in MySQL. We need to use the symbol backtick, which is as follows
( ` `)
To understand, we will make a table with the help of CREATE command. Let us create a table −
mysql> CREATE table NumberColumnDemo -> ( -> `123` varchar(100) -> ); Query OK, 0 rows affected (0.51 sec)
Above, I have created a column name as a number with the help of backtick symbol.
Now, we can check the same by inserting records with the help of INSERT command. Let us insert a record, which is as follows −
mysql> INSERT into NumberColumnDemo values('45678'); Query OK, 1 row affected (0.20 sec)
After that, we can display all the records with the help of SELECT statement. The query is as follows −
mysql> SELECT * from NumberColumnDemo;
The following is the output −
+-------+ | 123 | +-------+ | 45678 | +-------+ 1 row in set (0.00 sec)
- Related Articles
- What can another keyword be used instead of MODIFY to modify the column/s of MySQL table?
- Can we add a column to a table from another table in MySQL?
- Which MySQL function can be used to append values of a column with single quotes?
- How can I change the name of an existing column from a MySQL table?
- How can column data be used within MySQL CASE statement?
- How can column data values of a table be compared using MySQL STRCMP() function?
- How can we count a number of unique values in a column in MySQL table?
- MySQL concat() to create column names to be used in a query?
- How can we remove a column from MySQL table?
- Which MySQL Data Type can be used to store Negative Number?
- Can we give underscore in a MySQL table name?
- Change the column name from a MySQL table with Student record?
- What function in MySQL can be used to get the number code of a specific character?
- MySQL query to count number of duplicate values in a table column
- How can SELECT, without reference to any table, be used to calculate expression in MySQL?

Advertisements