Monday, March 5, 2012

SQL: exists

Today I figured out that we can use sql "exists" in the select part of a query

e.g. select name, exists (select 1 from girls where bf_name = boys.name) has_bf from boys b

result:
name has_bf
------------
A t
B f
C t

No comments:

Post a Comment