EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials MySQL Tutorial MySQL CEIL
Secondary Sidebar
MySQL Tutorial
  • Functions
    • MySQL Function
    • MySQL Aggregate Function
    • MySQL String functions
    • MySQL Date Functions
    • MySQL Window Functions
    • MySQL Math Functions
    • MySQL Boolean
    • Cursor in MySQL
    • Condition in MySQL
    • MySQL BETWEEN
    • Insert in MySQL
    • MySQL IFNULL()
    • MySQL TIMESTAMPDIFF()
    • MySQL COALESCE()
    • MySQL count()
    • MIN() in MySQL
    • MySQL Numeric
    • MySQL field()
    • MySQL FIND_IN_SET()
    • MySQL avg()
    • MySQL MAX() Function
    • MySQL BIN()
    • MySQL Concat
    • MySQL DECODE()
    • MySQL REGEXP_REPLACE()
    • MySQL Asynchronous
    • MySQL innodb_buffer_pool_size
    • MySQL key_buffer_size
    • MySQL TRUNCATE()
    • MySQL ROW_NUMBER()
    • NOT in MySQL
    • MySQL IN Operator
    • LIKE in MySQL
    • ANY in MySQL
    • MySQL NOT IN
    • MySQL CHECK Constraint
    • MySQL DISTINCT
    • MySQL ALL
    • MySQL Union
    • MySQL UNION ALL
    • MySQL EXISTS
    • MySQL ON DELETE CASCADE
    • MySQL REGEXP
    • MySQL Index
    • MySQL Add Index
    • MySQL REINDEX
    • MySQL UNIQUE INDEX
    • MySQL Clustered Index
    • MySQL? InnoDB Cluster
    • Table in MySQL
    • ALTER TABLE MySQL
    • MySQL Temporary Table
    • MySQL Clone Table
    • MySQL Repair Table
    • MySQL Lock Table
    • MySQL Optimize Table
    • TRUNCATE TABLE MySQL
    • MySQL Table Dump
    • MySQL Update Set
    • MySQL ALTER TABLE Add Column
    • MySQL RANK()
    • MySQL CTE
    • MySQL LAG()
    • MySQL GROUP_CONCAT()
    • MySQL EXTRACT()
    • MySQL REPLACE
    • MySQL AUTO_INCREMENT
    • MySQL SYSDATE()
    • MySQL NULLIF()
    • MySQL Substring
    • MySQL SUBSTRING_INDEX()
    • MySQL LOWERCASE
    • MySQL Row
    • MySQL NOW
    • MySQL CEIL
    • MySQL Alias
    • MySQL Trigger
    • MySQL SHOW Triggers
    • MySQL UPDATE Trigger
    • MySQL DELETE Trigger
    • MySQL AFTER UPDATE Trigger
    • MySQL Stored Procedure
    • ROLLUP in MySQL
    • MySQL? INSTR()
    • MySQL Subquery
    • MySQL Timestamp
    • MySQL? Hour()
    • MySQL MOD()
    • MySQL DATE_FORMAT()
    • ALTER Column in MySQL
    • MySQL Rename Column
    • MySQL Interval
    • MySQL CURDATE
    • MySQL BIT
    • MySQL Binlog
    • MySQL Average
    • MySQL TEXT
    • MySQL SHOW
    • MySQL Offset
    • MySQL Timezone
    • mysql_real_escape_string
    • MySQL Datetime
    • MySQL DATE_SUB()
    • MySQL FULLTEXT
    • MySQL DATE_ADD()
    • MySQL sum()
    • MySQL Merge
    • MySQL BigInt
    • MySQL ROUND
    • MySQL VARCHAR
    • MySQL Decimal
    • MySQL Limit
    • MySQL today()
    • MySQL WEEKDAY
    • MySQL Split
    • MySQL Create Function
    • MySQL BLOB
    • MySQL encode()
    • MySQL Primary Key
    • MySQL Foreign Key
    • Unique Key in MySQL
    • MySQL Drop Foreign Key
    • MySQL DROP TRIGGER
    • MYSQL Database
    • Delete Database MySQL
    • MySQL Root
    • MySQL Root Password
    • MySQL Client
    • MySQL Users
    • MySQL?User Permissions
    • MySQL add user
    • MySQL List User
    • MySQL Show Users
    • MySQL User Password
    • MySQL?Cardinality
    • MySQL Workbench
    • MySQL Backup
    • MySQL REVOKE
    • MySQL Dump
    • MySQL Cluster
    • MySQL Partitioning
    • MySQL Full Text Search
    • MySQL Admin Tool
    • MySQL Export Database
    • MySQL Export to CSV
  • Basic
    • MySQL floor
    • MySQL DESCRIBE table
    • MySQL encryption
    • Introduction to MySQL
    • Is SQL Server a Database?
    • What is MySQL
    • Is MySQL Programming Language
    • MySQL Server
    • MySQL AB
    • MySQL Community Server
    • How To Install MySQL
    • MySQL Versions
    • MySQL OpenSource
    • MySQL GUI Tools
    • MySQL Grant
    • MySQL Error 1064
    • MySQL Drop Database
    • MySQL not equal
    • MySQL SELECT INTO Variable
    • MySQL Commands
    • MySQL Operators
    • What is MySQL Schema
    • Wildcards in MySQL
    • MySQL Constraints
    • MySQL Administration
    • MySQL Data Type
    • MYSQL COMMIT
    • MySQL FORMAT
    • Timestamp to Date in MySQL
    • MySQL DATEDIFF
    • MySQL?Incremental Backup
    • MySQL JSON Data Type
    • MySQL ENUM
    • MySQL Default Port
    • Cheat Sheet MySQL
  • Queries
    • MySQL Queries
    • MySQL Query Commands
    • SELECT in MySQL
    • MySQL INSERT IGNORE
    • MySQL having
    • ORDER BY in MySQL
    • MySQL Cheat Sheet
    • MySQL ORDER BY Random
    • MySQL ORDER BY DESC
    • MySQL GROUP BY
    • MySQL GROUP BY Count
    • MySQL GROUP BY month
    • MySQL WHERE Clause
    • MySQL WITH
    • MySQL FETCH
    • MySQL DDL
    • MySQL DML
    • MySQL WHERE IN Array
    • MySQL Fetch Array
    • MySQL ISNULL
    • MySQL Index Types
    • Mysql? Export Schema
    • Amazon RDS for MySQL
    • MySQL greatest
  • Database
    • What is Data Modeling
    • What is Data Processing
    • DBMS Architecture
    • DBMS Keys
    • Careers in Database Administration
    • What is MySQL Database
    • MySQL Relational Database
    • How to Connect Database to MySQL
    • MySQL Database Repair
    • RDBMS Interview Questions
    • DBMS Interview Questions
  • Joins
    • Joins in MySQL
    • MySQL Outer Join
    • Left Outer Join in MySQL
    • MySQL Self Join
    • Natural Join in MySQL
    • MySQL DELETE JOIN
    • MySQL Update Join
    • MySQL Cross Join
  • Advanced
    • MySQL Formatter
    • MySQL TINYINT
    • MySQL Grant All Privileges
    • MySQL DROP TABLE
    • MySQL rename database
    • MySQL Flush Privileges
    • MySQL super Privilege
    • MySQL Character Set
    • MySQL Log File
    • MySQL Flush Log
    • Grant Privileges MySQL
    • MySQL WHILE LOOP
    • IF Statement in MySQL
    • MySQL CASE Statement
    • MySQL IF Function
    • MySQL IF EXISTS
    • MySQL UUID
    • Views in MySQL
    • MySQL Replication
    • MySQL Partition
    • Toad for MySQL
    • Navicat for MySQL
    • MySQL AES_Encrypt
    • MySQL Performance Tuning
    • MySQL Transaction
    • MySQL? sort_buffer_size
    • MySQL? Sync
    • MySQL? Query Cache
    • MySQL Collation
    • MySQL ODBC Driver
    • MySQL Partitioning
    • MySQL InnoDB
    • MySQL Float vs Decimal
    • MySQL Union vs Union All
  • Interview Questions
    • MySQL Interview Questions

Related Courses

MS SQL Certification Courses

Oracle Certification Courses

PL/SQL Certification Courses

MySQL CEIL

By Aanchal SharmaAanchal Sharma

MySQL CEIL

Introduction to MySQL CEIL

The MySQL CEIL() function is identical to the MySQL CEILING() function where it finds out the minimum integer result value that is either larger than or equivalent to a number. Both MySQL CEILING() and CEIL() functions are synonyms to each other and can be used interchangeably to take the numbers as inputs to return the respective integer value. Normally, among the Math functions in MySQL, the MySQL CEIL() function is one the mathematical function implemented to produce the top or identical value of the input given as argument to the function. We can provide both positive and negative numbers while applying the CEIL() function.

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (86,768 ratings)

Syntax:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Following is the elementary simple syntax code to use the CEIL() function in MySQL:

CEIL(Numeric_Value)

  • In the above syntax, the numeric_value term defines the required input for CEIL function argument. This value can be an expression that weighs to a number or a precise number.
  • According to the type of the argument number provided as input, the result number type is specified. The type of output depends on the type of input specified in the CEIL() query.
  • Suppose, if we have inputted a number with type as accurate number value or floating-point, then the result value type will be exactly as that of accurate number or floating-point simultaneously.

How CEIL Function works in MySQL?

Let us see the working of MySQL CEIL() function in MySQL:

For illustration, we are writing a query using CEIL() function as follows:

Code:

SELECT CEIL(20.50);

Here, the MySQL SELECT keyword statement is to be used together with the math function to display the result value by calculation of the number provided in the argument function having type as floating point.

Output:

MySQL CEIL 1

So, it is clear that the CEIL() function will generate the smallest value that is either greater than or similar to 20.50 input value specified in the above query as 21.

Examples of MySQL CEIL

We will demonstrate an examples to show the uses of this math function in MySQL.

Example #1

We are now applying the CEIL() function for a positive number in the argument of the function. For this query, we will implement the following query statement.

Code:

SELECT CEIL(2.43);

Output:

MySQL CEIL 2

In this above example, we come to know that the result produced has the smallest integer that is larger than or equal to the number given as input i.e. 2.43. Thus, the CEIL() function gives 3 as the result.

Code:

SELECT CEIL(24);

Output:

with a positive number

Code:

SELECT CEIL(1.25);

Output:

MySQL CEIL 4JPG

Code:

SELECT CEIL(0.56);

Output:

MySQL CEIL 5JPG

Code:

SELECT CEIL(500.08);

Output:

with a positive number

Code:

SELECT CEIL(0.0089);

Output:

MySQL CEIL 7JPG

Code:

SELECT CEIL(11.90);

Output:

MySQL CEIL 8JPG

Example #2

Let us apply the CEIL() function where we provide a negative number as input to produce the output as specified below.

Code:

SELECT CEIL(-2.43);

Output:

MySQL CEIL 9JPG

Code:

SELECT CEIL(-24);

Output:

with a negative number

Code:

SELECT CEIL(-1.25);

Output:

with a negative number

Code:

SELECT CEIL(-0.56);

Output:

MySQL CEIL 2JPG

Code:

SELECT CEIL(-500.08);

Output:

MySQL CEIL 12JPG

Code:

SELECT CEIL(-0.0089);

Output:

MySQL CEIL 13JPG

Code:

SELECT CEIL(-11.90);

Output:

MySQL CEIL 14JPG

Here, we can see that the output gives the number as result which is either bigger or identical to the input respectively by the MySQL CEIL() function. The CEIL() function provides the results for negative numbers as per above observations.

Example #3

Example of MySQL CEIL() function with a query in a table.

Suppose, we need a table for querying the column values against the CEIL() function and show its working in the database calculation. For this, we will create the table in the database using the query statement below.

Code:

CREATE TABLE Suppliers(Supplier_ID INT PRIMARY KEY AUTO_INCREMENT, CATEGORY VARCHAR(255) NOT NULL, Unit INT NOT NULL, CostEach FLOAT NOT NULL);

Also, we will insert some of the demo records for further process of query.

Code:

INSERT INTO Suppliers(Supplier_ID, Category, Unit, CostEach) VALUES
('10','Snacks','10','10.87'),
('11','Drinks','25','15.025'),
('12','Kitchen Needs','20','25.9');

Again, by the following we will display the contents of the table Suppliers using the SQL statement below.

Code:

SELECT * FROM Suppliers;

Output:

function with a query in a table

For CEIL() function query we will illustrate the evaluation using the table column from the table created above as Suppliers. The CEIL() function query for finding the ceil values of the total cost calculated for the supplier items implementing the query code as follows.

Code:

SELECT Category, CEIL(Unit * CostEach)TotalCost_CeilValue FROM Suppliers30 GROUP BY Category ORDER BY TotalCost_CeilValue;

Output:

function with a query in a table

The above statement provides the ceil values of the cost calculated for each supplier item by multiplying the unit column values with the cost price of each item associated in the Suppliers table. Firstly, in this query the cost total for each supplier item is calculated and then the resultant values are then used as inputs for the CEIL() function and then displays the smallest integer values which are greater than or similar to the input ones.

We should note that here in the table column named as CostEach contains the float type values therefore, result and total cost calculated for each supplier item will be in decimal form i.e. float type. After using the CEIL() function these float values will be produced as result values in integer values as you can view in the output above.

But let us see if we do not apply the CEIL() function to the previous query then, what the output will be.

For this we will change the query as follows.

Code:

SELECT Category, Unit * CostEach TotalCost FROM Suppliers30 GROUP BY Category ORDER BY TotalCost;

Output:

The output of the query code without the CEIL() function is as follows:

MySQL CEIL 17JPG

Thus, like the MySQL CEILING() function, the MySQL CEIL() function also works. So, the CEIL() function returns the least integer value but not less than the input number specified in the query function.

Conclusion

The MySQL CEIL() function performs as the mathematical technique where it rounds up the input number provided away from the zero. Actually, it generates the result integer value always up than the given argument value in the CEIL() function. MySQL CEIL() function gives the least integer value which is not smaller than the input value. Thus, it is useful in database to find out the upper values of any table column values for specific condition.

Recommended Articles

This is a guide to MySQL CEIL. Here we discuss the introduction to MySQL CEIL, how to use CEIL function along with query examples. You may also have a look at the following articles to learn more –

  1. MySQL Admin Tool
  2. MySQL REPLACE
  3. MySQL REINDEX
  4. MySQL ON DELETE CASCADE
Popular Course in this category
MySQL Training Program (12 Courses, 10 Projects)
  12 Online Courses |  10 Hands-on Projects |  92+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

MS SQL Training (16 Courses, 11+ Projects)4.9
Oracle Training (14 Courses, 8+ Projects)4.8
PL SQL Training (4 Courses, 2+ Projects)4.7
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more