0
0
SQLquery~30 mins

ROUND, CEIL, FLOOR in SQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Using ROUND, CEIL, and FLOOR Functions in SQL
📖 Scenario: You work for an online store that tracks product prices with decimals. You want to prepare a report that shows prices rounded in different ways for better display and analysis.
🎯 Goal: Create SQL queries that use the ROUND, CEIL, and FLOOR functions to transform product prices.
📋 What You'll Learn
Create a table called products with columns id (integer) and price (decimal).
Insert exactly these rows into products: (1, 10.75), (2, 23.40), (3, 5.99), (4, 100.01).
Write a query that selects id and the price rounded to the nearest whole number using ROUND(price).
Write a query that selects id and the price rounded up to the next whole number using CEIL(price).
Write a query that selects id and the price rounded down to the previous whole number using FLOOR(price).
💡 Why This Matters
🌍 Real World
Online stores and financial reports often need to display prices rounded in different ways for clarity and customer understanding.
💼 Career
Knowing how to use ROUND, CEIL, and FLOOR in SQL helps database analysts and developers prepare clean, user-friendly reports and data summaries.
Progress0 / 4 steps
1
Create the products table and insert data
Create a table called products with columns id as integer and price as decimal. Then insert these exact rows: (1, 10.75), (2, 23.40), (3, 5.99), and (4, 100.01).
SQL
Need a hint?

Use CREATE TABLE to make the table and INSERT INTO to add rows.

2
Set up a query to round prices
Write a SQL query that selects id and the price rounded to the nearest whole number using ROUND(price) from the products table.
SQL
Need a hint?

Use SELECT id, ROUND(price) and FROM products.

3
Write a query to round prices up using CEIL
Write a SQL query that selects id and the price rounded up to the next whole number using CEIL(price) from the products table.
SQL
Need a hint?

Use SELECT id, CEIL(price) and FROM products.

4
Write a query to round prices down using FLOOR
Write a SQL query that selects id and the price rounded down to the previous whole number using FLOOR(price) from the products table.
SQL
Need a hint?

Use SELECT id, FLOOR(price) and FROM products.