PostgreSQL

Скачать в pdf «PostgreSQL»


Comparison


Operator


less than


<


less than or equal


< =


equal


=


greater than or equal


> =


greater than


>


not equal


<> or ! =

Table 4.2: Comparison operators


test=> SELECT * test-> FROM friend


test-> WHERE age >= 22 AND age <= 25 test-> ORDER BY firstname;


firstname


| lastname


| city


| state


| age


Dean


| Yeager


| Plymouth


| MA


| 24


Sandy


| Gleason


| Ocean City


| nj


| 25


Victor


| Tabor


| Williamsport


| PA


| 22


(3 rows)

test=> SELECT *


test-> FROM friend


test-> WHERE age BETWEEN 22 AND 25


test-> ORDER BY firstname;


firstname


| lastname


| city


| state


| age


Dean


| Yeager


| Plymouth


| MA


| 24


Sandy


| Gleason


| Ocean City


| nj


| 25


Victor


| Tabor


| Williamsport


| PA


| 22


(3 rows)

Figure 4.15: Selecting a range of values


test=> SELECT * FROM friend test-> WHERE firstname LIKE ‘D%’ test-> ORDER BY firstname;


firstname


| lastname


| city


| state

Скачать в pdf «PostgreSQL»