Column name with spaces

From SQLZOO
Revision as of 12:14, 11 July 2012 by Marek (Talk | contribs) (Created page with "SELECT a column whose name contains spaces? <div class='ht'> <div> You can access columns where the name contains a space. </div> <source lang=sql class='tidy'>DROP TABLE Spac...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SELECT a column whose name contains spaces?

You can access columns where the name contains a space.

DROP TABLE SpaceMonster
CREATE TABLE SpaceMonster([Account Balance] INT);
INSERT INTO SpaceMonster VALUES (42);
SELECT [Account Balance] FROM SpaceMonster
CREATE TABLE SpaceMonster(`Account Balance` INT);
INSERT INTO SpaceMonster VALUES (42);
SELECT `Account Balance` FROM SpaceMonster
CREATE TABLE SpaceMonster("Account Balance" INT);
INSERT INTO SpaceMonster VALUES (42);
SELECT "Account Balance" FROM SpaceMonster