Mega Code Archive

 
Categories / MySQL / Table Index
 

Alias column with spaces

mysql> mysql> # create a table called "bookshelf" mysql> CREATE TABLE IF NOT EXISTS bookshelf     -> (     ->   reader CHAR(50)        NOT NULL,     ->   book           CHAR(50)        NOT NULL     -> ); Query OK, 0 rows affected (0.00 sec) mysql> mysql> # insert 1 record into the "bookshelf" table mysql> INSERT INTO bookshelf (reader, book)   VALUES ("new_to_SQL", "SQL in easy steps by Mike McGrath"); Query OK, 1 row affected (0.00 sec) mysql> mysql> mysql> SELECT book     -> AS "The Ideal Introduction to SQL"     -> FROM bookshelf     -> WHERE reader = "new_to_SQL"; +-----------------------------------+ | The Ideal Introduction to SQL     | +-----------------------------------+ | SQL in easy steps by Mike McGrath | +-----------------------------------+ 1 row in set (0.00 sec) mysql> mysql> mysql> DROP TABLE IF EXISTS bookshelf; Query OK, 0 rows affected (0.00 sec)