Use the EXISTS key word for TRUE / FALSE return:
select exists(select 1 from contact where id=12)
More Related Contents:
- PostgreSQL “Column does not exist” but it actually does
- Is SELECT or INSERT in a function prone to race conditions?
- Any downsides of using data type “text” for storing strings?
- Index for finding an element in a JSON array
- Query for array elements inside JSON type
- Calculating Cumulative Sum in PostgreSQL
- What is the expected behaviour for multiple set-returning functions in SELECT clause?
- Is it possible to make a recursive SQL query?
- Change PostgreSQL columns used in views
- Way to try multiple SELECTs till a result is available?
- How to set auto increment primary key in PostgreSQL?
- List columns with indexes in PostgreSQL
- PostgreSQL IF statement
- Split given string and prepare case statement
- Division of integers returns 0
- Postgres not using index when index scan is much better option
- SQL update fields of one table from fields of another one
- How to store array or multiple values in one column
- convert Postgres geometry format to WKT
- Which datatype should be used for currency?
- How to return two columns with function
- COPY with dynamic file name
- Table or column name cannot start with numeric?
- Count cumulative total in Postgresql
- PostgreSQL column ‘foo’ does not exist
- Prepared Statement on Postgresql in Rails
- SELECT DISTINCT is slower than expected on my table in PostgreSQL
- How to use SQL LIKE condition with multiple values in PostgreSQL?
- Why isn’t row level security enabled for Postgres views?
- Is there a postgres CLOSEST operator?