SQLzoo: Tutorial One:
Using multiple results in SQL
There are some SQL conditions which permit lists. For example the 'IN' operator tests a single value against a list of values. The following will execute safely no matter how many Brazils we have.
A nested SELECT using IN:
SELECT name FROM cia WHERE region IN (SELECT region FROM cia WHERE name = 'Brazil')
There are other operators such as 'ALL' and 'ANY'; these may be used in similar cases. I don't like them and I won't tell you about them.
0 Comments:
Post a Comment
<< Home