Exercise 1: "Happens to Work" vs. "Guaranteed to Work" — Possible Solution ==================================================================== WHAT'S THE SAME IN BOTH COURSES ------------------------------ Neither course escapes the underlying fact that SQLite has no native date type - both the sibling's expiry_date and this course's expiryDate ultimately end up stored as text in the actual database file. Both comparisons, at the storage level, are ultimately text comparisons. WHY THE SIBLING'S VERSION ONLY "HAPPENS" TO WORK ------------------------------ The sibling's schema declares expiry_date as a plain TEXT column, which places no constraint at all on what shape a stored value takes. The comparison expiry_date <= date('now', '+3 days') gives the correct chronological answer only because every value that has ever been written to that column happens to use YYYY-MM-DD consistently - a fact that depends entirely on every developer, every time, remembering to format dates that way. Nothing in the schema or the database itself would catch a value stored in a different format; the comparison would just silently give a wrong answer. WHY THIS COURSE'S VERSION IS STRUCTURALLY GUARANTEED ------------------------------ expiryDate is declared as DateTime in schema.prisma, and Prisma Client serializes every value written to a DateTime field the same consistent way, every time, as part of how it constructs the underlying query - there is no code path through this app's own Prisma-based routes that could write an inconsistently-formatted date. The comparison still relies on the stored values being consistently formatted underneath - but here, that consistency is enforced by the type system itself, not left to be maintained by hand. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly identifies that both courses share the same underlying storage mechanism (text), and correctly locates the real difference not in some entirely different comparison mechanism, but in who or what guarantees the formatting consistency the comparison actually depends on - developer discipline versus the type system.