
- 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
How to make 'from' as column name in MySQL?
Use the backticks symbol to consider ‘from’ as column name since it is a reserved word. We will now create a table with from reserved word surrounded by backtick −
mysql> create table DemoTable1810 ( `from` varchar(20) ); Query OK, 0 rows affected (0.00 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1810 values('US'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1810 values('UK'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1810 values('AUS'); Query OK, 1 row affected (0.00 sec)
Display all records from the table using select statement −
mysql> select `from` from DemoTable1810;
This will produce the following output −
+------+ | from | +------+ | US | | UK | | AUS | +------+ 3 rows in set (0.00 sec)
- Related Articles
- How to extract column name and type from MySQL?
- MySQL query to display columns name first name, last name as full name in a single column?
- Change the column name from StudentName to FirstName in MySQL?
- How to get column index from column name in Python Pandas?
- How to display column values as CSV in MySQL?
- How to select ID column as null in MySQL?
- Can we use reserved word ‘index’ as MySQL column name?
- How to select a column name with spaces in MySQL?
- How to find the name of a column in MySQL?
- Rename column name in MySQL?
- Can we use MySQL keyword as alias name for a column?
- How to find tables with a specific column name in MySQL?
- How to get Column name on ResultSet in Java with MySQL?
- How to make MySQL result set the same as specified?
- MySQL query to make a date column NULL?

Advertisements