Sam Stephenson
Sam Stephenson

Reputation: 5190

SQL, How to select a column from mysql with a "/" in it

I have a MySQL column called post/zip_code. If I try to put this into an SQL query like this:

SELECT post/zip_code

It will not read post/zip_code as one string. How do I reference the name?

Upvotes: 1

Views: 58

Answers (1)

Kevin Bowersox
Kevin Bowersox

Reputation: 94459

 SELECT `post/zip_code`

Wrap the column name in back ticks.

According to the MySql Documentation for schema object names:

The identifier quote character is the backtick (“`”):

Documentation

Upvotes: 2

Related Questions