Posts

Showing posts from February, 2020

MySQL Part 6: Aggregations

Image
Introduction In this article, we discuss some simple aggregations that MySQL offers.  In Part 5 of this series, we went through some filtering and sorting functions widely used in SQL statements.  For more information about this article, click the link below. MySQL Part 5: Refining Select Statements To begin your MySQL session in the goormIDE, please be sure to type this code into the terminal. mysql - ctl cli Please ensure that the bike_shop.sql file is selected and available.  If not, double-click it on the left-hand side.  This is where we will type most of our code. If there is information saved in there, go ahead and clear out that information. Aggregations Defined According to the site, www.xplenty.com/glossary/what-is-sql-aggregation/ , "SQL aggregation is the task of collecting a set of values to return a single value. It is done with the help of aggregate functions, such as SUM, COUNT, and AVG. For example, in a database of products, you might want to ...

MySQL Part 5: Refining Select Statements

Image
Introduction In this article, we will walk through some popular SELECT statements in MySQL. In Part 4 of this series, we created new columns of data using various string functions.  Click the link below for more information. MySQL Part 4: String Functions To begin your MySQL session in the goormIDE, please be sure to type this code into the terminal. mysql - ctl cli Please ensure that the bike_shop.sql file is selected and available.  If not, double-click it on the left-hand side.  This is where we will type most of our code. If there is information saved in there, go ahead and clear out that information.   DISTINCT Function The DISTINCT function will display how many unique values there are for a particular column or set of columns.  First, let's make a simple SELECT statement on the orderlines table. SELECT order_id FROM orderlines; Be sure to save and run the source file in the terminal section. SOURCE bike_shop. sql ; The resu...

MySQL Part 4: String Functions

Image
Introduction In this article, we will walk through some of the more popular string functions available in MySQL.  For an extensive list of string functions, check out the link below. https://dev.mysql.com/doc/refman/8.0/en/string-functions.html In Part 3 of this series, we created the tables and the data presented in the article below.  For more information about this article, click the link below. MySQL Part 3: Create Tables In Part 4, we will use the bike shop data to add string functions to existing columns.   If you started a new MySQL session, please type the following into the terminal and press <Enter>. mysql - ctl cli Please ensure that the bike_shop.sql file is selected and available.  If not, double-click it on the left-hand side.  This is where we will type most of our code. If there is information saved in there, go ahead and clear out that information.   Add String Functions to Columns We created a bikes table that in...