Check out example codes for "postgres declare variable". It will help you in understanding the concepts better.

Code Example 1

WITH myconstants (var1, var2) as (
   values (5, 'foo')
)
SELECT *
FROM somewhere, myconstants
WHERE something = var1
   OR something_else = var2;

Learn ReactJs, React Native from akashmittal.com