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)