Table of Contents

Conditional SQL cheat sheet

Optional value

WHERE ArtistId = ?@artistId

Conditional variables

Named marker

WHERE /*ByArtist*/ ArtistId = @artistId
builder.Use("ByArtist");

Markers

Parameter marker

WHERE /*@artistId*/ ArtistId = @artistId

Markers

Marker logic

/*A&B*/
/*A|B*/
/*!A*/

Markers

Collection

WHERE AlbumId IN (@ids_X)

Collection expansion

Optional collection

WHERE AlbumId IN (?@ids_X)

Collection expansion

Numeric text

OFFSET @skip_N ROWS

Value handlers

Quoted text

ORDER BY @name_S

Value handlers

Raw text

ORDER BY @orderBy_R

Value handlers

Dynamic projection

?SELECT
    AlbumId AS Id!,
    Title,
    ReleaseYear AS Year
FROM albums

Dynamic projection

Projection group

?SELECT
    ArtistId&,
    ArtistName AS Artist,
    AlbumId AS Id!
FROM albums

Dynamic projection

Optional modifier

???Distinct DISTINCT
?SELECT AlbumId AS Id!, Title FROM albums

Dynamic projection

Normal block comment

/*~ sent to the database */

Template syntax