← Amazon Interview Insights

Amazon·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Amazon BIE-style SQL interview for a Data Scientist role, focused on relational fundamentals. Three questions, all conceptual, no actual query writing required which surprised me a bit.

Questions Asked (3)

Q1

What is the difference between DELETE and TRUNCATE, and when would you choose one over the other?

Technical Trade-offsData Modeling
Author's notes

I knew the basics but fumbled the transactional logging part.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining DELETE and TRUNCATE in terms of their SQL semantics, focusing on differences in logging, transaction behavior, and performance. Then, connect these technical differences to practical scenarios a data scientist at Amazon might encounter, such as ETL pipelines, data cleaning, or iterative model training. Conclude by explaining when to choose each based on factors like data volume, need for rollback, and impact on dependent objects.

Pro tip: Mention that TRUNCATE is DDL and implicitly commits, so it cannot be rolled back in some databases, while DELETE is DML and fully logged—this shows you understand transaction safety and recovery, which is critical in production data workflows.

1. Define DELETE

Explain that DELETE is a DML command that removes rows one by one, logs each deletion, can be rolled back, and supports a WHERE clause.

2. Define TRUNCATE

Explain that TRUNCATE is a DDL command that quickly removes all rows by deallocating data pages, minimally logs, and typically cannot be rolled back (varies by DBMS).

3. Compare key differences

Highlight differences in performance, logging, transaction safety, triggers, identity column reset, and locking behavior.

4. Relate to data science scenarios

Give examples: use DELETE for selective row removal (e.g., removing outliers or specific experiments), and TRUNCATE for quickly clearing staging tables before reloading in ETL.

5. State decision criteria

Summarize when to choose each: DELETE for granular control and rollback; TRUNCATE for speed and full-table clearing when rollback isn't needed.

Key Points to Mention

  • DELETE is DML, TRUNCATE is DDL.
  • DELETE supports WHERE clause; TRUNCATE removes all rows.
  • DELETE logs individual row deletions; TRUNCATE logs page deallocations, making it faster.
  • DELETE can be rolled back (if in a transaction); TRUNCATE often cannot (implicit commit).
  • TRUNCATE resets identity columns; DELETE does not.
  • TRUNCATE cannot be used on tables referenced by foreign keys; DELETE can (with cascading or constraints).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How does a VIEW differ from a physical table, and what are the tradeoffs of using one versus the other?

Technical Trade-offsData Modeling
Author's notes

This one I actually felt okay about.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining what a view is (a stored query) versus a physical table (stored data), then contrast their storage, performance, and maintenance characteristics. Finally, discuss trade-offs in the context of a data science workflow, emphasizing when to use each for analytics, ETL, and production pipelines.

Pro tip: Mention that views can be used to enforce security and simplify complex joins, but for heavy analytical queries, materialized views or physical tables often provide better performance. Also, highlight that views don't store data, so they always reflect the latest data, which is crucial for real-time dashboards.

1. Define a view and a physical table

Explain that a view is a virtual table defined by a SQL query, storing no data itself, while a physical table stores data on disk.

2. Compare storage and data freshness

Discuss that views don't consume storage (except for materialized views) and always show current data, whereas tables store data and may be stale if not refreshed.

3. Analyze performance implications

Explain that querying a view executes the underlying query each time, which can be slower for complex views, while tables can be indexed for faster access.

4. Discuss maintenance and security

Mention that views can simplify complex queries and provide column-level security, but may require updates if underlying schema changes; tables require data management but offer more control.

5. Relate to data science use cases

Give examples: use views for ad-hoc analysis, data abstraction, and security; use tables for performance-critical ETL, model training, and when data needs to be persisted.

Key Points to Mention

  • Views are virtual and do not store data; tables store data physically.
  • Views can simplify complex queries and abstract underlying schema changes.
  • Performance: views may be slower due to query re-execution; tables can be optimized with indexes.
  • Materialized views store data and can improve performance but require refresh.
  • Security: views can restrict access to specific rows/columns.
  • Use cases: views for real-time, simplified access; tables for persistent, high-performance needs.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

What does a CROSS JOIN produce, and can you give a realistic scenario where you'd actually use one?

Data ModelingTechnical Trade-offs
Author's notes

Cartesian product, sure, said that immediately.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining CROSS JOIN as a Cartesian product that pairs every row from one table with every row from another, emphasizing it has no join condition. Then pivot to a realistic scenario where generating all combinations is intentional, such as creating a dense date-product grid for time series forecasting or A/B test assignment. Close by noting the performance implications and when to avoid it.

Pro tip: Frame CROSS JOIN as a deliberate tool for generating complete combination spaces, not a mistake—then show you'd guard against accidental explosions by checking row counts and using WHERE filters or LIMIT during exploration.

1. Define the operation precisely

State that CROSS JOIN returns the Cartesian product: if table A has m rows and table B has n rows, the result has m*n rows with every possible pairing. Mention there is no ON clause and it's equivalent to an INNER JOIN with a always-true condition.

2. Contrast with other joins

Briefly distinguish it from INNER/LEFT joins, which match on keys and typically reduce or preserve row counts. Highlight that CROSS JOIN is the only join that can massively increase row count without a filter.

3. Provide a realistic scenario

Describe a concrete use case, such as building a complete date-store or date-product skeleton for demand forecasting, where you need every combination to left join actual sales and fill missing values with zeros. Alternatively, mention generating all user-item pairs for a recommendation candidate set or creating a parameter grid for hyperparameter tuning.

4. Discuss trade-offs and safeguards

Explain that CROSS JOIN can explode data volume and should be used carefully. Mention techniques like filtering before joining, using LIMIT for exploration, or pre-aggregating to keep the Cartesian product manageable.

5. Tie back to business impact

Connect the scenario to a business outcome, such as ensuring no missing dates in a forecast or enabling unbiased A/B test assignment, showing you understand why the operation matters beyond syntax.

Key Points to Mention

  • Cartesian product definition and m*n row count
  • No join condition / ON clause
  • Difference from INNER and LEFT JOIN
  • Realistic scenario: dense date-product grid for time series
  • Realistic scenario: generating all user-item pairs for recommendations
  • Performance implications and safeguards (filtering, LIMIT, pre-aggregation)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.