PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates a candidate's understanding of SQL dialect differences between MySQL and MS SQL Server — including alias scope, CTE structure, ordering semantics, and lexical range comparisons that affect query portability and correctness.

  • Medium
  • Amazon
  • Data Manipulation (SQL/Python)
  • Data Scientist

Explain MySQL to MS SQL Server query syntax differences.

Company: Amazon

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

transactions | id | user_id | amount | txn_date | |----|---------|--------|----------| | 1 | 1001 | 25.00 | 2023-07-01 | | 2 | 1002 | 40.00 | 2023-07-02 | | 3 | 1001 | 15.00 | 2023-07-03 | | 4 | 1003 | 60.00 | 2023-07-03 | | 5 | 1001 | 30.00 | 2023-07-04 | ##### Scenario You are migrating analytics queries from MySQL to MS SQL Server and need to verify candidates understand subtle syntax differences, CTE structure, aliases, ordering and equivalence of filtering clauses. ##### Question In MySQL the query SELECT id, COUNT(*) AS transactions FROM transactions GROUP BY id HAVING transactions > 10; runs, but the same fails in MS SQL Server. Explain why and rewrite a version portable to both engines. ​ What does the statement "SELECT * FROM A B;" do and why can it be legal SQL? ​ Given ORDER BY id, ORDER BY id ASC and ORDER BY id DESC, which one produces a different ordering and why? ​ Provide the correct multi-CTE skeleton that defines two CTEs, A and B, then queries them. ​ Will the following three predicates return identical rows for a char column containing only upper-case letters? Justify. a) col IN ('A','B','C') b) col BETWEEN 'A' AND 'C' c) col >= 'A' AND col <= 'C' ##### Hints Focus on alias scope rules, default sort order, comma vs alias syntax, WITH clause commas, and lexical range comparisons.

Quick Answer: This question evaluates a candidate's understanding of SQL dialect differences between MySQL and MS SQL Server — including alias scope, CTE structure, ordering semantics, and lexical range comparisons that affect query portability and correctness.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find recommended friend pairs by shared songs - Amazon (medium)
  • Find recommended friend pairs by shared listening - Amazon (easy)
  • Write SQL window functions for D7 retention - Amazon (medium)
  • Find daily first-order merchants with SQL - Amazon (Medium)
  • Design student–course data models and SQL - Amazon (Medium)