3. Using Functions

Worksheet Overview

In addition to outputing specific fields in the table, the select statement allows new data be computed and output, either using arithmetic expressions or functions from the extensive function library.

Open this page in a separate window as a ready reference to the functions provided by MySQL. These are not standardised, and other versions of SQL will have somewhat different functions.

Contents

1. Demo: Show the number of Employees
2. Task: Show the number of Departments
3. Task: Show the number of Salary Grades
4. Demo: Show the annual salary (for 12 months) for each Employee
5. Demo: Name the computed field
6. Task: Show the Total Annual salary, including commission
7. Demo: Convert Nulls to zero.
8. Demo: Simple expressions: Current Date
9. Task: Show the Current time
10. Read: Worksheet Completed

Related worksheets

1. Introduction to the Emp-dept case study
2. Some simple SQL Select statements
4. Selecting ROWS to display
5. Multiple tables
6. Summarising and Grouping
7. Handling Dates
8. Inner and Outer Joins