Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Wednesday, 3 September 2014

CEIL function in Teradata


The CEIL functions round the specified number up, and return the smallest number that is greater than or equal to the specified number.

Syntax is:-

CEIL (NUMBER);

Example is:-

SELECT CEILING(11.12);
--> 12

SELECT CEILING(21.11);
--> 22

SELECT CEILING(-1.2);
--> -1

SELECT CEILING(1);
--> 1




Here are 5 frequently asked questions (FAQs) about the CEIL function in Teradata, along with their answers:-

1. What is the CEIL function in Teradata?
   - The CEIL function in Teradata is used to return the smallest integer greater than or equal to the specified numeric expression. It rounds up the numeric value to the nearest integer.

2. How do I use the CEIL function in Teradata?
   - To use the CEIL function, simply provide a numeric expression as its argument. For example:
     
     SELECT CEIL(4.25); -- Result: 5
     
     This query will return 5, as CEIL rounds up 4.25 to the nearest integer.

3. Can I use CEIL with negative numbers in Teradata?
   - Yes, you can use CEIL with negative numbers in Teradata. CEIL rounds negative numbers towards zero, so it will return the smallest integer greater than or equal to the specified negative number.
     
     SELECT CEIL(-3.75); -- Result: -3
     
     This query will return -3, as CEIL rounds up -3.75 to the nearest integer.

4. What happens if I provide a non-numeric expression to CEIL in Teradata?
   - If you provide a non-numeric expression to the CEIL function in Teradata, it will return an error. CEIL requires a numeric expression as its argument.

5. Can I combine CEIL with other functions in Teradata?
   - Yes, you can combine CEIL with other functions or expressions in Teradata. It's often used in conjunction with mathematical operations or as part of more complex calculations.
     
     SELECT CEIL(SQRT(16)); -- Result: 4
     
     This query calculates the square root of 16 (which is 4) and then rounds it up to the nearest integer using CEIL.

These FAQs should provide a good understanding of the CEIL function in Teradata and how it can be used in SQL queries.

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.