Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Set Blank spaces in column names with MySQL?
To set blank spaces in column names with MySQL, you can use the concept of backticks. Let us first create a table. Following is the query −
mysql> create table blankSpacesDemo -> ( -> `Student Id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> `Student Full Name` varchar(100) -> ); Query OK, 0 rows affected (0.51 sec)
Following is the query to insert some records in the table using insert command −
mysql> insert into blankSpacesDemo(`Student Full Name`) values('John Smith');
Query OK, 1 row affected (0.16 sec)
mysql> insert into blankSpacesDemo(`Student Full Name`) values('Carol Taylor');
Query OK, 1 row affected (0.14 sec)
mysql> insert into blankSpacesDemo(`Student Full Name`) values('David Miller');
Query OK, 1 row affected (0.15 sec)
Following is the query to display all records from the table using a select statement −
mysql> select `Student Id`,`Student Full Name` from blankSpacesDemo;
Following is the output displaying blank space in column name “Student Full Name” −
+------------+--------------------+ | Student Id | Student Full Name | +------------+--------------------+ | 1 | John Smith | | 2 | Carol Taylor | | 3 | David Miller | +------------+--------------------+ 3 rows in set (0.00 sec)
Advertisements
