Tutorialspoint

1 Answer
Sharon Christine

Since “select” is a reserved word in MySQL, we cannot create a table name with it. But, if you still want to create such a table, surround the word select with quote.

Let us first create a table −

mysql> create table `select`
   -> (
   -> Number int
   -> );
Query OK, 0 rows affected (0.79 sec)

Insert some records in the table using insert command −

mysql> insert into `select` values(10);
Query OK, 1 row affected (0.16 sec)

mysql> insert into `select` values(20);
Query OK, 1 row affected (0.11 sec)

mysql> insert into `select` values(30);
Query OK, 1 row affected (0.12 sec)

Display all records from the table using select statement −

mysql> select *from `select`;

This will produce the following output −

+--------+
| Number |
+--------+
|     10 |
|     20 |
|     30 |
+--------+
3 rows in set (0.00 sec)

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.