Thread: Syntax style

    #1
  1. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    706
    Rep Power
    203

    Syntax style


    Hey everyone. I've noticed that on some of the tools I use the produce sql code they put single quotes around table names and field names, so it would look like

    Code:
    select 'someField' from 'your_table'
    Any idea why they add these? Just curious
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,732
    Rep Power
    4288
    Originally Posted by Dameon51
    ...they put single quotes around table names and field names
    take another look, those are not single quotes, they're backticks

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

    unless you use a special character in a table or column name or use a reserved word as a table or column name (hint: you shouldn't), the backticks are ~not~ required

    and most tools have an option so that they can be suppressed

    Comments on this post

    • Dameon51 agrees : Thanks for the info!
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo