Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7933947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:29:12+00:00 2026-06-03T21:29:12+00:00

Once I had spent hours in debugging a simple SQL query using mysql_query() in

  • 0

Once I had spent hours in debugging a simple SQL query using mysql_query() in PHP/MySQL only to realise that I had missed bactick around the table name. From then I had been always using it around table names.

But when I used the same in SQLite/C++, the symbol is not even recognized. It’s confusing, whether to use this or not? What does standard say about usage of it?

Also, it would be helpful if anyone could tell me when to use quotes and when not. I mean around values and field names.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:29:13+00:00Added an answer on June 3, 2026 at 9:29 pm

    The SQL standard (current version is ISO/IEC 9075:2011, in multiple parts) says nothing about the ‘back-tick’ or ‘back-quote’ symbol (Unicode U+0060 or GRAVE ACCENT); it doesn’t recognize it as a character with special meaning that can appear in SQL.

    The Standard SQL mechanism for quoting identifiers is with delimited identifiers enclosed in double quotes:

    SELECT "select" FROM "from" WHERE "where" = "group by";
    

    In MySQL, that might be written:

    SELECT `select` FROM `from` WHERE `where` = `group by`;
    

    In MS SQL Server, that might be written:

    SELECT [select] FROM [from] WHERE [where] = [group by];
    

    The trouble with the SQL Standard notation is that C programmers are used to enclosing strings in double quotes, so most DBMS use double quotes as an alternative to the single quotes recognized by the standard. But that then leaves you with a problem when you want to enclose identifiers.

    Microsoft took one approach; MySQL took another; Informix allows interchangeable use of single and double quotes, but if you want delimited identifiers, you set an environment variable and then you have to follow the standard (single quotes for strings, double quotes for identifiers); DB2 only follows the standard, AFAIK; SQLite appears to follow the standard; Oracle also appears to follow the standard; Sybase appears to allow either double quotes (standard) or square brackets (as with MS SQL Server — which means SQL Server might allow double quotes too). This page (link AWOL since 2013 — now available in The Wayback Machine) documents documented all these servers (and was helpful filling out the gaps in my knowledge) and notes whether the strings inside delimited identifiers are case-sensitive or not.


    As to when to use a quoting mechanism around identifiers, my attitude is ‘never’. Well, not quite never, but only when absolutely forced into doing so.

    Note that delimited identifiers are case-sensitive; that is, "from" and "FROM" refer to different columns (in most DBMS — see URL above). Most of SQL is not case-sensitive; it is a nuisance to know which case to use. (The SQL Standard has a mainframe orientation — it expects names to be converted to upper-case; most DBMS convert names to lower-case, though.)

    In general, you must delimit identifiers which are keywords to the version of SQL you are using. That means most of the keywords in Standard SQL, plus any extras that are part of the particular implementation(s) that you are using.

    One continuing source of trouble is when you upgrade the server, where a column name that was not a keyword in release N becomes a keyword in release N+1. Existing SQL that worked before the upgrade stops working afterwards. Then, at least as a short-term measure, you may be forced into quoting the name. But in the ordinary course of events, you should aim to avoid needing to quote identifiers.

    Of course, my attitude is coloured by the fact that Informix (which is what I work with mostly) accepts this SQL verbatim, whereas most DBMS would choke on it:

    CREATE TABLE TABLE
    (
        DATE    INTEGER NOT NULL,
        NULL    FLOAT   NOT NULL,
        FLOAT   INTEGER NOT NULL,
        NOT     DATE    NOT NULL,
        INTEGER FLOAT   NOT NULL
    );
    

    Of course, the person who produces such a ridiculous table for anything other than demonstration purposes should be hung, drawn, quartered and then the residue should be made to fix the mess they’ve created. But, within some limits which customers routinely manage to hit, keywords can be used as identifiers in many contexts. That is, of itself, a useful form of future-proofing. If a word becomes a keyword, there’s a moderate chance that the existing code will continue to work unaffected by the change. However, the mechanism is not perfect; you can’t create a table with a column called PRIMARY, but you can alter a table to add such a column. There is a reason for the idiosyncrasy, but it is hard to explain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a server that is running Ubuntu Linux Server Edition. I once had
I once found a web site that had some 'Requires .net 1.0', 'Requires .net
I had once come across a post that said that we can use the
I recently spent many hours trying to fix a problematic ld script. Once I
I've spent about 10 hours trying to find this bug that was causing my
Once I had a file, to see the contents I used cat command, say
I hope someone can help me as I've already spent several hours trying to
I had been using the header() a lot in my application to redirect to
I am trying to do an SQL query to get the average spend for
I had created a Proxy Server (Fwd and Reverse) using Java sockets. which would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.