Column name with spaces

From SQLZOO
Revision as of 12:14, 11 July 2012 by Marek (Talk | contribs)

(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
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense