USoft Rule Language Examples: Query Statements With Subquery

Previous Next

The USoft Rule Language DO NOT ALLOW THAT keyword corresponds to the SQL WHERE keyword that introduces the first conditional clause ("WHERE-clause"). This is illustrated in the following examples.

Examples:

USoft Rule Language

SQL Equivalent

FOR            drivers d
DO NOT ALLOW THAT EXISTS
(
   SELECT      ''
   FROM        contract c
   ,           business_party b
   RELATE      b "PAYS FOR" c
   WHERE       b.id = d.id
   AND         c.paid = 'N'
)

SELECT     ''
FROM       driver d
WHERE EXISTS
(
   SELECT      ''
   FROM        contract c
   ,           business_party b
   RELATE      b "PAYS FOR" c
   WHERE       b.id = d.id
   AND         c.paid = 'N'
)

FOR            drivers d
DO NOT ALLOW THAT 3 <
(
   SELECT      count(*)
   FROM        contract c
   ,           business_party b
   RELATE      b "PAYS FOR" c
   WHERE       b.id = d.id
   AND         c.paid = 'N'
)

SELECT      ''
FROM        driver d
WHERE 3 <
(
   SELECT      count(*)
   FROM        contract c
   ,           business_party b
   RELATE      b "PAYS FOR" c
   WHERE       b.id = d.id
   AND         c.paid = 'N'
)

FOR            drivers d
DO NOT ALLOW THAT d.age <
(
   SELECT      a.minimum_age
   FROM        application a
)

SELECT      ''
FROM        driver d
WHERE d.age <
(
   SELECT      a.minimum_age
   FROM        application a
)

 

See Also

USoft Rule Language