Two integration scripts fail overnight. The first stops immediately, before processing any rows, with the message unexpected token near FROM. The second processes 10,000 rows successfully and then stops with a division by zero error. How should these failures be classified?
Select an answer to reveal the explanation.
Short Explanation
A syntax error is a typo the engine spots before it even starts, like a recipe with a missing step that you notice while reading it. A runtime error shows up halfway through cooking when something unexpected happens, like dividing by an empty bowl. If zero rows ran, think syntax; if thousands ran first, think runtime.
Full Explanation
Programming errors in data acquisition fall into two broad classes. Syntax errors violate the grammar of the language, such as a misplaced keyword, missing comma or unbalanced parenthesis, and are detected when the code is parsed or compiled, before any statement executes. An unexpected token message raised before any row is processed is the hallmark of a syntax error. Runtime errors occur while syntactically valid code is executing, when it meets a condition it cannot handle, such as dividing by zero, converting an invalid value, or referencing a missing object. Processing 10,000 rows and then failing on a division by zero is a runtime error triggered by a specific data value. Reversing the classifications contradicts the evidence, because the parse failure happened before execution and the arithmetic failure happened during it. Classifying both as syntax errors because neither committed confuses transaction outcome with error type; commit behavior depends on transaction design, not on error class. Classifying both as runtime errors because they appeared when the scripts ran ignores that a parse failure prevents execution from starting. Exam caveat: runtime errors are often data-dependent, so defensive code, such as handling zero divisors or validating input, matters as much as fixing syntax. Operational check: run scripts through a parser or linter in CI to catch syntax errors before deployment, and log the failing row's key for runtime errors.