SQL 13 : MySQL Built-in Functions

D

Qubits of DPK

April 11, 2026

Core DBMS

Aggregate Functions

Used to summarize multiple rows into a single value.
Example
sql
QUBITS OF DPK
1SELECT COUNT(*)
2FROM employees;

String Functions

Used for text manipulation.
Example
sql
QUBITS OF DPK
1SELECT CONCAT(first_name, ' ', last_name)
2FROM employees;

Numeric Functions

Used for mathematical operations.
Example
sql
QUBITS OF DPK
1SELECT ROUND(AVG(salary), 2)
2FROM employees;

Date & Time Functions

Used for working with dates and timestamps.
Example
sql
QUBITS OF DPK
1SELECT YEAR(order_date)
2FROM orders;

Conditional Functions

Used for logic and branching inside queries.
Example
sql
QUBITS OF DPK
1SELECT IF(salary > 60000, 'High', 'Low')
2FROM employees;

Conversion Functions

Used to convert between data types.
Example
sql
QUBITS OF DPK
1SELECT CAST('2024-01-01' AS DATE);

NULL Handling Functions

Used to safely handle NULL values in queries.
Example
sql
QUBITS OF DPK
1SELECT IFNULL(bonus, 0)
2FROM employees;

JSON Functions

Used for querying and manipulating JSON data (MySQL 5.7+).
Example
sql
QUBITS OF DPK
1SELECT JSON_EXTRACT(data, '$.name')
2FROM users;

Window Functions

Used for analytics and row-level ranking without collapsing groups.
Example
sql
QUBITS OF DPK
1SELECT salary,
2       RANK() OVER (ORDER BY salary DESC) AS salary_rank
3FROM employees;

System & Metadata Functions

Used to retrieve database and connection information.
Example
sql
QUBITS OF DPK
1SELECT DATABASE();

MAANG Interview Focus List

These functions appear in 90% of SQL interview questions. Master these first.
sql
QUBITS OF DPK
1COUNT          — row counting and filtering
2SUM            — totals, running sums
3AVG            — averages with GROUP BY
4GROUP_CONCAT   — aggregating strings
5IFNULL         — NULL-safe calculations
6COALESCE       — multi-column NULL fallback
7CASE           — conditional output and bucketing
8DATE_ADD       — date arithmetic
9DATEDIFF       — date range calculations
10ROW_NUMBER     — pagination and deduplication
11RANK           — leaderboards and top-N queries
12CONCAT         — full name or label generation
13SUBSTRING      — parsing structured strings