tut1 3


GISQ: Tutorial One: Notes 3






A Gentle
Introduction
to



SQL

Tutorial One
Notes 3

CIA World Factbook
Using nested select statements
The result of a SELECT statement may be used as a value in another
statement. For example the statement SELECT region FROM cia WHERE
name = 'Brazil' evaluates to 'South America' so we can use this
value to obtain a list of all countries in the same region as 'Brazil'

SELECT name FROM cia WHERE region = (SELECT region FROM cia WHERE name = 'Brazil') Note that this is not the same thing as a join.
Observe the tables which result from each of the following

SELECT name FROM cia WHERE region = (SELECT region FROM cia WHERE name = 'Belarus')
The countries in the same region as Belarus.

name
Armenia
Azerbaijan
Belarus
Moldova
Ukraine






Wyszukiwarka

Podobne podstrony:
tut1 4
gui tut1
tut1 1
tut1 1
tut1 4
tut1 2
tut1 4
tut1
TUT1
tut1 1
tut1
ED!TUT1
tut1 5
tut1 2
Tut1
Tut1
tut1 2
tut1 3
tut1 3

więcej podobnych podstron