MYSQL Tutorial



MySQL FUNCTIONS


Introduction to MySQL Functions

MySQL functions are built-in operations that perform calculations or manipulations on data. Functions can be used to:

  • Calculate values like sums and averages
  • Manipulate strings
  • Work with dates and times
  • Handle conditional logic

Common MySQL Functions

Function Description Example
COUNT() Counts rows matching criteria SELECT COUNT(*) FROM employees;
SUM() Sums values in a column SELECT SUM(salary) FROM employees;
AVG() Calculates average value SELECT AVG(salary) FROM employees;
NOW() Returns current date and time SELECT NOW();
UPPER() Converts string to uppercase SELECT UPPER(first_name) FROM employees;

Example Usage

-- Count total employees
SELECT COUNT(*) AS total_employees FROM employees;

-- Find average salary
SELECT AVG(salary) AS avg_salary FROM employees;

-- Show names in uppercase
SELECT UPPER(first_name) AS uppercase_name FROM employees;
  

Use functions to make your queries more powerful and insightful!


🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review