<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jo</title>
    <description>The latest articles on DEV Community by Jo (@jo).</description>
    <link>https://dev.to/jo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3871%2FcvKgDExR.jpg</url>
      <title>DEV Community: Jo</title>
      <link>https://dev.to/jo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jo"/>
    <language>en</language>
    <item>
      <title>Link Jupyter Notebook to Github</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Wed, 25 May 2022 17:38:50 +0000</pubDate>
      <link>https://dev.to/jo/link-jupyter-notebook-to-github-255e</link>
      <guid>https://dev.to/jo/link-jupyter-notebook-to-github-255e</guid>
      <description>&lt;p&gt;This post will explore (and serve as a personal reference) for linking a jupyter notebook to github. This guide assumes you have a github account, basic knowledge of git and the command line, and is currently using Jupyter notebook. &lt;/p&gt;

&lt;p&gt;Firstly, spin up jupyter notebook using your CLI and this command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

jupyter notebook


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This should bring you to the jupyter notebook interface as seen as the screenshot below:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyddai854kc75kjtw2rgt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyddai854kc75kjtw2rgt.png"&gt;&lt;/a&gt;&lt;br&gt;
Click the dropdown on the right, and select "Python 3". This will spin up the IDE, which you can then name appropriately. For this example, I copy pasted code from &lt;a href="https://www.w3schools.com/python/matplotlib_pyplot.asp" rel="noopener noreferrer"&gt;W3Schools&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The below screenshot is the result:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wkfad21khmx7e166wcm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wkfad21khmx7e166wcm.png" alt="jupyter notebook example code and accompanying visualization"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great. Now we have the code. In Jupyter, go to "File" and go to "Download As:", select "Notebook"(.ipynb)&lt;/p&gt;

&lt;p&gt;Now, sign into your github account, and create a new repository. On the Quick set up page select the "…or create a new repository on the command line" option&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh9sdgonrqw5mynmfj0e9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh9sdgonrqw5mynmfj0e9.png" alt="Github repo setup options"&gt;&lt;/a&gt;&lt;br&gt;
Copy paste the code into your command line like so: &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuai0o179exjwq18bcvij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuai0o179exjwq18bcvij.png" alt="git command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go back to github and refresh the page.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzjs8hy8u7mkgqlgbq8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzjs8hy8u7mkgqlgbq8r.png" alt="Github add new files page"&gt;&lt;/a&gt;&lt;br&gt;
Select "Upload files".&lt;br&gt;
Choose the file you've just downloaded from the jupyter gui and select "Commit changes". This will then take you back to the file screen where you can now click on the file you just uploaded. The screenshot below shows the final result. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcxtbcik3mecy0l34ky2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcxtbcik3mecy0l34ky2.png" alt="Code and viz on github-final result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your jupyter notebook work is now shareable to others. &lt;/p&gt;

</description>
      <category>data</category>
      <category>jupyter</category>
      <category>python</category>
    </item>
    <item>
      <title>Primary Keys in SQL</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Mon, 11 Oct 2021 00:19:41 +0000</pubDate>
      <link>https://dev.to/jo/primary-keys-in-sql-nja</link>
      <guid>https://dev.to/jo/primary-keys-in-sql-nja</guid>
      <description>&lt;p&gt;We want all our data entries in a table to be uniquely identifiable. A Primary key is a unique identifier on a row. A good example of a primary key is your twitter handle. No 2 twitter handles are the same, and your twitter handle cannot be NULL. You can change your twitter handle, but it always has to be unique (and twitter will not allow the change unless it is unique value).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE unique_students (student_id INT NOT NULL,
name VARCHAR(100),
age INT,
PRIMARY KEY(student_id)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The below image will shows us what the above code creates in mysql:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz5g3rpbym2qfy97qszf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz5g3rpbym2qfy97qszf3.png" width="800" height="691"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we can see that the primary key is the student_id. However, it would be less efficient in this database to manually create our primary key. We can do this automatically with the auto_increment keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE unique_students (
student_id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100),
age INT,
PRIMARY KEY(student_id)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The auto_increment id will add a 1 each time, so we no longer have to specify it when creating a new entry&lt;br&gt;
In the highlighted section of the graphic below, we can see that we have 2 identical entries except they have different student_id's because they've been auto_incremented.  They are actually 2 separate students who happen to have the same first name and age (which is quite common in a school setting).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhu7ghh347fuh2ndejlpt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhu7ghh347fuh2ndejlpt.png" width="800" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The auto_increment now lies in the "Extra" field (use the &lt;strong&gt;DESC&lt;/strong&gt; keyword to show the table's description.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb2v6y5smxza5156xzs97.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb2v6y5smxza5156xzs97.png" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all for this blog, folks. Thanks for checking it out :)&lt;/p&gt;

</description>
      <category>sql</category>
    </item>
    <item>
      <title>Cyclistic Capstone Project</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Thu, 02 Sep 2021 00:24:37 +0000</pubDate>
      <link>https://dev.to/jo/cyclistic-capstone-project-1997</link>
      <guid>https://dev.to/jo/cyclistic-capstone-project-1997</guid>
      <description>&lt;p&gt;This is an opportunity to analyze historical bicycle trip data in order to identify trends. Understanding how casual riders behave differently from paid riders with annual membership is important.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This analysis will help executives to make decisions about marketing programs and strategies to convert casual riders to riders with annual memberships.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Background:
&lt;/h3&gt;

&lt;p&gt;Cyclistic is a bike-share program that features more than 58,000 bicycles and 600 docking stations. Cyclistic sets itself apart by also offering reclining bikes, hand tricycles, and cargo bikes, making bike-share more inclusive to people with disabilities and riders who can't use a standard two-wheeled bike. The majority of riders opt for traditional bikes; about 8% of riders use the assistive options. Cyclist users are more likely to ride for leisure, but about 30% use them to commute to work each day. &lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Stakeholders and Team
&lt;/h3&gt;

&lt;p&gt;Lily Moreno: Director of Marketing &lt;br&gt;
Marketing Analytics Team: Team responsible for collecting, analyzing, and reporting data. &lt;br&gt;
Cyclistic Executive Team: The notoriously detailed-oriented executive team will decide whether to approve the recommended marketing program.&lt;/p&gt;

&lt;h3&gt;
  
  
  About the Company:
&lt;/h3&gt;

&lt;p&gt;Cyclistic has 3 different pricing tiers: single-ride passes, full-day passes and annual memberships. Customers who purchase single ride or full day passses are referred to as causal riders. Customer who purchase annual memberships are Cyclistic &lt;em&gt;members&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;Cyclistic's finance analysts have determined that annual members are much more profitable than casual riders. Moreno believes that maximizing the number of annual members will be key to future growth. Rather than creating a marketing campaign that targets all new customers, Moreno believes there is a very good chance to convert casual riders into members. &lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Ask
&lt;/h3&gt;

&lt;p&gt;Three questions will guide the future marketing program:&lt;br&gt;
1) How do annual members and casual riders use Cyclistic bikes differently?&lt;br&gt;&lt;br&gt;
2) Why would casual riders buy Cyclistic annual memberships&lt;br&gt;&lt;br&gt;
3) How can Cyclistic use digital media to influence casual riders to become members.&lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  1st step- Importing the data
&lt;/h3&gt;

&lt;p&gt;Before any analysis or processing of the data can be done, we first need to import the data. I am choosing to use R for this analysis as the data is too large for spreadsheets. Below we are using the requisite packages and library in order to import the data.&lt;/p&gt;

&lt;p&gt;We have imported all the requisite files. However, they are all still separated into individual months. We need them in one singular table. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rbind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Jan_5_21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Feb_4_2021&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;March_9_2021&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;April_8_2021&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;May_7_2021&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;June_11_2021&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;July_15_2021&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Aug_11_2020&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Sept_4_2020&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Oct_13_2020&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Nov_4_2020&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Dec_4_2020&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Let us now install all our requisite packages to start processing the data&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;install.packages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"pacman"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pacman&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;install.packages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"tidyverse"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tidyverse&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;install.packages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"janitor"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;janitor&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nf"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We have now imported, and combined all the data from the last 12 months of bike data we have available. &lt;/p&gt;

&lt;h3&gt;
  
  
  Data Exploration
&lt;/h3&gt;

&lt;p&gt;Now that we combined all the data, we should explore it before cleaning.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;glimpse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Clean the data
&lt;/h4&gt;

&lt;p&gt;We have lots of "NAs" in our data. Let us keep only the completed rows.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;complete.cases&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;# Keep only the complete rows&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nf"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We have now removed 434,648 rows that had NAs. This will five us a more accurate data set with which to make calculations with:&lt;/p&gt;

&lt;p&gt;We now need to make some of our columns more accessible:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c1"&gt;#The below code is determining the ride length in seconds.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mutate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ride_length&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;ended_at&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;started_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The above code gives us the length of each bike ride in seconds. Let us now determine the ride length in mins and hours by using the seconds_to_period function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;install.packages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"lubridate"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lubridate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mutate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ride_length_time&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;seconds_to_period&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;ride_length&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;A useful thing to add would be the days of the week. Let us extrapolate and add that data to our data set:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

 &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mutate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day_of_week&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weekdays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;started_at&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now let us see what columns we have available to us:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;colnames&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We now need to clean up the started_at and ended_at columns by separating the date and time. This will make for easier analysis further on. In order to do this, we will use the separate function.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;separate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"started_at"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;into&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'start_date'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;'start_time'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;separate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"ended_at"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;into&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'end_date'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;'end_time'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We now have 4 new columns, start_date, start_time,end_date and end_time.&lt;/p&gt;



&lt;br&gt;
Now we have added 4 new columns to the table. We need to do further cleaning of the data to ensure data integrity. 
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;min_ride&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;ride_length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;min_ride&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;I used  the min function on the ride_length column and noticed that the shortest ride was in the negatives. Upon further investigation, I noticed that several rows contained negative numbers in the ride_length column:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;min_ride&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;arrange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;ride_length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min_ride&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Based on the tibble above we can see that the ride_length column that has several thousand negative values, because, for a lot of cases, the rides appeared to be started in Dec 2020,but ending in November 2020. Since we can't time travel yet, we will need to remove those rows for the sake of data integrity:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;ride_length&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the code above, we removed all rows that contained time below 0. Now we run the minimum function again to make sure it worked.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;min_ride&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;ride_length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;min_ride&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After removing the negative numbers in the ride_length columns we now have a minimum time of 1 second. &lt;br&gt;
Running this code resulted in 10,952 rows of inaccurate being removed. We still have a substantial amount of data to work with however, since we have over 4 million rows.&lt;/p&gt;

&lt;p&gt;Let us now determine how many people use Cyclistic in total: &lt;br&gt;
In order to determine the total number of users we are going to count the users and use this information to fill out a pie chart:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'member_casual'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Casual:1,724,745 Members:2,290,711&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;total_number_of_users&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1926094&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2523705&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;pie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_number_of_users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;pie_labels&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"casual"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"members"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;c&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#C5007C"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#8CC702"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;pie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_number_of_users&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;pie_labels&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Total Users"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;legend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"bottomright"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pie_labels&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;From the code and visualization above, we can see that we currently have more members than casual users:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frsryrtdug6jzdrjpltnu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frsryrtdug6jzdrjpltnu.png"&gt;&lt;/a&gt;&lt;br&gt;
Let us create a months column as well: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mutate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Months&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="n"&gt;case_when&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;01&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Jan"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                       &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;02&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"Feb"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;03&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"March"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;04&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"April"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;05&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"May"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;06&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"June"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;07&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"July"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;08&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"Aug"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;09&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"Sept"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"Oct"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;11&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"Nov"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;12&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="s2"&gt;"Dec"&lt;/span&gt;&lt;span class="w"&gt;

 &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;colnames&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Let us plot a bar chart to easily show stakeholders the most popular day of biking: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c1"&gt;#for both casual and members&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;ggplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;geom_bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;aes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;day_of_week&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"purple"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;facet_wrap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="n"&gt;member_casual&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;panel.spacing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lines"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;axis.text.x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;element_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;angle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hjust&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzfot8zwdt64mdzhj7wf5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzfot8zwdt64mdzhj7wf5.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Interpretation of Data for Weekdays
&lt;/h3&gt;

&lt;p&gt;From the bar charts above,we can answer one of our main questions: "How do annual members and casual riders use Cyclistic bikes differently?"&lt;br&gt;
It is clear that &lt;strong&gt;casual&lt;/strong&gt; users of Cyclistic use the app much more on weekends than the rest of the week. The members, however, tend to use the app more uniformly throughout the entire week. This suggests that members are more likely to use the service as their main form of transport, while casual users of the app tend to use it more for recreational purposes (as highlighted by the dramatic increase of use on the weekend for that group)&lt;/p&gt;

&lt;p&gt;To aid in our analysis further down the road, I decided to to break the 12 months worth of data into the 4 seasons:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mutate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Seasons&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="n"&gt;case_when&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;12&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;01&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;02&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Winter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;03&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;04&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;05&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Spring"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;06&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;07&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;08&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Summer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;09&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                         &lt;/span&gt;&lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="m"&gt;11&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Fall"&lt;/span&gt;&lt;span class="w"&gt;

 &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;colnames&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Importance of Seasons for biking
&lt;/h3&gt;

&lt;p&gt;We will be now be able to use the Seasons column to determine which season is the most popular for biking, and therefore, help determine a marketing strategy that will take this into consideration:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;ggplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;geom_bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;aes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Seasons&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"purple"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;facet_wrap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="n"&gt;member_casual&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9c0sxtczhhhsgr6fuadp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9c0sxtczhhhsgr6fuadp.png"&gt;&lt;/a&gt;&lt;br&gt;
Based on the charts above, we can infer that, for both groups, Winter is the least popular month for biking, while Summer is the most popular month for biking. &lt;br&gt;
Members tend to bike more in the fall than casual users.&lt;/p&gt;

&lt;p&gt;Let us now do a count of the number of rows and columns we have currently:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nf"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We have 4015456 rows and 19 columns of data. &lt;/p&gt;

&lt;p&gt;Going back to our business requirements, the first ask was to determine "How do annual members and casual riders use Cyclistic bikes differently. We can also answer this question by finding the average, minimum , and maximum ride_length of each group of riders.&lt;/p&gt;

&lt;p&gt;```{r&lt;br&gt;
&lt;br&gt;
 group and summarize}&lt;br&gt;
ride_summary &amp;lt;- &lt;br&gt;
  yearly_bike_data %&amp;gt;%&lt;br&gt;
  group_by(member_casual) %&amp;gt;%&lt;br&gt;
  summarize(average_ride_time=mean(ride_length),&lt;br&gt;
            min_ride_length=min(ride_length),&lt;br&gt;
            max_ride_length=max(ride_length))&lt;/p&gt;

&lt;p&gt;ride_summary&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### Analysis of Findings:
Though we have more members than casual users of the app, casual users actually ride for longer than members. The average ride time of a 
casual user is 2511.95 seconds while that of a member is 891.89 seconds. The min ride length is the same at 1 second, and the max ride length of a casual user is 3,356,649 seconds and the max ride length of a member is 2,005,282 seconds. 
We can also find the mode of day_of_week to show which day is the most popular for biking.
```{r}


names(sort(-table(yearly_bike_data$day_of_week)))[1]


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;From this code, we can tell that Saturday is the most popular day of the week for biking.&lt;/p&gt;

&lt;p&gt;Now, we want to find out which season is the most popular for biking:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;names&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;Seasons&lt;/span&gt;&lt;span class="p"&gt;)))[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The mode once again tells us that Summer is the most popular month for biking. Let us find out the second most popular month:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nf"&gt;names&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;Seasons&lt;/span&gt;&lt;span class="p"&gt;)))[&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The second most popular season for biking is fall. Let's check the third most popular season for biking:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nf"&gt;names&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;Seasons&lt;/span&gt;&lt;span class="p"&gt;)))[&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Spring is the third most popular season, which means winter is the least popular season for biking. &lt;/p&gt;

&lt;p&gt;Let us make  a chart to show this visually:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="n"&gt;ggplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="n"&gt;geom_bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;aes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Seasons&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;member_casual&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;



&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73x6v14utag0og0i72me.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73x6v14utag0og0i72me.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="n"&gt;ggplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yearly_bike_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="n"&gt;geom_bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;aes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Seasons&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"orange"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="n"&gt;coord_polar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnt7gfm1ag11stllyryfm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnt7gfm1ag11stllyryfm.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pie chart above shows how little the Cyclistic app is used in winter, as opposed to the rest of the months.&lt;/p&gt;

&lt;p&gt;Based on my analysis of the data, I have some recommendations for the Cyclistics marketing team:&lt;br&gt;
1) Converting casual users to members is a good idea, and should be moved forward with since the usage of the app is similar among groups.&lt;br&gt;
2) I would increase marketing to the casual groups during the summer and point how much they would be saving if they were to become members. Since summer is when this group bikes the most, then they would be spending the most money on the app during this time and would probably appreciate a way to lower costs. For all users, I would incorporate a Spotify-esque approach where I would send them a "year in review" on how they used the app. This could include personalized details like: how much calories they burned for the year using Cyclistic, how much money saved by riding (instead of driving) etc. &lt;br&gt;
3)For winter months I would give a discount to encourage members to continue using the app, and to encourage casual users to become users during this time.&lt;br&gt;
4)The data also showed that casual users used the app more so on the weekends than on weekdays, where members were more likely to use the app every day. I would encourage casual users to use the app more in the weekdays by offering discounts on the weekdays, which would then translate to them using the app more and so being more inclined to become members. &lt;/p&gt;

</description>
      <category>rstudio</category>
      <category>r</category>
      <category>data</category>
      <category>dataanalytics</category>
    </item>
    <item>
      <title>How to make the most out of #100DaysOfCode</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Fri, 07 May 2021 16:31:42 +0000</pubDate>
      <link>https://dev.to/jo/how-to-make-the-most-out-of-100daysofcode-46f6</link>
      <guid>https://dev.to/jo/how-to-make-the-most-out-of-100daysofcode-46f6</guid>
      <description>&lt;p&gt;I am at the end of #100DaysOfCode and thought I would share some tips and tricks on how to successfully complete the challenge, my accomplishments, and what I would do differently in the future.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tips and Tricks
&lt;/h3&gt;

&lt;p&gt;1) The main goal of #100DaysOfCode is to code consecutive for 100 days consecutively. Was I successful in this? Actually no. My birthday occured in the middle of the challenge, so I took a few days of to travel and celebrate. Balance is key, so while this challenge provides structure, feel free to afford yourself some flexibility and grace. Life happens and you just may not be able to code for 100 days straight. I would even suggest calibrating this challenge to best fit your needs. If you don't want to code on the weekends, then don't. The challenge will take longer of course, but you need to do what's best for you. &lt;br&gt;
Edit: After drafting this, I went through an extremely traumatic event that required me to take more time off. I almost decided to quit the challenge at d.82, but decided to continue. It helped with getting my life back to normal.&lt;/p&gt;

&lt;p&gt;2) Don't think you have to code for hours at a time every day. There were some days where all I did was watch a Udemy video before going to bed. There were other days when I spent hours coding. For me, I liked doing something every day to keep new concepts fresh in my mind.&lt;/p&gt;

&lt;p&gt;3) Set a goal. Setting a goal sets you up for success. For this challenge, I wanted to learn SQL. The system to learn that goal was to use the #100DaysOfCode challenge to learn SQL via online courses. The secondary goal was to finally start completing those Udemy courses I kept buying.&lt;/p&gt;

&lt;p&gt;4) After you've chosen what you want to learn, try not to go overboard with resources. There are so many free and paid resources, and it's easy to try and want to learn everything. I would suggest that before doing the challenge, do some research on what you would like to learn, then find some resources to help you learn that topic. This will help provide structure so you won't feel like you're flailing in the wind.&lt;/p&gt;

&lt;p&gt;5)Find a way to keep yourself accountable. For me, that was tweeting about it every day. You really don't have a way of knowing if people are paying attention, and in all honesty you have to assume that they don't care. But what if you have one person watching, you don't want to let them down do you? Learning is hard, and learning in public is even harder. Do it anyway. &lt;/p&gt;

&lt;p&gt;TLDR: Be consistent, but flexible, set a goal and have a system for achieving that goal, find a few resources and stick to those to completion.&lt;/p&gt;

&lt;h3&gt;
  
  
  What did I Accomplish?
&lt;/h3&gt;

&lt;p&gt;I started this challenge with the goal to learn SQL because I saw it in so many different job applications. SQL is needed for data analytics, data science, and back-end web development. I learnt mySQL and PostgreSQL as well. &lt;br&gt;
I completed _____ Udemy courses, and later on in the challenge I started the Professional Data Analytics Course from Google. (I have finished the first of 8 courses and will be continuing the rest). Also later in the challenge, I started learning Python and will be continuing that as well. &lt;/p&gt;

&lt;p&gt;I also started about my journey and wrote _ articles about SQL. Writing about sql allowed me to cement the knowledge I was gaining and improved my technical writing ability as well. &lt;br&gt;
I not only improved my writing, but my presentation skills as well by including annotated screenshots and creating my own graphics in Canva as well. The tech world is huge, and all these skills, knowing how code, knowing how to write about technical topics, can all be useful. At the very least, it was helpful for me to go back and revisit topics I had written about so they served as a note taking function as well.&lt;/p&gt;

&lt;h3&gt;
  
  
  What would I do differently in the future.
&lt;/h3&gt;

&lt;p&gt;There is not a lot I would change about my process. I will probably make my goals more defined the next go around, in terms of what I hope to achieve (for example, write more blogs to increase my dev dot to viewership, or choose a sql database tool and try to learn that deeply). &lt;/p&gt;

&lt;p&gt;Thanks for reading! Hope these tips were helpful!&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>sql</category>
      <category>mysql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Popular string functions in MySQL - Replace and Reverse</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Sat, 24 Apr 2021 14:37:46 +0000</pubDate>
      <link>https://dev.to/jo/popular-string-functions-in-mysql-replace-and-reverse-o7p</link>
      <guid>https://dev.to/jo/popular-string-functions-in-mysql-replace-and-reverse-o7p</guid>
      <description>&lt;h3&gt;
  
  
  REPLACE
&lt;/h3&gt;

&lt;p&gt;The replace string function replaces a part of a string with another string. This function is case sensitive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select replace('hello world', 'wor', '$$$');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can you guess what the result of this would be? &lt;br&gt;
Result: hello $$$rld&lt;br&gt;
In the example above, we have replaced &lt;strong&gt;'wor'&lt;/strong&gt; with &lt;strong&gt;'$$$'&lt;/strong&gt;. &lt;br&gt;
The below screenshot uses replace on the "title" column in the books table and replaces all lower letter e's with the number 3&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdy8y4arz4sdski9zp0gz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdy8y4arz4sdski9zp0gz.png" width="800" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also combine the replace string function with other string functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select substring(replace(title, 'e', '3'),1,5) As weird_title from books;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The screenshot below shows the results: All the lowercase e's have been replaced by the number 3 and the substring function has been used to extrapolate the first 5 characters from the data.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe052xlk27sphsb66bhz4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe052xlk27sphsb66bhz4.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  REVERSE
&lt;/h3&gt;

&lt;p&gt;The reverse string accepts one argument (the string to be reversed) and the reverses it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select reverse('hello world');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result is: dlrow olleh&lt;/p&gt;

&lt;p&gt;That's the end of this article. Hope you found it useful!&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
    </item>
    <item>
      <title>Popular string functions in MySQL - CONCAT and SUBSTRING</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Fri, 23 Apr 2021 16:37:06 +0000</pubDate>
      <link>https://dev.to/jo/popular-string-functions-in-mysql-concat-and-substring-h1o</link>
      <guid>https://dev.to/jo/popular-string-functions-in-mysql-concat-and-substring-h1o</guid>
      <description>&lt;p&gt;There are some very helpful and fun string functions in MySQl and I've decided to review them here as I go through Colt Steele's MySQL Udemy course. This article will serve as my notes for that section of the course. &lt;/p&gt;

&lt;h3&gt;
  
  
  CONCAT
&lt;/h3&gt;

&lt;p&gt;The CONCAT function concatenates two or more value together. This is helpful for formatting data that is useful to the person reading the output. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

select concat(author_fname, " ", author_lname, " - ", title) AS Author
from books;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03l729h9jiflx3ehxmjp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03l729h9jiflx3ehxmjp.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A variation of the CONCAT function is the CONCAT_WS function, which stands for CONCAT &lt;strong&gt;with separator&lt;/strong&gt;. This is useful if you're separating multiple pieces of data with the same symbol between them. The first argument in the CONCAT_WS function is the operator used to separate all the the other individual arguments. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

select concat_ws(' - ', author_fname, author_lname, title) 
AS Author
from books;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Filodx0xxcrfnlv6zje79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Filodx0xxcrfnlv6zje79.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see from the example above, there is now a dash between the author's first name, last name, and book title.&lt;/p&gt;

&lt;h3&gt;
  
  
  SUBSTRING
&lt;/h3&gt;

&lt;p&gt;Another helpful function is substring. This function is useful for extrapolating data when you only need a part of the string. This function is also useful in combination with other functions to make even more powerful queries. The basic makeup of a simple substring query includes the string that data needs to be extrapolated from, and the location of the data.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

select substring('Jowayne', 1,2)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The result of the example above would give me "Jo", as the Jowayne is the string to be analyzed, the 1 is location where I need the extrapolation to begin, and 2 is where I need it to end. &lt;br&gt;
You can also choose to just use one number(the starting index) and the function will automatically start at that number and go till the end, like so:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

select substring('Jowayne',3)



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The result of this would be &lt;strong&gt;"wayne"&lt;/strong&gt; since I started at 3.&lt;br&gt;
The substring function also accommodates negative numbers. The substring would begin at the end of the string so:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

select substring('Jowayne',3)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The result would be &lt;strong&gt;'yne'&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;And as I referenced before, you can use substring with other string functions:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

select concat(substring(title, 1, 10),'...') from books;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3i3s94sbk1qt5uyisr9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3i3s94sbk1qt5uyisr9n.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it for this post! Thanks for reading :)&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
    </item>
    <item>
      <title>SQL Review - Useful queries for mySQL</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Wed, 21 Apr 2021 01:42:00 +0000</pubDate>
      <link>https://dev.to/jo/sql-review-useful-queries-for-mysql-1gkh</link>
      <guid>https://dev.to/jo/sql-review-useful-queries-for-mysql-1gkh</guid>
      <description>&lt;p&gt;This post will cover some useful mySQL queries that I am just now discovering and that would have been really helpful when I just started my journey of learning sql. Alas, we live and we learn.&lt;/p&gt;

&lt;h3&gt;
  
  
  Show databases
&lt;/h3&gt;

&lt;p&gt;The&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;show databases;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 command shows you a list of the databases available.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa393dbca9gjhpwh3ygm4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa393dbca9gjhpwh3ygm4.png" width="800" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Use database_name
&lt;/h3&gt;

&lt;p&gt;The&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;use database;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 command allows you to switch between databases.  I've found this one pretty helpful, pretty helpful I'd been double, triple, and quadrouple clicking a database name in mySQL in order to navigate among databases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Show table
&lt;/h3&gt;

&lt;p&gt;The&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;show table&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 command shows you the tables in a database (which could be especially useful after the use database command)&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu48kgoiadh5fa74ep9b4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu48kgoiadh5fa74ep9b4.png" width="800" height="758"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Desc table_name
&lt;/h3&gt;

&lt;p&gt;The&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;DESC table_name;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 command shows field, type, key, null value, and default values of a table. This is very helpful for troubleshooting.The extra column would hold something like "auto _increment" for  a primary key.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9y88bk35xz1x0tebtxe0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9y88bk35xz1x0tebtxe0.png" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Show Warnings
&lt;/h3&gt;

&lt;p&gt;The&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;SHOW warnings&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 command shows what the warning message is if your query is not correct in some way. &lt;/p&gt;

</description>
      <category>mysql</category>
      <category>sql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>SQL Review - GROUP BY Query</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Sun, 11 Apr 2021 00:43:54 +0000</pubDate>
      <link>https://dev.to/jo/sql-review-group-by-query-277p</link>
      <guid>https://dev.to/jo/sql-review-group-by-query-277p</guid>
      <description>&lt;p&gt;The GROUP BY clause is mostly used with aggregate functions in sql. Aggregate functions in sql are different from single row functions in one main way: Single row functions return a single result row for EVERY row of a queried table or view. Aggregate functions performs a calculation on a set of values in a column and returns one single value. The 5 most common  aggregate functions in sql are: COUNT(), MAX(), MIN(), AVG(),SUM(). These do exactly what they sound like they do, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select max(supply) from fruit_imports;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The other main difference between aggregate functions and single row functions is that while you use the "WHERE" clause to filter information in a single row function, you would use the "HAVING" clause to filter information in an aggregate function query (examples and screenshots coming up, don't worry)&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ivpzooyj93zfuolauwk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ivpzooyj93zfuolauwk.png" width="600" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the graphic above, we see the anatomy of a GROUP BY query. &lt;/p&gt;

&lt;p&gt;We will be working with the example below to discuss the GROUP BY query.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn8nmai0mneoqq9eqsuov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn8nmai0mneoqq9eqsuov.png" width="800" height="759"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Any non-aggregate (not a MIN,MAX,COUNT,AVERAGE or SUM) column must be mentioned in the GROUP BY clause. Please see the screenshot below:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0gygqwhg3yhjz6sbbvp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0gygqwhg3yhjz6sbbvp.png" width="800" height="818"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the screenshot above, there are two columns, the sum_supply column and the state column. The sum_supply column is the aggregate column and the state is the non-aggregate column. The state column is the one that is included in the GROUP BY clause because it is non-aggregated column.&lt;/p&gt;
&lt;h3&gt;
  
  
  HAVING
&lt;/h3&gt;

&lt;p&gt;Having is used to filter group data. If you are filtering data with  the HAVING clause, it must come after the GROUP BY clause. HAVING is used on aggregate functions in lieu of the WHERE clause.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT first_name, COUNT(*)
FROM employees
GROUP BY first_name
HAVING COUNT(*)&amp;gt;2;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm3iyc9hmnqkk4gzn3oi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm3iyc9hmnqkk4gzn3oi.png" width="800" height="933"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The results in the screenshot show all the employee names that are mentioned more than 2 times. That means in the full list of employee first names, there are 3 Roslyns and 3 Billies.&lt;/p&gt;

&lt;p&gt;Thanks for reading! Hope this informative. Please feel free to comment, clarify or add to this :)&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
    </item>
    <item>
      <title>SQL Review - How to create an ERD in MySQL</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Mon, 22 Mar 2021 20:32:14 +0000</pubDate>
      <link>https://dev.to/jo/how-to-create-an-erd-in-mysql-eon</link>
      <guid>https://dev.to/jo/how-to-create-an-erd-in-mysql-eon</guid>
      <description>&lt;p&gt;During my self study of SQL, I've encountered the concept of the ERD or the Entity Relationship Diagram, which seems quite interesting as it can be useful in building your database. It also seems gives you a visual representation of the tables in your database which I assume can also aid in problem solving. &lt;/p&gt;

&lt;p&gt;In order to create an ERD in MySQL, select Database &amp;gt; Reverse Engineer, as demonstrated by the graphic below:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn8jlp0nl7fpwyzc7ijba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn8jlp0nl7fpwyzc7ijba.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, select the Continue button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs21x0wqdv1x4kmxyuq63.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs21x0wqdv1x4kmxyuq63.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MySQL will now ask for your password, which will be the same password you used to create the database initially.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd2g6epkduihaart76q7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd2g6epkduihaart76q7s.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, you will be asked to select a database to work with. Select a database, then select "Continue".&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39mzyqs5rrcwo1gghmzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39mzyqs5rrcwo1gghmzn.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select "Execute"&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn38x1s0uon0zjneap45u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn38x1s0uon0zjneap45u.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tada, there is your ERD. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3941j5ikoq7fxl25kb5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3941j5ikoq7fxl25kb5.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
    </item>
    <item>
      <title>SQL Review - Differences Between MySQL and PostgreSQL</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Sun, 28 Feb 2021 02:24:05 +0000</pubDate>
      <link>https://dev.to/jo/differences-between-mysql-and-postgresql-38e6</link>
      <guid>https://dev.to/jo/differences-between-mysql-and-postgresql-38e6</guid>
      <description>&lt;p&gt;I am currently working through a Udemy course where the instructor is using PostgreSQL and I am using MySQL with the result being that I have to do things a bit differently in order to achieve the same results. I thought this would be an efficient way to learn the nuances of both systems simultaneously (I also have access to PostgreSQL on my MAC). Currently I am learning about single line functions, and encountered a pretty big difference with how both databases handle the capitalization of the first letter of a word. With PostgreSQL it is as easy as:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 INITCAP('hello')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;result is 'Hello'&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feh5441hkxtvdokv2t33w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feh5441hkxtvdokv2t33w.png" alt="SQLEctron initcap example"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;In MySQL however, it gets a bit more complicated:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 CONCAT(UPPER(SUBSTRING('hello',1,1)),LOWER(SUBSTRING('hello',2)))

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Result is also Hello.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;The image below shows a running example in MySQL where instead of using a string I have used the name of one of columns in the employees table.&lt;br&gt;
 &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fstiuhhkhl6y9xgr19wkh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fstiuhhkhl6y9xgr19wkh.png" alt="mysql img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I decided to keep track of the differences to use for future references since I spent several minutes googling how one would capitalize the first letter of a word in MySQL. Future Jo will thank me I'm sure. &lt;/p&gt;

&lt;p&gt;I will continue adding here as I encounter more differences between the two databases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Differences in Concatenation Between PostgreSQL and MySQL
&lt;/h3&gt;

&lt;p&gt;Concatenation is briefly mentioned above but I thought I would go into more in depth here.&lt;br&gt;
In PostgreSQL we concatenate strings or columns by using 2 pipe symbols(in some programming languages like javascript, the || means 'or'. &lt;br&gt;
In PostgreSQL it is used to concatenate like so:&lt;br&gt;
&lt;code&gt;SELECT hire_date ||' '|| '09:00' FROM employees;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj53lk9il28mvhxyvqw2g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj53lk9il28mvhxyvqw2g.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I included the ||' '|| to put some space between the date and the time.&lt;/p&gt;

&lt;p&gt;PostgreSQL also makes use of the CONCAT function in the same way that MySQL, offering even further flexibility. &lt;/p&gt;

&lt;p&gt;In MySQL, we use use the CONCAT function to concatenate:&lt;br&gt;
&lt;code&gt;SELECT CONCAT (hire_date,' ', '09:00') AS Date&lt;br&gt;
FROM employees;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15bmf83j0dte47bfru7j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15bmf83j0dte47bfru7j.png"&gt;&lt;/a&gt;&lt;br&gt;
Here we see the CONCAT can take multiple expressions and they are separated by commas, not | |. &lt;/p&gt;

&lt;h1&gt;
  
  
  Differences in date in MySQL and PostgreSQL
&lt;/h1&gt;

&lt;p&gt;When converting dates in Postgresql, we use the &lt;strong&gt;to_char&lt;/strong&gt; function which accepts the column we want to convert, as well as the format with which we wish to convert as demonstrated by so:&lt;br&gt;
&lt;code&gt;SELECT to_char(hire_date, 'yyyy/mm/dd')&lt;br&gt;
FROM employees&lt;/code&gt;&lt;br&gt;
The year, month and day do not need to be separated by a slash(/). They can also be separated by a dash(-) or a space.&lt;br&gt;
My favorite part about working with dates in PostgreSQL is how flexible and intuitive it seems to be, just check out the example below:&lt;br&gt;
The code is: &lt;br&gt;
&lt;code&gt;SELECT hire_date, to_char (hire_date, 'yyyy Mon day the dd') &lt;br&gt;
FROM employees;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F070hwcf0d67t7jmrni1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F070hwcf0d67t7jmrni1m.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The results as displayed are in the format &lt;strong&gt;2006 Apr thursday the 20&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Things work a bit differently in MySQL as the date_format function is used instead of the to_char. MySQL also seems less intuitive in terms of writing the date format &lt;br&gt;
&lt;code&gt;SELECT date_format(hire_date,'%b %D %Y')&lt;br&gt;
from employees;&lt;/code&gt;&lt;br&gt;
Upon reading the above, it may not be clear how the function would actually convert the date. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftbnj5zlxqhr31ixum5kk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftbnj5zlxqhr31ixum5kk.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a reference for what the symbols mean &lt;a href="https://www.w3schools.com/sql/func_mysql_date_format.asp" rel="noopener noreferrer"&gt; MySQL Date references &lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Subtle Differences between Trunc and Truncate in MySQL and PostgreSQL
&lt;/h3&gt;

&lt;p&gt;As I was testing out my sql queries in my two different databases, I realized that there are subtle differences in the way both databases handle the trunc function that may be a bit confusing initially. &lt;br&gt;
The MySQL TRUNCATE() function truncates a number to the specified number of decimal places. &lt;br&gt;
You must specify the number of decimal places when using the Truncate function in MySQL. If you don't, you will see this error returned to you :&lt;br&gt;
&lt;strong&gt;The TRUNCATE() function truncates a number to the specified number of decimal places.&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2l4cpur4ccl1lt33fl3j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2l4cpur4ccl1lt33fl3j.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Postgresql, the function we use to accomplish the same thing is called TRUNC(), and you do not need to specify decimal numbers the way you do in MySQL. At least if you don't it will not explicitly return an error. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faeuyz6ah4azkmfww8ug3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faeuyz6ah4azkmfww8ug3.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Boolean Expressions
&lt;/h3&gt;

&lt;p&gt;I have started my THIRD Udemy SQL course (applause please) and while some of the information has become repetitive, in a lot of ways, it isn't. I am still learning new ways to do different things and how am still learning about the different nuances of PostgreSQL and MySQL.&lt;br&gt;
In this particular course, I was introduced to Boolean expressions which I think is a really helpful way of displaying information. The query used to display Boolean expression is exactly the same in both databases but the results are slightly different (at least, they are aesthetically different in how they're represented) But, the mean the same thing:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 first_name, last_name, salary, (salary &amp;gt; 140000) 
AS SalaryOver140K
FROM employees
Order By SalaryOver140K;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here are the results in mySQL&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcpg6k13fsxnjxlh3sqzq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcpg6k13fsxnjxlh3sqzq.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conversely, here are the records in PostgreSQL&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjjpv9rz5wzc7wuhqaxsy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjjpv9rz5wzc7wuhqaxsy.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In mySQL, the 0 represents false and the 1 represents True. This representation is a lot more clear in PostgreSQL, which tells you clearly if the condition is "True" or "False"&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>How to Complete a Udemy Course</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Wed, 17 Feb 2021 19:12:18 +0000</pubDate>
      <link>https://dev.to/jo/how-to-complete-a-udemy-course-461e</link>
      <guid>https://dev.to/jo/how-to-complete-a-udemy-course-461e</guid>
      <description>&lt;p&gt;If you're anything like me, you have a Udemy account filled with courses that you bought on one of the site's many sales. Udemy is indeed a developer's catnip. We just can't get enough. We're gonna be so productive and learn all the things! &lt;br&gt;
But if we're being honest, buying a course is usually the first and only step we make. Life happens, we get busy. But the cycle continues because the courses (when they're on sale) are so cheap. So tempting. There are worse things to be addicted than Udemy courses. At least we bought the course. It's the thought that counts right? Where's my cookie for spending 10 bucks on a Udemy course instead of Chipotle?!&lt;/p&gt;

&lt;p&gt;This year I decided that instead of buying more Udemy courses, I would actually start working through the ones I had purchased. I had decided to start learning SQL, and luckily I had already stashed 3 SQL courses in my Udemy account. I picked the shortest one to give myself some motivation. It was a 4 hour Oracle course, and I incorporated it into my #100daysofcode challenge. Some days I would only watch one video, others I would watch 3. I tried to not let more than a couple days pass without at least watching one video. These are baby steps, well not even steps since it took me about 29 days to finish the course. 29 days! For a 4 hour course! But I completed it, instead of allowing to sit there for another year. I have moved on to another SQL course, this one about 10 hours long. I look forward to completing that one as well.&lt;/p&gt;

&lt;p&gt;TLDR: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Don't buy any more courses&lt;/li&gt;
&lt;li&gt;Choose the shortest course you already own on a subject matter you'd like to learn&lt;/li&gt;
&lt;li&gt;Watch at least one video a day, no matter how long it takes. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Hope this helps motivate someone to stop buying and start doing :)&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>udemy</category>
      <category>sql</category>
    </item>
    <item>
      <title>SQL Review - WHERE, SELECT</title>
      <dc:creator>Jo</dc:creator>
      <pubDate>Thu, 28 Jan 2021 21:16:43 +0000</pubDate>
      <link>https://dev.to/jo/sql-review-3243</link>
      <guid>https://dev.to/jo/sql-review-3243</guid>
      <description>&lt;p&gt;I've recently started teaching myself SQL as part of the #100daysofcode challenge and I thought I would make some notes in order to review some of the things I've learnt.&lt;br&gt;
SQl is the language used for storing, manipulating and retrieving data. The SQL Language is used with MySQL, SQL Server, MS Access, Oracle and other systems. &lt;/p&gt;

&lt;p&gt;SQL stands for Structured Query Language. It can execute, retrieve, insert, update, delete and create records in a table in a database. &lt;/p&gt;
&lt;h4&gt;
  
  
  SQL Statements
&lt;/h4&gt;

&lt;p&gt;Most of the actions you need to perform on a db are done with SQL statements. &lt;/p&gt;

&lt;p&gt;Ex. &lt;br&gt;
&lt;code&gt;SELECT * FROM employees;&lt;/code&gt;&lt;br&gt;
This line of code is using the SELECT statement to query all the column names from the employees table using the * (which means all columns) &lt;/p&gt;

&lt;p&gt;SQL keywords are not case sensitive, so SELECT is the same as select, but it is common practice to to capitalize keywords. &lt;/p&gt;
&lt;h4&gt;
  
  
  SELECT SYNTAX
&lt;/h4&gt;

&lt;p&gt;SELECT Syntax is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT column1, column2 FROM table_name;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;An example of this is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT age, salary 
FROM employees;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where age and salary are both columns in the employees table.&lt;/p&gt;

&lt;h4&gt;
  
  
  SELECT DISTINCT
&lt;/h4&gt;

&lt;p&gt;The SELECT DISTINCT keyword is used to retrieve unique values in a table, so values will not be repeated in the result set. Since a column can often have duplicate values, using the DISTINCT keyword is a good way of removing those duplicates. &lt;/p&gt;

&lt;p&gt;For example, customers may purchase the same kind of fruit. You may just want the data for the kind of fruit purchased, and not necessarily all data for all the fruit each individual purchased. &lt;/p&gt;

&lt;p&gt;Instead of typing &lt;code&gt;SELECT Fruit FROM Customers;&lt;/code&gt;&lt;br&gt;
We would type:&lt;br&gt;
&lt;code&gt;SELECT DISTINCT Fruit FROM Customers;&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;We can get even more specific while using the DISTINCT keyword. &lt;br&gt;
For ex:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT COUNT (DISTINCT Fruit) FROM Customers;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;As the keyword COUNT may suggest, this query will count the number of distinct values in a column and return that value to you. &lt;/p&gt;

&lt;h4&gt;
  
  
  The WHERE Clause
&lt;/h4&gt;

&lt;p&gt;The WHERE clause is used to filter information in a query statement. &lt;br&gt;
The syntax is as follows: &lt;br&gt;
&lt;code&gt;SELECT column1 FROM table_name WHERE condition;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For ex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM employees
WHERE State = "Idaho";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will return all the information about employees who live in Idaho. &lt;/p&gt;

&lt;h4&gt;
  
  
  Text and Numeric Fields
&lt;/h4&gt;

&lt;p&gt;You must use single or double quotes around text fields in SQL. The opposite is true for numeric fields, as they do not require quotes and will result in an error. &lt;/p&gt;

&lt;p&gt;Note: You must have a semicolon at the end of each query for it to run. You can't just do whatever, this isn't javascript ;)&lt;/p&gt;

&lt;p&gt;That's it for Part 1. Thanks for reading!&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
