• Skip to primary navigation
  • Skip to content
  • Skip to footer
Thomas Ngo Thomas Ngo Crafting Elegant Solutions Through Code
  • Home
  • Journal
  • Tags
  • About

    Thomas Ngo

    Software Engineer

    • Stanton, California
    • Email
    • GitHub
    • Resume

    SQL problem - Product Sales Analysis I

    February 5, 2024 less than 1 minute read

    Page Navigation

    • Problem
    • Query
    • Editorial Solution
    1 min read 101 words

    Problem

    problem

    Query

    SELECT 
        product_name,
        year,
        price
    FROM
        Sales AS s
    JOIN
        Product AS p
        ON s.product_id = p.product_id
    

    Editorial Solution

    SELECT 
        DISTINCT p.product_name, s.year, s.price
    FROM 
        Sales s
    JOIN 
        Product p
    ON
        s.product_id = p.product_id
    

    Tags: SQL

    Updated: February 5, 2024

    Share on

    X Facebook LinkedIn Bluesky
    Previous Next

    Leave a comment

    You may also enjoy

    Select and SelectMany in C# LINQ with .NET 10

    August 4, 2026 8 minute read

    Select and SelectMany are two of the most useful LINQ operators. Both transform data, but they produce different shapes:

    Understanding GroupBy, ToLookup, and Join in LINQ with C# and .NET 10

    August 4, 2026 10 minute read

    LINQ gives C# developers a concise way to filter, transform, group, and combine data. Three operators that often look similar but solve different problems ar...

    IEnumerable and IQueryable in C# LINQ

    August 4, 2026 5 minute read

    IEnumerable<T> and IQueryable<T> both let you write LINQ queries, but they represent different execution models. Understanding the difference hel...

    Using pyodbc to Insert Data from Excel or CSV to SQL Server

    July 17, 2026 5 minute read

    In many data engineering tasks, you often need to move data from local files like Excel or CSV into a centralized database like SQL Server. Python provides e...

    • Follow:
    • GitHub
    • LinkedIn
    © 2026 Thomas Ngo.