Is there any good reasons that I should not use - (dash) in field names in MySQL?

I have field name category_id in product table.

And also I want name field of category id as category-id.

Is there any good reasons that I should not use - in a field name?

Where can I find which character I should not use in MySQL field and table name?

-------------Problems Reply------------

The major reason against use of hyphen is that most references must then quote the field names. Otherwise they will look like a subtraction operator, both to MySQL and humans.

You can take a look at the reserved words list

Generally, you can use whatever name you wish as long as you wrap it in backquotes.

Safest bet is to stick with alphanumerics + _. Thats pretty standard in terms of "safe" naming, as none of those characters can be misrepresented as operator symbols.

Category:mysql Views:0 Time:2010-01-05
Tags: mysql

Related post

  • DISCUSSION - Uploading and Storing Mass Images 2008-08-06

    So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB. What do you think are the pros/cons? --------------Solutions---------

  • storing files to a database or just to the local hard-disk? 2008-08-06

    So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB. What do you think are the pros/cons? --------------Solutions---------

  • How do I retrieve my MySQL username and password? 2008-08-07

    I lost my MySQL username and password. How do I retrieve it? --------------Solutions------------- Stop the MySQL process. Start the MySQL process with the --skip-grant-tables option. Start the MySQL console client with the -u root option. List all th

  • How do you properly mock an IEnumerable? 2008-08-07

    My latest disaster stumbling through mocking is not grokking that I need to actually push results inside a mock object of IEnumerable<T>. Here's a sample (demonstration only of IEnumerable<T>, not actually good interaction-based testing!)

  • Domain Specific Language resources 2008-08-07

    I was just listening to some older .Net Rocks! episodes, and I found #329 on DSLs to be interesting. My problem is that I can't find any good online resources for people trying to learn this technology. I get the basics of the creating new designers,

  • Video Compression: What is discrete cosine transform? 2008-08-07

    I've implemented an image/video transformation technique called discrete cosine transform. This technique is used in MPEG video encoding. I based my algorithm on the ideas presented at the following URL: http://vsr.informatik.tu-chemnitz.de/~jan/MPEG

  • How can I execute dynamic SQL in c#? 2008-08-07

    I can do an eval("something()"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#? What I am exactly trying to do is that I have an integer variable (say i) and I have multiple properties by the names: "

  • C# eval code from string 2008-08-07

    I can do an eval("something()"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#? What I am exactly trying to do is that I have an integer variable (say i) and I have multiple properties by the names: "

  • Is a "Confirm Email" input good practice when user changes email address? 2008-08-07

    My organization has a form to allow users to update their email address with us. It's suggested that we have two input boxes for email: the second as an email confirmation. I always copy/paste my email address when faced with the confirmation. I'm as

  • What point should someone decide to switch Database Systems 2008-08-07

    When developing whether its Web or Desktop at which point should a developer switch from SQLite, MySQL, MS SQL, etc --------------Solutions------------- It depends on what you are doing. You might switch if: You need more scalability or better perfor

  • Should I use the username, or the user's ID to reference authenticated users in ASP.NET 2008-08-07

    So in my simple learning website, I use the built in ASP.NET authentication system. I am adding now a user table to save stuff like his zip, DOB etc'. My question is: In the new table, should the key be the user name (the string) or the user ID which

  • Locking a SQL Server Database with PHP 2008-08-07

    I'm wanting extra security for a particular point in my web app. So I want to lock the database (SQL Server 2005). Any suggestions or is this even necessary with SQL Server? Edit on question: The query is failing silently with no errors messages logg

  • Bigger than a char but smaller than a blob 2008-08-07

    Char's are great because they are fixed size and thus make for a faster table. They are however limited to 255 characters. I want to hold 500 characters but a blob is variable length and that's not what I want. Is there some way to have a fixed lengt

  • Securing a linux webserver for public access 2008-08-07

    I'd like to set up a cheap Linux box as a web server to host a variety of web technologies (PHP & Java EE come to mind, but I'd like to experiment with Ruby or Python in the future as well). I'm fairly versed in setting up Tomcat to run on Linux

  • Firebird's SQL's Substring function not working 2008-08-07

    I created a view on a machine using the substring function from Firebird, and it worked. When I copied the database to a different machine, the view was broken. This is the way I used it: SELECT SUBSTRING(field FROM 5 FOR 15) FROM table; And this is

  • SQL Server Management Studio alternatives to browse/edit tables and run queries 2008-08-07

    I was wondering if there are any alternatives to Microsoft's SQL Server Management Studio? Not there's anything wrong with SSMS, but sometimes it just seem too big an application where all I want todo is browse/edit tables and run queries. ----------

  • Templates for lifecycle documentation 2008-08-07

    Does anybody have some good templates (or links to) that they use for software lifecycle documents (feasibility, concept, requirements, architecture)? I've taken some old ones I've had from school and slimmed them down a bit since none of the current

  • Why can't I use a try block around my super() call? 2008-08-07

    So, in Java, the first line of your constructor HAS to be a call to super... be it implicitly calling super(), or explicitly calling another constructor. What I want to know is, why can't I put a try block around that? My specific case is that I have

  • What is the difference between a bug and a change request in MSF for CMMI? 2008-08-07

    I'm currently evaluating the MSF for CMMI process template under TFS for use on my development team, and I'm having trouble understanding the need for separate bug and change request work item types. I understand that it is beneficial to be able to d

  • Python, Unicode, and the Windows console 2008-08-07

    When I try to print a Unicode string in a Windows console, I get a UnicodeEncodeError: 'charmap' codec can't encode character .... error. I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.105 (s). 11 q(s)