Create a table named “select” in SQL databases?


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`;

Output

This will produce the following output −

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

Updated on: 30-Jun-2020

77 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements