Show Menu
Cheatography

PSEUDO-SQL Cheat Sheet (DRAFT) by

This cheat cheat defines PSEUDO-SQL, a language based on SQL and intended to be used in flowcharts to express handling of data in a process

This is a draft cheat sheet. It is a work in progress and is not finished yet.

General format

General idea
PSEUDO-SQL (PQL in this context) is a formal data processing language with non-formal data defini­tions
formal
In the scope of this language we speak of "­for­mal­" when the keywords and syntax is exactly defined like in a progra­mming language or real SQL
non-formal
In the scope of this document non-formal elements, if thosw elements are not, or not fully defined and are to be stated in such a wayx that they make sense in plain language. So we may for example reference a full-a­ddress in a statement where as in a real database this would be split into several fields
Keywords & Syntax
The language keywords (i.e. language tokens) and syntax are formally defined. But informal statements may be introduced by the user
Basic PQL statment
The basic PQL statement differs from the standard SQL in that the destin­ation is usually only a name for the result of the statement. The destin­ation and source may have the same name, stating that the source record set is to be updated. In general the result of this statement is a new destin­ation record set which would override any existing one with same name
SELECT destin­ation FROM source ...
Record sets
A record set is a list of records which is not formally defined. I.e. it is not mandatory that all records explic­itely have the same columns available (see Missing columns).
Initial record set(s)
Initial record sets are those which are used as source without being created by any previous PQL statement. In most cases it will not be necessary to formally introduce these as they should be informally compre­hen­sible.
Identi­fiers
Identi­fiers are names which are composed of alphan­umeric character, underscore and/or minus but no space. Identi­fiers shall also start with a letter or underscore
Informal columns
Column names should be informal, and thus meaning full by their name. Columns are virtual and can represent any simple or complex concept (like the employ­ee-­off­ice­-nu­mbe­r-a­nd-­add­ress)
Formal columns
Sometimes informal column identi­fiers may get too cumbersome to describe its full usage and scope. In these cases columns may be formally defined using an informal descri­ption. The recordset name is optional in case the column is to be globally available
DEFINE [<r­eco­rds­et>.]<­col­umn> AS <de­sci­pti­on>
 
This definition simply reuses a previous column definition and may optionally alter its definition via another informal descri­ption
DEFINE <re­cor­dse­t>.<­co­lum­n> = [<r­eco­rds­et>­].c­olu­mn> BUT <de­scr­ipt­ion>
Missing columns
As described in the record sets topic, records in a record set are not expected to each have the same set of columns. This is handled by a set of formal rules below
 
RULE 1: tests
Missing columns being assumed empty they behave like empty columns in any test
 
RULE 2: assignment
Any value assigned to an non-ex­istent column virtually creates that column in the given record. This rule generally allows to add new columns to any recordsetz
WHERE condition
Just like in plain SQL, PSQ allows to filter records via the WHERE keyword. The conditions are PQL specific however
JOINS
Joins being pure SQL database technical statments, they are not used in PQL. If at any time select data from several record sets are required as source, a record set should be previously created by a PQL statement making it easier compre­hen­sible

Conditions

'condi­tion' or ('cond­ition')
Informal conditions are to be written in single quotes. Additional parent­hesis may be added for better readab­ility where required
NOT | AND | OR
Boolean operators in order of precedence (highest to lowest)
( condition )
Conditions can be grouped in parent­hesizes to manage proper precedence