PostgreSQL

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


Complex where clause tests are done by connecting simple tests using the words and and or. For illustration, new people have been inserted into the friend table, as shown in Figure 4.10. Selecting certain rows from the table will require more complex where conditions. For example, if we wanted to select Sandy Gleason by name, it would be impossible using only one comparison


test=> DELETE FROM friend;


DELETE 6


test=> INSERT INTO friend


test-> VALUES (‘Dean’, ‘Yeager’, ‘Plymouth’, ‘MA’, 24);


INSERT 19744 1


test=> INSERT INTO friend


test-> VALUES (‘Dick’, ‘Gleason’, ‘Ocean City’, ‘NJ’, 19);


INSERT 19745 1


test=> INSERT INTO friend


test-> VALUES (‘Ned’, ‘Millstone’, ‘Cedar Creek’, ‘MD’, 27);


INSERT 19746 1


test=> INSERT INTO friend


test-> VALUES (‘Sandy’, ‘Gleason’, ‘Ocean City’, ‘NJ’, 25);


INSERT 19747 1


test=> INSERT INTO friend


test-> VALUES (‘Sandy’, ‘Weber’, ‘Boston’, ‘MA’, 33);


INSERT 19748 1


test=> INSERT INTO friend


test-> VALUES (‘Victor’, ‘Tabor’, ‘Williamsport’, ‘PA’, 22); INSERT 19749 1


test=> SELECT * FROM friend ORDER BY firstname;


firstname


| lastname


| city


| state


|


age


Dean


| Yeager


| Plymouth


| MA


|


24


Dick


| Gleason


| Ocean City


| NJ


|


19


Ned


| Millstone


| Cedar Creek


| MD


|


27


Sandy


| Gleason

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