Re: When To Use Quotes

From: "Plugge, Joe R(dot)" <JRPlugge(at)west(dot)com>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>, "PostgreSQL (SQL)" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: When To Use Quotes
Date: 2012-01-05 14:00:06
Message-ID: BD69807DAE0CE44CA00A8338D0FDD0830311CD51BE@oma00cexmbx03.corp.westworlds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Should match to the data type of the filtered value, so CHAR,VARCHAR,All DATE TYPES should be quoted. INTEGER, BIGINT, SMALLINT should not ....

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Carlos Mennens
Sent: Thursday, January 05, 2012 7:56 AM
To: PostgreSQL (SQL)
Subject: [SQL] When To Use Quotes

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'?

--
Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2012-01-05 17:52:26 Re: Fwd: i want small information regarding postgres
Previous Message Carlos Mennens 2012-01-05 13:55:30 When To Use Quotes