VbzCart/coding/integrity checks

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< VbzCart‎ | coding
Revision as of 22:04, 16 July 2019 by Woozle (talk | contribs) (fixed markup tags)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Table-specific checks:

Cross-table checks

Package Lines and Order Lines which don't agree about what ID_Item they're tracking:

SELECT 
    *
FROM
    ord_pkg_lines AS pl
        JOIN
    ord_lines AS ol ON pl.ID_OrdLine = ol.ID
WHERE
    ol.ID_Item != pl.ID_Item

Package lines whose Order Line is either not set or nonexistent(!):

SELECT 
    pl.*
FROM
    ord_pkg_lines AS pl
        LEFT JOIN
    ord_lines AS ol ON pl.ID_OrdLine = ol.ID
WHERE
    ol.ID IS NULL