- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Can a number be used to name a MySQL table column?
152 Lectures 16 hours
87 Lectures 5.5 hours
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)
- How can column data be used within MySQL CASE statement?
- Which MySQL function can be used to append values of a column with single quotes?
- How can create a table having the name like a^b along with same column name? name?
- Can we give underscore in a MySQL table name?
- How can I change the name of an existing column from a MySQL table?
- Can we add a column to a table from another table in MySQL?
- What can another keyword be used instead of MODIFY to modify the column/s of MySQL table?
- Which MySQL Data Type can be used to store Negative Number?
- MySQL concat() to create column names to be used in a query?
- How can column data values of a table be compared using MySQL STRCMP() function?
- How can we change the name of a MySQL table?
- Change the column name from a MySQL table with Student record?
- How can we remove a column from MySQL table?
- Can we create a table with a space in name in MySQL?
- How can we count a number of unique values in a column in MySQL table?