- 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
MySQL Quoted table/field names vs unquoted names?
Any identifiers like tablename, stored procedure, viewname or column etc. may be quoted or unquoted. When an identifier is a reserved keyword then you must quote it, else an error would occur.
Let us first create a table. Here, we have taken field names as reserved keywords −
mysql> create table `INT` (`select` int,`varchar` varchar(100)); Query OK, 0 rows affected (0.50 sec)
Insert some records in the table using insert command −
mysql> insert into `INT` values(1,'MySQL'); Query OK, 1 row affected (0.14 sec) mysql> insert into `INT` values(2,'MongoDB'); Query OK, 1 row affected (0.34 sec) mysql> insert into `INT` values(3,'Java'); Query OK, 1 row affected (0.15 sec) mysql> insert into `INT` values(4,'C'); Query OK, 1 row affected (0.19 sec)
Display all records from the table using select statement −
mysql> select *from `INT`;
This will produce the following output −
+--------+---------+ | select | varchar | +--------+---------+ | 1 | MySQL | | 2 | MongoDB | | 3 | Java | | 4 | C | +--------+---------+ 4 rows in set (0.00 sec)
- Are MySQL database and table names case-sensitive?
- Get table names using SELECT statement in MySQL?
- Display specific table names with MySQL LIKE Operator
- Viewing field names or tables names of the forms in SAP Business One
- Get table column names in alphabetical order in MySQL?
- Display information about field names in MySQL including TYPE, KEY, etc.
- How to retrieve table names from a database in MySQL?
- What is the SQL command to return the field names of a table?
- Which characters are NOT allowed in MongoDB field names?
- How to can I get the names of my MySQL table columns?
- Fetch specific rows from a MySQL table with duplicate column values (names)?
- Lower case column names with MySQL SELECT?
- How to sort domain names in MySQL?
- How to display the column names from a table excluding some in MySQL?
- Calculate frequency of duplicate names from NAME field using MongoDB aggregate?