I’ve been playing with databases a bit lately for a small file tagging project I’m working on at home. My muse has inspired me to investigate cataloging methods and my files seemed to be a good start. More updates on this as it continues to grow.
Many of you probably know this, but I couldn’t seem to find it on the Net. I was probably searching on the wrong thing, but wanted to make sure I helped out all of the other MySQL users out there.
I created some tables using the gui from OpenOffice.org Base and put spaces into the table names. Surprising to me, it was ok with the spaces. When I tried using the mysql command line client later, I found that I couldn’t figure out how to reference them.
Yes, Virginia, you can have spaces in your database table names. This is how you referenced them:
SELECT * FROM `My Table`
Those special characters there are not apostrophes (‘), but backticks (`). Slight difference. The symbol is on the same key as the tilde (~) on your keyboard.
In theory the ` should also work for fields with spaces in them too.
Supposedly Microsoft SQL Server uses brackets ([]) to handle tables and fields with spaces in them, but MySQL does not seem to follow this convention. I hadn’t checked Oracle, Sybase, or PostgreSQL.
And, now I’ve been bad and stayed up too late again. G’night folks!