The invalid rate hides behind zero
CAST, GLOB, why a CHECK cannot see the source · level 1 of 6
Opening your saved work…
Sign in to save across devices → · Download your guest work before switching accounts.
The invalid rate hides behind zero · CAST, GLOB, why a CHECK cannot see the source · level 1 of 6
The text beside its conversion
Put each staged rate beside what CAST makes of it: serial, daily_rate and converted_rate for all six rows, in file order.
Data: Trail Gear: build rehearsal.
Why it works, clause by clause
- daily_rate is the text as it arrived: 8, 12, 9, -3, unknown and 10.
- CAST(daily_rate AS INTEGER) AS converted_rate: what a load would store. Five rows convert to the number you would expect.
- TG-105's unknown converts to 0. No error, no warning, and nothing in converted_rate says it was ever a word.
From the reading: CAST converts; it does not certify, paragraph 1
SELECT serial, daily_rate, CAST(daily_rate AS INTEGER) AS converted_rate
FROM stg_items
ORDER BY rowid;Query results
Run it to see the result here.Run it to see the result here.
Practice here is evidence for you and your instructor, never a grade. Grades live in Canvas.