When To Use Quotes

From: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
To: "PostgreSQL (SQL)" <pgsql-sql(at)postgresql(dot)org>
Subject: When To Use Quotes
Date: 2012-01-05 13:55:30
Message-ID: CAAQLLO5u5Rr5txn7Ve4a90_gtxq8pzzej44+1JgdX5e7ukPXfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm trying to understand when in SELECT statements should and should I
not use single quotes to filter my results. For example:

SELECT * FROM people
WHERE fname = 'James';

or

SELECT * FROM price
WHERE msrb
BETWEEN 50 AND 100;

Now is it correct to say that in PostgreSQL or ANSI SQL in general I
should use 'single quotes' when the condition is strictly a numerical
data type value and everything else should be inside 'single quotes'?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Plugge, Joe R. 2012-01-05 14:00:06 Re: When To Use Quotes
Previous Message Feike Steenbergen 2012-01-05 06:20:36 Re: Current transaction is aborted, commands ignored until end of transaction block