Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with MariaDB

You're reading from   Getting Started with MariaDB Explore the powerful features of MariaDB with practical examples

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785284120
Length 140 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Bartholomew Daniel Bartholomew
Author Profile Icon Daniel Bartholomew
Daniel Bartholomew
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Installing MariaDB 2. Configuring MariaDB FREE CHAPTER 3. Securing MariaDB 4. Administering MariaDB 5. Using MariaDB – Databases and Tables 6. Using MariaDB – Inserting, Updating, and Deleting 7. Using MariaDB – Retrieving Data 8. Maintaining MariaDB A. MariaDB Next Steps
Index

Summarizing data


Sometimes, we are just looking for information about our data. For this, MariaDB has several built-in functions: AVG, COUNT, MIN, MAX, and SUM.

The AVG function

The AVG function is used for obtaining the average of the data in a column. For example, combined with the TIMESTAMPDIFF and CURDATE functions, we can use the AVG function to calculate the average age of all of the people in the employees table.

The CURDATE function doesn't take any arguments and when called, it simply returns the current date.

The TIMESTAMPDIFF function takes three arguments—the unit to count by and two dates, and then outputs the difference between the two. The unit is one of several time units, including MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, and YEAR.

Tip

The TIMESTAMPDIFF and CURDATE functions are just two of several functions that make working with dates and times easier. Find out more about them at the following location:

https://mariadb.com/kb/en/date-and-time-functions/

Putting all three functions...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image