CEILING()() — SQL Technical Interview Questions & Answers
CEILING()()
CEILING()()
- CEILING() is a MySQL math function: same as CEIL. Use it in SELECT, e.g. SELECT CEILING(marks) FROM students;
- These functions do not change stored marks unless you UPDATE. NULL in, NULL out for most of them.
- Trap: mixing CEILING with TRUNCATE TABLE (different word). Trap: maths on VARCHAR without CAST.
- In a viva, one numeric example beats listing twenty functions.
- On the example next to this theory: CEILING()(): create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
Technical Interview Tip: Explain CEILING with one number. same as CEIL.
Code Examples for CEILING()()
CEILING()() — sample query
-- CEILING()()
CREATE TABLE demo (
id INTEGER PRIMARY KEY,
label TEXT NOT NULL,
qty INTEGER DEFAULT 0
);
INSERT INTO demo (id, label, qty) VALUES
(1, 'alpha', 2),
(2, 'beta', 5);
SELECT label, qty FROM demo WHERE qty >= 2 ORDER BY qty DESC;CEILING()(): create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
How to Explain CEILING()() to an Interviewer
What is CEILING?
same as CEIL Used in SELECT