Special Character Operators

[Special Characters][A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z]

:= The equal operator

(query (:select 'id 'name :from 'regions :where (:= 'name "South America"))) ((7 "South America"))

:+ The Plus operator

(query (:select (:+ 'id 12) 'name :from 'regions :where (:= 'name "South America"))) ((19 "South America"))

:<> The Not Equals or Greater or Lesser than operators

The not equals operator

(query (:select 'id 'name :from 'regions :where (:<> 'name "Africa"))) ((3 "Central America") (5 "Middle East") (6 "North America") (7 "South America") (8 "Central Asia") (9 "Pacific") (10 "Caribbean") (11 "Eastern Europe") (4 "Western Europe") (2 "Asia"))

:|| Concatenating Columns

The concatenation operator combines two or more columns into a single column return. First, consider the query on a raw sql string:

(query "(SELECT countries.id, (countries.name || '-' || regions.name) FROM countries, regions WHERE ((regions.id = countries.region_id) and (countries.name = 'US')))") ((21 "US-North America"))

Now consider the result using s-sql.

(query (:select 'countries.id (:|| 'countries.name "-" 'regions.name) :from 'countries 'regions :where (:and (:= 'regions.id 'countries.region-id) (:= 'countries.name "US")))) ((21 "US-North America"))
Comments