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