Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

Can I use periods "." in field names?

Dr. Dave's profile image Dr. Dave posted 11 years ago in General Permalink
I hope it's okay to post this question here, as it doesn't particularly relate to HeidiSQL.

I'd like to create a field in one of my tables. Instead of using an underscore "_" to separate 2 words, like "first_name", I want to use a period, like "first.name"

Is this legal?

(no, I'm not interested in using "firstName" or "first_name", unless I absolutely have to)


:)

Thanks in advance.
kalvaro's profile image kalvaro posted 11 years ago Permalink
According to documentation the dot character is allowed in field names:

http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

I suppose you'll have to quote it every time:

SELECT `first.name`FROM users

If it's a good idea or not, I leave it to you ;-)
Dr. Dave's profile image Dr. Dave posted 11 years ago Permalink
Thank you, you're absolutely correct.

I found this:
Before MySQL 5.1.6, database and table names cannot contain
Code modification/commit from ansgar.becker, 9 years ago, revision 3559
The 3 procedures Parse(Table|View|Routine)Structure() already do some connection specific stuff, and now even more, so they're moved to TMySQLConnection now. In order to display the right collation even if only the character set was found in a CREATE TABLE code, the default collation per charset is detected via CollationTable. See http://www.heidisql.com/forum.php?t=6348 .

Please login to leave a reply, or register at first.