CEIL()() — SQL Technical Interview Questions & Answers
CEIL()()
CEIL()()
- CEIL() is a MySQL math function: round up. CEIL(4.1) is 5. Use it in SELECT, e.g. SELECT CEIL(marks) FROM students;
- These functions do not change stored marks unless you UPDATE. NULL in, NULL out for most of them.
- Trap: mixing CEIL 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: CEIL()(): create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
Technical Interview Tip: Explain CEIL with one number. round up. CEIL(4.1) is 5.
Code Examples for CEIL()()
CEIL()() — sample query
-- CEIL()()
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;CEIL()(): create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
How to Explain CEIL()() to an Interviewer
What is CEIL?
round up. CEIL(4.1) is 5 Used in SELECT