SQL Functions
Posted on Oct 15, 2022
SQL provides many built-in functions to help you manipulate and analyze data efficiently.
Aggregate Functions
COUNT
Count the number of rows:
SELECT COUNT(*) FROM books;
SUM
Calculate the total:
SELECT SUM(price) FROM books;
AVG
Calculate the average:
SELECT AVG(rating) FROM reviews;
String Functions
UPPER and LOWER
SELECT UPPER(first_name) FROM customers;
SELECT LOWER(email) FROM customers;
CONCAT
SELECT CONCAT(first_name, ' ', last_name) AS full_name
FROM authors;
Master these functions to become more efficient with SQL!