freddie
freddie

Reputation: 41

Pros and Cons of table name having spaces

In one of my project, it was required to have a table with space in between. Some suggest me not to include spaces because it is not a good technique.

we can still implement it using single-double quotes for table name in queries. But i need a solid backing for not opting spaces. Please help.

Upvotes: 4

Views: 6534

Answers (2)

Conrad Frix
Conrad Frix

Reputation: 52645

It makes it harder to read, creates complexity if you ever want to do dynamic SQL. Spaces in the tables names on the other hand add no value whatsoever.

Mr. Anderson points out that its tedious. This is true enough, but more importantly it adds unnecessary tediousness.

Upvotes: 8

user330315
user330315

Reputation:

I would never use spaces (nor other special characters) in table or column names.

Out of lazyness is one point (so typing SQL queries is a lot easier because you don't need those dreaded quotes)

Secondly a lot of tools out there might still have problems with non-standard table names.

Btw: the quote character for non-standard object names is a double quote (") If you really go down that road, I would highly recommend to put MySQL into "ANSI Mode" in order to be compatible with the rest of the (DBMS) world.

(Single quotes are for character literals, double quotes for "escaping" non-standard names)

Upvotes: 4

Related Questions