Mastering the Teradata CEILING Function

Introduction

To round up decimal values in Teradata, use the CEILING function. It is efficient and accurate. This blog post will show how to use the CEILING function in Teradata to simplify data processing tasks.

Understanding the Teradata CEILING Function

The CEILING function in Teradata is a built-in mathematical function that takes a numeric value as input and returns the smallest integer value greater than or equal to the input value. In other words, the CEILING function rounds up the input value to the nearest whole number. The syntax for the CEILING function is as follows:

CEILING(numeric_value)

Basic Usage of CEILING

To demonstrate the basic usage of the CEILING function, let’s look at a few examples:

  1. Rounding up a positive decimal value: SELECT CEILING(7.12) AS rounded_value; This query will return the value ‘8’, as it is the smallest integer greater than or equal to 7.12.
  2. Rounding up a negative decimal value: SELECT CEILING(-7.12) AS rounded_value; This query will return the value ‘-7’, as it is the smallest integer greater than or equal to -7.12.
  3. Rounding up a whole number: SELECT CEILING(5) AS rounded_value; This query will return the value ‘5’, as it is already a whole number.

Using CEILING with Columns and Tables

In practice, you’ll often use the CEILING function to round up decimal values stored in columns within your tables. For example, suppose you have a table called ‘sales’ with a column named ‘revenue’ that contains decimal values. To round up these values to the nearest whole number, you can use the following query:

SELECT CEILING(revenue) AS rounded_revenue FROM sales;

This query will return the ‘revenue’ column values rounded up to the nearest whole number.

Combining CEILING with Other Functions

The CEILING function can be combined with other functions in Teradata to perform more complex calculations. For example, you might want to calculate the total revenue for a specific time period and round up the result. To do this, you can use the following query:

SELECT CEILING(SUM(revenue)) AS total_rounded_revenue FROM sales WHERE sales_date BETWEEN '2023-01-01' AND '2023-12-31';

This query calculates the total revenue for the specified date range and rounds up the result to the nearest whole number.

Conclusion

Teradata’s CEILING function simplifies numerical data processing tasks and ensures accurate results. Understand its various uses to enhance data analysis and reporting capabilities. Experiment with it and other Teradata math function to unlock full data management potential.

Related Services

⚡ Need Help Optimizing Your Data Platform?

We cut data platform costs by 30–60% without hardware changes. 25+ years of hands-on tuning experience.

Explore Our Services →

📖 Go Deeper: Teradata Performance Tuning

The definitive guide used by data engineers worldwide. Practical techniques, real examples, proven results.

About the Book →

📊 Data Platform Migration Survey

Help us map where the industry is heading. Results are public — see what others chose.

1. What is your current data platform?

2. Where are you migrating to (or evaluating)?

Migrating FROM
Migrating TO

Thanks for voting! Share this with your network.

Follow me on LinkedIn for daily insights on data warehousing and platform migrations.

Stay Ahead in Data Warehousing

Get expert insights on Teradata, Snowflake, BigQuery, Databricks, Microsoft Fabric, and modern data architecture — delivered to your inbox.

Leave a Comment

DWHPro

Expert network for enterprise data platforms. Senior consultants, project teams built for your challenge — across Teradata, Snowflake, Databricks, and more.

📍Vienna, Austria & Miami, Florida

Quick Links
Services Team Teradata Book Blog Contact Us
Connect
LinkedIn → [email protected]
Newsletter

Join 4,000+ data professionals.
Weekly insights on Teradata, Snowflake & data architecture.