开发者

Pros and Cons of table name having spaces

开发者 https://www.devze.com 2023-01-31 00:24 出处:网络
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.

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.


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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消