|
See Also
In USoft Rule Language, the
CONNECTED AS keyword corresponds to the SQL RELATE keyword.
In general, USoft Rule Language-specific keywords only appear in
the main query or statement, that is to say, at the beginning of
the statement. In contrast, CONNECTED AS can be used anywhere in
the USoft Rule Language statement, including in subqueries.
|
USoft Rule Language
|
SQL Equivalent
|
|
FOR
drivers d
, contracts c
, "Business Parties" b
CONNECTED AS
b "PAYS FOR" c
DO NOT ALLOW THAT
b.id = d.id
and c.paid = 'N'
|
select ''
from driver d
, contract c
, business_party b
relate b "PAYS FOR" c
where b.id = d.id
and c.paid = 'N'
|
In USoft Rule Language, RELATE may not be used immediately
following the initial FOR clause. Only CONNECTED AS is allowed
here:
|
USoft Rule Language,
Illegal
|
|
FOR
drivers d
, contracts c
, "business parties" b
relate
b "PAYS FOR" c
DO NOT ALLOW THAT
b.id = d.id
and c.paid = 'N'
|
In USoft Rule Language subqueries, CONNECTED AS and RELATE are
both legal:
|
FOR
drivers d
DO NOT ALLOW THAT
exists
(
select
''
from
contract c
,
business_party b
CONNECTED AS
b "PAYS FOR" c
where
b.id = d.id
and
c.paid = 'N'
)
|
In both USoft Rule Language and SQL, there is the alternative
option to express relationships with equality conditions instead of
a relationship keyword:
|
USoft Rule Language
|
SQL Equivalent
|
|
FOR
drivers d
, contracts c
, "Business Parties" b
DO NOT ALLOW THAT
b.contract_code =
c.code
and b.id = d.id
and c.paid = 'N'
|
select ''
from driver d
, contract c
, business_party b
where b.contract_code = c.code
and b.id = d.id
and c.paid = 'N'
|
|