SQL PHP HTML ASP JavaScript articles and free scripts to download
SQL Math Functions

floor ceil functions

We can use mysql ceil function to get the smallest integer which is higher than the input value.

Same way we can use the floor function to get the highest integer which is lower than the input value.

Here are some examples of ceil function.

select ceil(5.94) => 6
select ceil(5.24) => 6
select ceil(-5.24)=> -5
select ceil(-5.54) => -5

We can use ceil function to our student table where we will calculate the average mark of the students.

SELECT avg(mark) as avg FROM `student`

Output = 74.6571

Now we can use ceil command like this.

SELECT ceil(avg(mark)) as avg FROM `student`

Output = 75

Be the first to post comment on this article :


Post Comment This is for short comments only. Use the forum for more discussions.
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2015 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer