PostgreSQL

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


You can also test for the literal characters listed in Table 4.5. Use of a backslash removes any special meaning from the character that follows it. For example, to test for a dollar sign, use $. To test for an asterisk, use *. To test for a literal backslash, use two backslashes ().


Because regular expressions are so powerful, creating them can be challenging. Try some queries on the friend table until you are comfortable with regular expression comparisons.

4.11    Case Clause


Many programming languages have conditional statements, stating if condition is true then do something, else do something else. This kind of structure allows execution of statements based on some condition. Although SQL is not a procedural programming language, it does allow conditional


test=> select * from friend test-> 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


| Ocean City


| nj


|


25


Sandy


| Weber


| Boston


| ma


|


33


Victor


| Tabor


| Williamsport


| pa


|


22

(6 rows)


test=> — firstname begins with ‘S’ test=> SELECT * FROM friend test-> WHERE firstname » ‘»S’ test-> ORDER BY firstname;

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