The main benefit is that it's easier to construct the schema from several
places, with proper indentation.
Also, sql knows a bit about sql, so it's able to
- know which column is a foreign key, just reference the table
- remove table aliases when they're not needed
- leave table names out in table.column when there's no ambiguity.
For instance, view Ports now looks like:
CREATE VIEW Ports AS
SELECT
Id AS PathId,
_Paths.FullPkgPath AS FullPkgPath,
_AutoVersion.Value AS AUTOCONF_VERSION,
T0001.Value AS AUTOMAKE_VERSION,
[...]
FROM _Ports
JOIN _Paths
ON Canonical=_Ports.FullPkgPath
LEFT JOIN _AutoVersion
ON _AutoVersion.KeyRef=AUTOCONF_VERSION
LEFT JOIN _AutoVersion T0001
ON T0001.KeyRef=AUTOMAKE_VERSION
instead of:
CREATE VIEW Ports AS
SELECT
T0057.Id AS PathId,
T0057.FULLPKGPATH AS FULLPKGPATH,
T0058.VALUE AS AUTOCONF_VERSION,
T0059.VALUE AS AUTOMAKE_VERSION,
[...]
FROM _Ports
JOIN _Paths T0057
ON T0057.Canonical=_Ports.FULLPKGPATH
LEFT JOIN _AutoVersion T0058
ON T0058.KEYREF=_Ports.AUTOCONF_VERSION
LEFT JOIN _AutoVersion T0059
ON T0059.KEYREF=_Ports.AUTOMAKE_VERSION