inblog logo
|
silver
    SQL๋ฌธ์ œํ’€๊ธฐ

    [SQL๋ฌธ์ œํ’€๊ธฐ - Advent of SQL 2025 ๐ŸŽ…] ์Šคํƒฌํ”„๋ฅผ ์ฐ์–ด๋“œ๋ ค์š”

    silver's avatar
    silver
    Dec 05, 2025
    [SQL๋ฌธ์ œํ’€๊ธฐ - Advent of SQL 2025 ๐ŸŽ…] ์Šคํƒฌํ”„๋ฅผ ์ฐ์–ด๋“œ๋ ค์š”
    Contents
    ๋ฌธ์ œ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ ์ •๋‹ต

    ๋ฌธ์ œ

    solvesql.com
    solvesql.com
    https://solvesql.com/problems/count-stamps/

    ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ ์ •๋‹ต

    MySQL

    : Every derived table must have its own alias
    select stamp, count(*) count_bill from (select case when total_bill >= 25 then 2 when total_bill >= 15 then 1 else 0 end stamp from tips) st group by stamp order by 1;

    MySQL, PostgreSQL

    select stamp, count(*) count_bill from (select case when total_bill >= 25 then 2 when total_bill >= 15 then 1 else 0 end stamp from tips) group by stamp order by 1;
    Share article

    silver

    RSSยทPowered by Inblog