instruction
stringlengths
8
43
input
stringclasses
10 values
output
stringlengths
27
270
amy๊ฐ€ 2025๋…„ 1์›” 1์ผ์— ์ฃผ๋ฌธํ•œ ๋‚ด์—ญ ์•Œ๋ ค์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders o JOIN users u ON o.user_id = u.id WHERE u.name = 'amy' and o.order_date='2025-01-01';"
30์„ธ ์ด์ƒ์ธ ๋‚จ์„ฑ๋“ค์˜ ์ด๋ฆ„๊ณผ ๋‚˜์ด๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT name, age FROM users WHERE age >= 30 AND gender = 'male';"
2025๋…„ 1์›”์— ์ฃผ๋ฌธ๋œ ๋ชจ๋“  ์ฃผ๋ฌธ ๋‚ด์—ญ์„ ๋ณด์—ฌ์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders WHERE order_date BETWEEN '2025-01-01' AND '2025-01-31';"
ํ†ฐ์ด 2024๋…„ 3์›” 5์ผ์— ์ฃผ๋ฌธํ•œ ์ƒํ’ˆ๋“ค์˜ ์ด๋ฆ„๊ณผ ๊ฐœ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, oi.amount FROM orders o JOIN users u ON o.user_id = u.id JOIN order_item oi ON o.id = oi.order_id JOIN items i ON oi.item_id = i.id WHERE u.name = 'ํ†ฐ' AND o.order_date = '2024-03-05';"
์ด ๊ฐ€๊ฒฉ์ด 50,000์› ์ด์ƒ์ธ ์ฃผ๋ฌธ๋“ค์˜ ์ฃผ๋ฌธ ๋‚ ์งœ์™€ ์ด ๊ฐ€๊ฒฉ์„ ๋ณด์—ฌ์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT order_date, total_price FROM orders WHERE total_price >= 50000;"
์—ฌ์„ฑ ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ๋‚˜์ด๋ฅผ ๋ชจ๋‘ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT name, age FROM users WHERE gender = 'female';"
๊ฐ€์žฅ ๋น„์‹ผ ์ƒํ’ˆ์˜ ์ด๋ฆ„๊ณผ ๊ฐ€๊ฒฉ์„ ์•Œ๋ ค์ค˜.
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT name, price FROM items WHERE price = (SELECT MAX(price) FROM items);"
2023๋…„ 4์›” ๋™์•ˆ ์ฃผ๋ฌธ๋œ ๊ฐ ์ƒํ’ˆ์˜ ์ด ํŒ๋งค ๊ฐœ์ˆ˜๋ฅผ ์•Œ๋ ค์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_amount FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id WHERE o.order_date BETWEEN '2023-04-01' AND '2023-04-30' GROUP BY i.name;"
์บ˜๋ฆฌ๊ฐ€ ์ฃผ๋ฌธํ•œ ์ƒํ’ˆ๋“ค์˜ ์ด ๊ฐ€๊ฒฉ์„ ๊ณ„์‚ฐํ•ด์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT SUM(i.price * oi.amount) AS total_spent FROM orders o JOIN users u ON o.user_id = u.id JOIN order_item oi ON o.id = oi.order_id JOIN items i ON oi.item_id = i.id WHERE u.name = '์บ˜๋ฆฌ';"
๊ฐ ์ฃผ๋ฌธ ์ƒํƒœ๋ณ„ ์ฃผ๋ฌธ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•ด์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT order_state, COUNT(*) AS order_count FROM orders GROUP BY order_state;"
2024๋…„ 11์›” 28์ผ์— ์ฃผ๋ฌธ๋œ ์ƒํ’ˆ๋“ค์˜ ์ด๋ฆ„๊ณผ ์ด ์ฃผ๋ฌธ ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_ordered FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id WHERE o.order_date = '2024-11-28' GROUP BY i.name;"
์ฃผ๋ฌธ ์ƒํƒœ๊ฐ€ 'delivery'์ธ ์ฃผ๋ฌธ๋“ค์˜ ์ฃผ๋ฌธ ID์™€ ์‚ฌ์šฉ์ž ์ด๋ฆ„์„ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT o.id AS order_id, u.name AS user_name FROM orders o JOIN users u ON o.user_id = u.id WHERE o.order_state = 'delivery';"
๊ฐ ์‚ฌ์šฉ์ž๊ฐ€ ์ฃผ๋ฌธํ•œ ์ด ๊ธˆ์•ก์„ ๊ณ„์‚ฐํ•ด์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name AS user_name, SUM(o.total_price) AS total_spent FROM orders o JOIN users u ON o.user_id = u.id GROUP BY u.name;"
2024๋…„ 11์›” 28์ผ์— ์ฃผ๋ฌธ๋œ ์ƒํ’ˆ๋“ค์˜ ์ด๋ฆ„๊ณผ ์ด ์ฃผ๋ฌธ ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_ordered FROM order_item oi JOIN items i ON oi.item_id = i.id GROUP BY i.name ORDER BY total_ordered DESC LIMIT 1;"
์‚ฌ์šฉ์ž ๋ณ„๋กœ ์ฃผ๋ฌธํ•œ ์ƒํ’ˆ์˜ ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name AS user_name, COUNT(o.id) AS order_count FROM orders o JOIN users u ON o.user_id = u.id GROUP BY u.name;"
ํ‰๊ท  ์ฃผ๋ฌธ ๊ธˆ์•ก์ด 10,000์› ์ด์ƒ์ธ ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ํ‰๊ท  ๊ธˆ์•ก์„ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name AS user_name, AVG(o.total_price) AS avg_order_price FROM orders o JOIN users u ON o.user_id = u.id GROUP BY u.name HAVING avg_order_price >= 10000;"
๋ชจ๋“  ์ƒํ’ˆ์˜ ์ด ํŒ๋งค๋Ÿ‰๊ณผ ์ด ์ˆ˜์ต์„ ๊ณ„์‚ฐํ•ด์ค˜.
{"schema": {"order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT SUM(oi.amount) AS total_items_sold, SUM(oi.amount * i.price) AS total_revenue FROM order_item oi JOIN items i ON oi.item_id = i.id;"
30์„ธ ๋ฏธ๋งŒ ์‚ฌ์šฉ์ž๊ฐ€ ์ฃผ๋ฌธํ•œ ๋ชจ๋“  ์ฃผ๋ฌธ์˜ ID์™€ ์ฃผ๋ฌธ ๋‚ ์งœ๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT o.id AS order_id, o.order_date FROM orders o JOIN users u ON o.user_id = u.id WHERE u.age < 30;"
์‚ฌ์šฉ์ž ๋ณ„๋กœ ์ฃผ๋ฌธํ•œ ์ƒํ’ˆ๋“ค์˜ ์ด ๊ฐœ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•ด์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT u.name AS user_name, SUM(oi.amount) AS total_items_ordered FROM orders o JOIN users u ON o.user_id = u.id JOIN order_item oi ON o.id = oi.order_id GROUP BY u.name;"
์ฃผ๋ฌธ๋œ ์ƒํ’ˆ์ด ์—†๋Š” ์‚ฌ์šฉ์ž๋“ค์˜ ์ด๋ฆ„์„ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name FROM users u LEFT JOIN orders o ON u.id = o.user_id WHERE o.id IS NULL;"
์—ฌ์„ฑ ์‚ฌ์šฉ์ž๊ฐ€ ์ฃผ๋ฌธํ•œ ์ด ์ฃผ๋ฌธ ์ˆ˜์™€ ์ด ๊ธˆ์•ก์„ ๊ณ„์‚ฐํ•ด์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT COUNT(o.id) AS total_orders, SUM(o.total_price) AS total_spent FROM orders o JOIN users u ON o.user_id = u.id WHERE u.gender = 'female';"
์ฃผ๋ฌธ ์ƒํƒœ๊ฐ€ 'done'์ธ ์ฃผ๋ฌธ๋“ค์˜ ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ์ฃผ๋ฌธ ๋‚ ์งœ๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name AS user_name, o.order_date FROM orders o JOIN users u ON o.user_id = u.id WHERE o.order_state = 'done';"
์ƒํ’ˆ ์ด๋ฆ„์ด 'Laptop'์ธ ์ƒํ’ˆ์„ ์ฃผ๋ฌธํ•œ ์‚ฌ์šฉ์ž๋“ค์˜ ์ด๋ฆ„์„ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT DISTINCT u.name FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id JOIN users u ON o.user_id = u.id WHERE i.name = 'Laptop';"
2022๋…„ 7์›”์— ์ฃผ๋ฌธ๋œ ๋ชจ๋“  ์ฃผ๋ฌธ์˜ ID์™€ ์ด ๊ธˆ์•ก์„ ๋ณด์—ฌ์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT o.id AS order_id, o.total_price FROM orders o WHERE EXTRACT(YEAR FROM o.order_date) = 2022 AND EXTRACT(MONTH FROM o.order_date) = 7;"
20์„ธ ์ดํ•˜์˜ ์‚ฌ์šฉ์ž๊ฐ€ ์ฃผ๋ฌธํ•œ ์ƒํ’ˆ๋“ค์˜ ์ด๋ฆ„๊ณผ ์ด ์ฃผ๋ฌธ ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_ordered FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id JOIN users u ON o.user_id = u.id WHERE u.age <= 20 GROUP BY i.name;"
์ด ์ฃผ๋ฌธ ๊ธˆ์•ก์ด ๊ฐ€์žฅ ๋‚ฎ์€ ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ๊ทธ ๊ธˆ์•ก์„ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name AS user_name, SUM(o.total_price) AS total_spent FROM orders o JOIN users u ON o.user_id = u.id GROUP BY u.name ORDER BY total_spent LIMIT 1;"
2025๋…„์— ์ฃผ๋ฌธ๋œ ๊ฐ ์ƒํ’ˆ๋ณ„ ์ด ํŒ๋งค๋Ÿ‰์„ ๋ณด์—ฌ์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_sold FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id WHERE EXTRACT(YEAR FROM o.order_date) = 2025 GROUP BY i.name;"
ํ•œ ๋ฒˆ๋„ ์ฃผ๋ฌธํ•˜์ง€ ์•Š์€ ์ƒํ’ˆ๋“ค์˜ ์ด๋ฆ„์„ ๋ณด์—ฌ์ค˜.
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name FROM items i LEFT JOIN order_item oi ON i.id = oi.item_id WHERE oi.id IS NULL;"
์ฃผ๋ฌธ ์ƒํƒœ๊ฐ€ 'paid'์ธ ์ฃผ๋ฌธ๋“ค์˜ ์ด ์ฃผ๋ฌธ ์ˆ˜์™€ ํ‰๊ท  ์ฃผ๋ฌธ ๊ธˆ์•ก์„ ๊ณ„์‚ฐํ•ด์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT COUNT(o.id) AS total_orders, AVG(o.total_price) AS avg_order_price FROM orders o WHERE o.order_state = 'paid';"
๊ฐ€์žฅ ๋น„์‹ผ ์ƒํ’ˆ์„ ์ฃผ๋ฌธํ•œ ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ๊ทธ ์ƒํ’ˆ์˜ ๊ฐ€๊ฒฉ์„ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT u.name AS user_name, i.price FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id JOIN users u ON o.user_id = u.id WHERE i.price = (SELECT MAX(price) FROM items);"
ํ•œ ๋ฒˆ๋„ ์ฃผ๋ฌธํ•˜์ง€ ์•Š์€ ์‚ฌ์šฉ์ž๋“ค์˜ ์ด๋ฆ„์„ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name FROM users u LEFT JOIN orders o ON u.id = o.user_id WHERE o.id IS NULL;"
์ฃผ๋ฌธํ•œ ์ƒํ’ˆ ์ˆ˜๊ฐ€ 5๊ฐœ ์ด์ƒ์ธ ์‚ฌ์šฉ์ž๋“ค์˜ ์ด๋ฆ„๊ณผ ์ด ์ฃผ๋ฌธ ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name, COUNT(o.id) AS total_orders FROM users u JOIN orders o ON u.id = o.user_id WHERE o.total_count >= 5 GROUP BY u.name;"
2023๋…„ 5์›”์— ๊ฐ€์žฅ ๋งŽ์ด ํŒ๋งค๋œ ์ƒํ’ˆ์˜ ์ด๋ฆ„๊ณผ ํŒ๋งค๋Ÿ‰์„ ๋ณด์—ฌ์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_sold FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id WHERE EXTRACT(YEAR FROM o.order_date) = 2023 AND EXTRACT(MONTH FROM o.order_date) = 5 GROUP BY i.name ORDER BY total_sold DESC LIMIT 1;"
์‚ฌ์šฉ์ž๊ฐ€ ์ฃผ๋ฌธํ•œ ์ƒํ’ˆ์˜ ์ด ๊ธˆ์•ก์„ ์‚ฌ์šฉ์ž๋ณ„๋กœ ๊ณ„์‚ฐํ•ด์„œ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name, SUM(o.total_price) AS total_spent FROM orders o JOIN users u ON o.user_id = u.id GROUP BY u.name;"
์ฃผ๋ฌธ ์ƒํƒœ๊ฐ€ 'delivery'์ธ ์ฃผ๋ฌธ์˜ ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ์ฃผ๋ฌธ ID๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name AS user_name, o.id AS order_id FROM orders o JOIN users u ON o.user_id = u.id WHERE o.order_state = 'delivery';"
๋ชจ๋“  ์ฃผ๋ฌธ์—์„œ ๊ฐ€์žฅ ์ ๊ฒŒ ์ฃผ๋ฌธ๋œ ์ƒํ’ˆ์˜ ์ด๋ฆ„๊ณผ ์ฃผ๋ฌธ ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_ordered FROM order_item oi JOIN items i ON oi.item_id = i.id GROUP BY i.name ORDER BY total_ordered ASC LIMIT 1;"
2024๋…„์— ์ฃผ๋ฌธ๋œ ๊ฐ ์ฃผ๋ฌธ์˜ ID์™€ ์ด ๊ธˆ์•ก์„ ๋‚ ์งœ์ˆœ์œผ๋กœ ์ •๋ ฌํ•ด์„œ ๋ณด์—ฌ์ค˜.
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT o.id AS order_id, o.total_price FROM orders o WHERE EXTRACT(YEAR FROM o.order_date) = 2024 ORDER BY o.order_date ASC;"
์‚ฌ์šฉ์ž๋ณ„๋กœ ๊ฐ€์žฅ ์ตœ๊ทผ ์ฃผ๋ฌธ ๋‚ ์งœ๋ฅผ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT u.name, MAX(o.order_date) AS last_order_date FROM orders o JOIN users u ON o.user_id = u.id GROUP BY u.name;"
์ด ํŒ๋งค๋Ÿ‰์ด 10๊ฐœ ์ด์ƒ์ธ ์ƒํ’ˆ์˜ ์ด๋ฆ„๊ณผ ์ด ํŒ๋งค๋Ÿ‰์„ ๋ณด์—ฌ์ค˜.
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT i.name, SUM(oi.amount) AS total_sold FROM order_item oi JOIN items i ON oi.item_id = i.id GROUP BY i.name HAVING total_sold >= 10;"
์‚ฌ์šฉ์ž๊ฐ€ ์ฃผ๋ฌธํ•œ ๊ฐ ์ƒํ’ˆ์˜ ์ด๋ฆ„๊ณผ ์ฃผ๋ฌธ ์ˆ˜๋ฅผ ์‚ฌ์šฉ์ž๋ณ„๋กœ ๊ทธ๋ฃนํ™”ํ•˜์—ฌ ๋ณด์—ฌ์ค˜.
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}, "orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}, "items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT u.name AS user_name, i.name AS item_name, SUM(oi.amount) AS total_ordered FROM order_item oi JOIN items i ON oi.item_id = i.id JOIN orders o ON oi.order_id = o.id JOIN users u ON o.user_id = u.id GROUP BY u.name, i.name ORDER BY u.name, total_ordered DESC;"
๋ชจ๋“  ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ๋‚˜์ด๋ฅผ ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT name, age FROM users;"
20๋Œ€ ์‚ฌ์šฉ์ž๋งŒ ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT * FROM users WHERE age BETWEEN 20 AND 29;"
๋‚จ์ž๋งŒ ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT * FROM users WHERE gender = 'male';"
50์‚ด ์ด์ƒ ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ์„ฑ๋ณ„ ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT name, gender FROM users WHERE age >= 50;"
๋‚˜์ด๊ฐ€ ๊ฐ€์žฅ ๋งŽ์€ ์‚ฌ์šฉ์ž๋ฅผ ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT * FROM users ORDER BY age DESC LIMIT 1;"
์‚ฌ์šฉ์ž ์ด๋ฆ„์— 'a'๊ฐ€ ํฌํ•จ๋œ ์‚ฌ์šฉ์ž ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT * FROM users WHERE name LIKE '%a%';"
์‚ฌ์šฉ์ž ํ…Œ์ด๋ธ”์—์„œ ์ค‘๋ณต ์—†์ด ์„ฑ๋ณ„๋งŒ ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT DISTINCT gender FROM users;"
์‚ฌ์šฉ์ž์˜ ํ‰๊ท  ๋‚˜์ด ์•Œ๋ ค์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT AVG(age) AS average_age FROM users;"
์—ฌ์„ฑ ์‚ฌ์šฉ์ž์˜ ์ด ์ธ์›์ด ๋ช‡์ธ์ง€ ์•Œ๋ ค์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT COUNT(*) AS female_count FROM users WHERE gender = 'female';"
์ด๋ฆ„์ด 'John'์ธ ์‚ฌ์šฉ์ž ์กฐํšŒํ•ด์ค˜
{"schema": {"users": {"description": "user information", "columns": {"id": ["INT", "user id"], "name": ["VARCHAR", "user name"], "age": ["INT", "user age"], "gender": ["VARCHAR", "user gender [male, female]"]}, "primary_key": "id"}}}
"SELECT * FROM users WHERE name = 'John';"
๋ชจ๋“  ์ฃผ๋ฌธ์˜ ID์™€ ๋‚ ์งœ๋ฅผ ์กฐํšŒ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT id, order_date FROM orders;"
'paid' ์ƒํƒœ์ธ ์ฃผ๋ฌธ๋งŒ ์กฐํšŒ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders WHERE order_state = 'paid';"
2025๋…„์— ์ฃผ๋ฌธ๋œ ์ฃผ๋ฌธ ์กฐํšŒ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders WHERE EXTRACT(YEAR FROM order_date) = 2025;"
์ด ๊ธˆ์•ก์ด 100,000 ์ด์ƒ์ธ ์ฃผ๋ฌธ ์กฐํšŒ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders WHERE total_price >= 100000;"
์ฃผ๋ฌธ ๋‚ ์งœ ์ˆœ์œผ๋กœ ๋ชจ๋“  ์ฃผ๋ฌธ ์กฐํšŒ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders ORDER BY order_date ASC;"
์ตœ๊ทผ ์ฃผ๋ฌธ๋œ ์ฃผ๋ฌธ 3๊ฑด ์กฐํšŒ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders ORDER BY order_date DESC LIMIT 3;"
'delivery' ์ƒํƒœ์ธ ์ฃผ๋ฌธ ์ˆ˜ ๊ณ„์‚ฐ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT COUNT(*) AS delivery_count FROM orders WHERE order_state = 'delivery';"
'ordered' ์ƒํƒœ์˜ ํ‰๊ท  ์ฃผ๋ฌธ ๊ธˆ์•ก ๊ณ„์‚ฐ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT AVG(total_price) AS average_order_price FROM orders WHERE order_state = 'ordered';"
์ฃผ๋ฌธ ์ƒํƒœ๋ณ„ ์ฃผ๋ฌธ ์ˆ˜ ์•Œ๋ ค์ค˜
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT order_state, COUNT(*) AS state_count FROM orders GROUP BY order_state;"
์ด ์ƒํ’ˆ ์ˆ˜๊ฐ€ 10๊ฐœ ์ด์ƒ์ธ ์ฃผ๋ฌธ ์กฐํšŒ
{"schema": {"orders": {"description": "order list", "columns": {"id": ["INT", "order id"], "user_id": ["INT", "ordered user id"], "order_date": ["DATE", "order date"], "order_state": ["DATE", "order state [ordered, paid, delivery, done]"], "total_count": ["INT", "order items total count"], "total_price": ["INT", "order total price"]}, "primary_key": "id", "foreign_keys": {"user_id": "users.id"}}}}
"SELECT * FROM orders WHERE total_count >= 10;"
๋ชจ๋“  ์ƒํ’ˆ์˜ ์ด๋ฆ„๊ณผ ๊ฐ€๊ฒฉ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT name, price FROM items;"
๊ฐ€๊ฒฉ์ด 500,000์› ์ด์ƒ์ธ ์ƒํ’ˆ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT * FROM items WHERE price >= 500000;"
๊ฐ€๊ฒฉ์ด 5,000์› ์ดํ•˜์ธ ์ƒํ’ˆ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT * FROM items WHERE price <= 5000;"
๊ฐ€์žฅ ๋น„์‹ผ ์ƒํ’ˆ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT * FROM items ORDER BY price DESC LIMIT 1;"
๊ฐ€์žฅ ์ €๋ ดํ•œ ์ƒํ’ˆ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT * FROM items ORDER BY price ASC LIMIT 1;"
์ƒํ’ˆ ์ด๋ฆ„์— 'toy'๊ฐ€ ํฌํ•จ๋œ ์ƒํ’ˆ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT * FROM items WHERE name LIKE '%toy%';"
์ƒํ’ˆ์˜ ํ‰๊ท  ๊ฐ€๊ฒฉ ๊ณ„์‚ฐ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT AVG(price) AS average_price FROM items;"
๊ฐ€๊ฒฉ์ด ๋†’์€ ์ˆœ์„œ๋Œ€๋กœ ๋ชจ๋“  ์ƒํ’ˆ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT * FROM items ORDER BY price DESC;"
์ƒํ’ˆ ์ด๋ฆ„ ์ค‘๋ณต ์—†์ด ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT DISTINCT name FROM items;"
์ƒํ’ˆ ์ด๋ฆ„์ด 'Book'์ธ ์ƒํ’ˆ ์กฐํšŒ
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}}}
"SELECT * FROM items WHERE name = 'Book';"
๋ชจ๋“  ์ฃผ๋ฌธ ํ•ญ๋ชฉ ์กฐํšŒ
{"schema": {"order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT * FROM order_item;"
ํŠน์ • ์ฃผ๋ฌธ(id = 1)์— ๋Œ€ํ•œ ๋ชจ๋“  ์ฃผ๋ฌธ ํ•ญ๋ชฉ ์กฐํšŒ
{"schema": {"order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT * FROM order_item WHERE order_id = 1;"
์ฃผ๋ฌธ๋ณ„๋กœ ํฌํ•จ๋œ ์ƒํ’ˆ ๊ฐœ์ˆ˜ ์กฐํšŒ
{"schema": {"order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT order_id, SUM(amount) AS total_items FROM order_item GROUP BY order_id;"
ํŠน์ • ์ฃผ๋ฌธ์— ๋Œ€ํ•ด ์ฃผ๋ฌธ๋œ ์ด ๊ธˆ์•ก ๊ณ„์‚ฐ (๊ฐ€๊ฒฉ x ์ˆ˜๋Ÿ‰)
{"schema": {"items": {"description": "item information", "colums": {"id": ["INT", "item id"], "name": ["varchar", "item name"], "price": ["INT", "item price"]}, "primary_key": "id"}, "order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT oi.order_id, SUM(i.price * oi.amount) AS total_price FROM order_item oi JOIN items i ON oi.item_id = i.id WHERE oi.order_id = 1 GROUP BY oi.order_id;"
์ฃผ๋ฌธ ํ•ญ๋ชฉ์˜ ์ˆ˜๋Ÿ‰์ด 5๊ฐœ ์ด์ƒ์ธ ์ฃผ๋ฌธ ํ•ญ๋ชฉ ์กฐํšŒ
{"schema": {"order_item": {"description": "order's item list", "colums": {"id": ["INT", "order_item id"], "order_id": ["INT", "order_id"], "item_id": ["INT", "item_id"], "amount": ["INT", "ordered item amount"]}, "primary_key": "id", "foreign_keys": {"order_id": "orders.id", "item_id": "items.id"}}}}
"SELECT * FROM order_item WHERE amount >= 5;"
README.md exists but content is empty.
Downloads last month
31