What is the purpose of USING Operator in the ORDER BY clause of PostgreSQL?

 Posted by Niladri.Biswas on 2/10/2013 | Category: PostgreSQL Interview questions | Views: 4640 | Points: 40
Answer:

It is a short hand notation of Descending and Ascending .e.g.

CREATE TABLE test

(
id serial NOT NULL,
"number" integer,
CONSTRAINT test_pkey PRIMARY KEY (id)
)

insert into test("number") values (1),(2),(3),(0),(-1);

select * from test order by number USING > //gives 3=>2=>1=>0=>-1

select * from test order by number USING < //gives -1=>0=>1=>2=>3


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response