Decimal Precision and Rounding
Concepts covered: sqlDecimalType
When data flows between engines (Postgres to Snowflake via ETL; BigQuery to Iceberg via export; federated queries across systems), the type systems have to align. Each engine has its own precision rules, default sizes, and edge cases. Migrations and federations are where the differences surface. Numeric precision differences Postgres NUMERIC defaults to unlimited precision; specifying NUMERIC(10,2) gives 10 total digits with 2 after the decimal. Snowflake NUMBER defaults to (38,0); use NUMBER(10,2) for explicit precision. BigQuery NUMERIC is (38,9); BIGNUMERIC is (76,38). Casting a Postgres NUMERIC(10,4) to BigQuery NUMERIC works because (10,4) fits in (38,9); casting NUMERIC(38,12) to BigQuery NUMERIC loses precision (the scale of 12 exceeds 9). State this when migrating: 'the precision c
About This Interactive Section
This section is part of the Type Casting: Intermediate lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.
How DataDriven Lessons Work
DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.