SELECT and joins
Read rows, filter them, and combine tables.
SELECT hostname, mgmt_ip
FROM device
WHERE last_seen > NOW() - INTERVAL 1 DAY
ORDER BY hostname;
SELECT d.hostname, i.name
FROM device AS d
JOIN interface AS i ON i.device_id = d.id;Inner joins keep rows that match on both sides. Left joins keep the left table even when the right side is missing. Filter with WHERE, aggregate with GROUP BY, and never SELECT * in application code.