<?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: Fullstack Dev</title>
    <description>The latest articles on DEV Community by Fullstack Dev (@fullstackdev).</description>
    <link>https://dev.to/fullstackdev</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%2F1192993%2F59787c15-c229-4973-85ad-741e0343ef44.png</url>
      <title>DEV Community: Fullstack Dev</title>
      <link>https://dev.to/fullstackdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fullstackdev"/>
    <language>en</language>
    <item>
      <title>Separation of concern &amp; Murphy's law</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Sun, 06 Oct 2024 15:51:34 +0000</pubDate>
      <link>https://dev.to/fullstackdev/separation-of-concern-murphys-law-50i4</link>
      <guid>https://dev.to/fullstackdev/separation-of-concern-murphys-law-50i4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Anything that can go wrong will go wrong&lt;/strong&gt; is what Murphy's law tells us. This comes as a principle in software engineering known as separation of concern.&lt;/p&gt;

&lt;p&gt;Separation of concern is a design principle in programming used to break an application into sections or modules.&lt;/p&gt;

&lt;p&gt;SoC ensures that each section is responsible for a specific aspect of functionality or behavior. this ensures that the applications is easy to maintain and easy to scale.&lt;/p&gt;

&lt;p&gt;This principle allows us to create reusable components that can be used across the entire application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Murphy's Law in Separation of Concerns
&lt;/h2&gt;

&lt;p&gt;When multiple aspects or functionalities are mixed or are in one file in your code something will eventually break.&lt;/p&gt;

&lt;p&gt;By separating concerns for example  by separating the express application and the web server the chances that everything will break Is reduced. &lt;/p&gt;

&lt;p&gt;if there's an issue in your express app it won't affect the logic of your application. The more you compartmentalized the behavior or responsibility of your application the chances of a one failure affecting your entire application becomes slimmer.&lt;/p&gt;

&lt;h2&gt;
  
  
  example where no SoC was applied:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Application logic (handling routes)&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Server logic (listening on a port)&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Server is running on port 3000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Here's how murphy's law works&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if the server failure happens (port is already in use), you won't be able to test your routes and the entire app tops working. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example where SoC was applied
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//app.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Application logic (handling routes)&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&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 javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//server.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;// Server logic (listening on a port)&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Server is running on port 3000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;if the server fails to start the application will still be able to work since your application logic is safe.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can still test your application logic without directly running the server by using testing frameworks like &lt;code&gt;jest&lt;/code&gt; and &lt;code&gt;supertest&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;supertest&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;          

&lt;span class="c1"&gt;// Test case for GET /hello&lt;/span&gt;
&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET /hello should return "Hello, World!"&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  
  &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;        &lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Master SQL Querying: A Comprehensive Guide.</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Thu, 25 Jul 2024 19:39:41 +0000</pubDate>
      <link>https://dev.to/fullstackdev/a-comprehensive-guide-to-master-sql-querying-12ai</link>
      <guid>https://dev.to/fullstackdev/a-comprehensive-guide-to-master-sql-querying-12ai</guid>
      <description>&lt;p&gt;At first glance, SQL might seem simple and not hard at all, that is true until you find yourself in front of complex database structures or having to write complex queries. It does get confusing or difficult sometimes (Yes even experienced people can find themselves scratching their heads). &lt;/p&gt;

&lt;p&gt;In this guide we're gonna lay out all the concepts so you can pick up SQL in no time.&lt;/p&gt;

&lt;h2&gt;
  
  
  SELECT basics
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;SELECT&lt;/code&gt; statement retrieves data from a table found in your database. Each table has rows and columns. You can select specific columns from a table. &lt;/p&gt;

&lt;p&gt;Here is the Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nv"&gt;"column_name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;"column_name"&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"table_name"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep in mind that you can select one or multiple columns.&lt;/p&gt;

&lt;p&gt;Here is an example of our table named &lt;code&gt;general_info&lt;/code&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Country&lt;/th&gt;
&lt;th&gt;Capital&lt;/th&gt;
&lt;th&gt;Year_of_Independence&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;United States&lt;/td&gt;
&lt;td&gt;Washington, D.C.&lt;/td&gt;
&lt;td&gt;1776&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;France&lt;/td&gt;
&lt;td&gt;Paris&lt;/td&gt;
&lt;td&gt;1789&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;India&lt;/td&gt;
&lt;td&gt;New Delhi&lt;/td&gt;
&lt;td&gt;1947&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brazil&lt;/td&gt;
&lt;td&gt;Brasilia&lt;/td&gt;
&lt;td&gt;1822&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;China&lt;/td&gt;
&lt;td&gt;Beijing&lt;/td&gt;
&lt;td&gt;1949&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Australia&lt;/td&gt;
&lt;td&gt;Canberra&lt;/td&gt;
&lt;td&gt;1901&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Our &lt;code&gt;SELECT&lt;/code&gt; statement will need the column names and the table name from which we want to retrieve data can select one or multiple columns.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nv"&gt;"Country"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;"Year_of_Independence"&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"general_info"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query will return all the names of the countries and their year of independence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Select with WHERE clause
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;WHERE&lt;/code&gt; clause is a condition that must be met in order for a row to be present in the result set of the query. In other words it helps filter the result and only returns the rows that match the condition you specified.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Country&lt;/th&gt;
&lt;th&gt;Capital&lt;/th&gt;
&lt;th&gt;Year_of_Independence&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;United States&lt;/td&gt;
&lt;td&gt;Washington, D.C.&lt;/td&gt;
&lt;td&gt;1776&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;France&lt;/td&gt;
&lt;td&gt;Paris&lt;/td&gt;
&lt;td&gt;1789&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;India&lt;/td&gt;
&lt;td&gt;New Delhi&lt;/td&gt;
&lt;td&gt;1947&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brazil&lt;/td&gt;
&lt;td&gt;Brasilia&lt;/td&gt;
&lt;td&gt;1822&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;China&lt;/td&gt;
&lt;td&gt;Beijing&lt;/td&gt;
&lt;td&gt;1949&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Australia&lt;/td&gt;
&lt;td&gt;Canberra&lt;/td&gt;
&lt;td&gt;1901&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We're going to use the same Table &lt;code&gt;general_info&lt;/code&gt; to look at an example.&lt;/p&gt;

&lt;p&gt;Imagine we want to return the capital of a country that got its independence in 1901.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nv"&gt;"Capital"&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"general_info"&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nv"&gt;"year_of_independence"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1901&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;Functions are built-in blocks of code, each of these functions execute a specific task. &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function Name&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SUM&lt;/td&gt;
&lt;td&gt;Calculates the sum of a set of values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AVG&lt;/td&gt;
&lt;td&gt;Calculates the average of a set of values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MIN&lt;/td&gt;
&lt;td&gt;Returns the smallest value in a set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MAX&lt;/td&gt;
&lt;td&gt;Returns the largest value in a set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COUNT&lt;/td&gt;
&lt;td&gt;Counts the number of rows or non-null values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ROUND&lt;/td&gt;
&lt;td&gt;Rounds a number to a specified decimal place&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TRUNCATE&lt;/td&gt;
&lt;td&gt;Truncates a number to a specified decimal place&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CONCAT&lt;/td&gt;
&lt;td&gt;Combines two or more strings into a single string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LENGTH&lt;/td&gt;
&lt;td&gt;Returns the length of a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UPPER&lt;/td&gt;
&lt;td&gt;Converts a string to uppercase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOWER&lt;/td&gt;
&lt;td&gt;Converts a string to lowercase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUBSTRING&lt;/td&gt;
&lt;td&gt;Extracts a substring from a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TRIM&lt;/td&gt;
&lt;td&gt;Removes leading and trailing spaces from a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LTRIM&lt;/td&gt;
&lt;td&gt;Removes leading spaces from a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RTRIM&lt;/td&gt;
&lt;td&gt;Removes trailing spaces from a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LIKE&lt;/td&gt;
&lt;td&gt;Used for pattern matching in strings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;YEAR&lt;/td&gt;
&lt;td&gt;Extracts the year from a date&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MONTH&lt;/td&gt;
&lt;td&gt;Extracts the month from a date&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DAY&lt;/td&gt;
&lt;td&gt;Extracts the day from a date&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HOUR&lt;/td&gt;
&lt;td&gt;Extracts the hour from a time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MINUTE&lt;/td&gt;
&lt;td&gt;Extracts the minute from a time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SECOND&lt;/td&gt;
&lt;td&gt;Extracts the second from a time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CASE WHEN&lt;/td&gt;
&lt;td&gt;Performs conditional logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COALESCE&lt;/td&gt;
&lt;td&gt;Returns the first non-null value from a list of expressions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NULLIF&lt;/td&gt;
&lt;td&gt;Returns NULL if two expressions are equal, otherwise returns the first expression&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here are some examples: &lt;/p&gt;

&lt;h3&gt;
  
  
  SUM
&lt;/h3&gt;

&lt;p&gt;Let's calculate the total of prices In the &lt;code&gt;fruits&lt;/code&gt; table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;"Price"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s1"&gt;'total'&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"Fruits"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;AS&lt;/code&gt; allows us to rename the result column as total. &lt;/p&gt;

&lt;h3&gt;
  
  
  AVG
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;"Price"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s1"&gt;'Average_price'&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"Fruits"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we're getting the average price of all the fruits in the &lt;code&gt;Fruits&lt;/code&gt; Table.&lt;/p&gt;

&lt;h3&gt;
  
  
  UPPER
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;UPPER&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;"Fruit"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nv"&gt;"Fruit_name_upper"&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"Fruits"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query converts all the fruit names in the &lt;code&gt;Fruits&lt;/code&gt; Table to uppercase.&lt;/p&gt;

&lt;h3&gt;
  
  
  TURNCATE
&lt;/h3&gt;

&lt;p&gt;TRUNCATE in the context of numbers means to remove digits after a specified decimal place without rounding.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;TURNCATE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;"name_of_column"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s1"&gt;'New_Value'&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"table_name"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also use &lt;code&gt;TURNCATE&lt;/code&gt; to empty a table without messing with or deleting the table structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;TURNCATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="nv"&gt;"Fruits"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All the data will be removed from the table. It is an irreversible operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  SELECT with GROUP BY
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;GROUP BY&lt;/code&gt; clause groups rows that have the same value, it categorizes them based on a specific column of your choosing.&lt;/p&gt;

&lt;p&gt;Imagine a list of fruits and their prices.&lt;/p&gt;

&lt;p&gt;Table name: &lt;code&gt;Fruits&lt;/code&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Fruit&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Apple&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Banana&lt;/td&gt;
&lt;td&gt;0.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orange&lt;/td&gt;
&lt;td&gt;0.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grape&lt;/td&gt;
&lt;td&gt;0.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strawberry&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mango&lt;/td&gt;
&lt;td&gt;0.3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Using this example, we can group the fruits by price.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nv"&gt;"Price"&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"FRUITS"&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nv"&gt;"Price"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result would look like that:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;What essentially happened is that all the rows that had the same prices were put together into a single group. &lt;/p&gt;

&lt;h2&gt;
  
  
  SELECT with JOIN
&lt;/h2&gt;

&lt;p&gt;Sometimes you need to view the data of more than just one table to get the required data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1: Customers&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CustomerID&lt;/th&gt;
&lt;th&gt;CustomerName&lt;/th&gt;
&lt;th&gt;City&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;John Doe&lt;/td&gt;
&lt;td&gt;New York&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Jane Smith&lt;/td&gt;
&lt;td&gt;Los Angeles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Kate Johnson&lt;/td&gt;
&lt;td&gt;Chicago&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Ilene Brown&lt;/td&gt;
&lt;td&gt;Dallas&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;David Michaels&lt;/td&gt;
&lt;td&gt;Houston&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Olivia Davids&lt;/td&gt;
&lt;td&gt;Miami&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Table 2: Orders&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;OrderID&lt;/th&gt;
&lt;th&gt;CustomerID&lt;/th&gt;
&lt;th&gt;OrderDate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2023-11-08&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2023-12-23&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;103&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2023-11-25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;104&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2023-12-18&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;105&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2023-11-22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;106&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2023-12-15&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In this example, the &lt;code&gt;Customers&lt;/code&gt; table is related to a row of the &lt;code&gt;Orders&lt;/code&gt; table. If we want to find out Who placed the order and When the order was placed, we need to join the &lt;code&gt;Customers&lt;/code&gt; table to the &lt;code&gt;Orders&lt;/code&gt; table on the common field that is the &lt;code&gt;CustomerID&lt;/code&gt; in both tables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderDate&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would be the result of this query:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CustomerName&lt;/th&gt;
&lt;th&gt;OrderDate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;John Doe&lt;/td&gt;
&lt;td&gt;2023-11-08&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;John Doe&lt;/td&gt;
&lt;td&gt;2023-12-18&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jane Smith&lt;/td&gt;
&lt;td&gt;2023-12-23&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jane Smith&lt;/td&gt;
&lt;td&gt;2023-12-15&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kate Johnson&lt;/td&gt;
&lt;td&gt;2023-11-25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ilene Brown&lt;/td&gt;
&lt;td&gt;2023-11-22&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  LEFT JOIN
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;LEFT JOIN&lt;/code&gt; returns all the rows from the left table even if there are no matches in the right one. &lt;br&gt;
This means that the returned result will have all the data from the left table; if there's a match in the right table then the relevant columns are filled and if there is no match found in the right table the columns from the right table will have null values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderID&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will help us know which customer did not place an order. &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CustomerName&lt;/th&gt;
&lt;th&gt;OrderID&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;John Doe&lt;/td&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;John Doe&lt;/td&gt;
&lt;td&gt;104&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jane Smith&lt;/td&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jane Smith&lt;/td&gt;
&lt;td&gt;106&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kate Johnson&lt;/td&gt;
&lt;td&gt;103&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ilene Brown&lt;/td&gt;
&lt;td&gt;105&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;David Michaels&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Olivia Davids&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  RIGHT JOIN
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;RIGHT JOIN&lt;/code&gt; is essentially the opposite of a &lt;code&gt;LEFT JOIN&lt;/code&gt;. It returns all rows from the right table even if there are no matches in the left table.&lt;br&gt;
This means that the returned result will have all the data from the right table; if there's a match in the left table then the relevant columns are filled and if there is no match found in the left table the columns from the left table will have null values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderID&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;RIGHT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query will return all orders, including those without corresponding customers. If an order doesn't have a corresponding customer, the CustomerName column will be NULL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Subqueries
&lt;/h2&gt;

&lt;p&gt;Subqueries queries are queries nested inside another query.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subquerying with JOIN
&lt;/h3&gt;

&lt;p&gt;Let's look at one using the &lt;code&gt;JOIN&lt;/code&gt; statement and our &lt;code&gt;Customers&lt;/code&gt; and &lt;code&gt;Orders&lt;/code&gt; tables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;TotalOrders&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;TotalOrders&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;OrderCounts&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break our query down by starting from the inner query to the outer one:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;SELECT Orders.CustomerID,COUNT(Orders.CustomerID) AS TotalOrders FROM Orders&lt;/code&gt;: We are calculating the total number of orders made by each customer in the &lt;code&gt;Orders&lt;/code&gt; by using a built-in function named &lt;code&gt;COUNT&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;As TotalOrders&lt;/code&gt;, is used to rename the column we got as a result.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GROUP BY CustomerID&lt;/code&gt;, this query groups the result by &lt;code&gt;CustomerID&lt;/code&gt; this will allow us to know how many Orders each Person Placed.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;AS OrderCounts&lt;/code&gt; Gives an Alias to the subquery allowing us to treat it like a normal table temporarily.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;SELECT CustomerName, TotalOrders FROM Customers&lt;/code&gt; We are selecting the &lt;code&gt;CustomerName&lt;/code&gt; From the &lt;code&gt;Customers&lt;/code&gt; table and the &lt;code&gt;TotalOrder&lt;/code&gt; From the temporary table we just created that has the column &lt;code&gt;TotalOrders&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lastly &lt;code&gt;ON Customers.CustomerID = Orders.CustomerID&lt;/code&gt; Joins both tables by using their common field which is &lt;code&gt;CustomerID&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Our result would be:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CustomerName&lt;/th&gt;
&lt;th&gt;TotalOrders&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;John Doe&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jane Smith&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kate Johnson&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ilene Brown&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;David Michaels&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Olivia Davids&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Subquerying with IN
&lt;/h3&gt;

&lt;p&gt;Let's find customers who placed orders after the date &lt;code&gt;2023-11-08&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerName&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;OrderDate&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2023-11-08'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SELECT CustomerID FROM Orders WHERE OrderDate &amp;gt; '2023-11-08': This part retrieves the &lt;code&gt;CustomerID&lt;/code&gt; from the &lt;code&gt;Orders&lt;/code&gt; table where the &lt;code&gt;OrderDate&lt;/code&gt; is after November 08, 2023.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;SELECT CustomerName FROM Customers WHERE CustomerID IN (...)&lt;/code&gt;: This part selects the &lt;code&gt;CustomerName&lt;/code&gt; from the &lt;code&gt;Customers&lt;/code&gt; table where &lt;code&gt;CustomerID&lt;/code&gt; is found in the result of the subquery.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Deeper Dive
&lt;/h2&gt;

&lt;p&gt;After Presenting the basic concepts of how each provided statement above works let's see more statements at the works.&lt;/p&gt;

&lt;p&gt;Here are The same tables with a little modification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Customers Table&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CustomerID&lt;/th&gt;
&lt;th&gt;CustomerName&lt;/th&gt;
&lt;th&gt;City&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;John Doe&lt;/td&gt;
&lt;td&gt;New York&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Jane Smith&lt;/td&gt;
&lt;td&gt;Los Angeles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Kate Johnson&lt;/td&gt;
&lt;td&gt;Chicago&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Ilene Brown&lt;/td&gt;
&lt;td&gt;Dallas&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;David Michaels&lt;/td&gt;
&lt;td&gt;Houston&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Olivia Davids&lt;/td&gt;
&lt;td&gt;Houston&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Orders Table&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;OrderID&lt;/th&gt;
&lt;th&gt;CustomerID&lt;/th&gt;
&lt;th&gt;OrderDate&lt;/th&gt;
&lt;th&gt;OrderAmount&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2023-11-08&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2023-12-23&lt;/td&gt;
&lt;td&gt;150&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;103&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2023-11-25&lt;/td&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;104&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2023-12-18&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;105&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2023-11-22&lt;/td&gt;
&lt;td&gt;120&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;106&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2023-12-15&lt;/td&gt;
&lt;td&gt;90&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Basic SELECT Queries
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Get all Customers' data:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The asterisk &lt;code&gt;*&lt;/code&gt; means all data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get specific Columns:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;City&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Filtering Data
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Get orders placed after a specific date:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;OrderDate&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2023-11-08'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Find Customers in a Specific City:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;City&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Los Angeles'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Find Orders With an order amount greater than 100:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;OrderAmount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sorting Data (ORDER BY)
&lt;/h3&gt;

&lt;p&gt;When sorting Data with &lt;code&gt;ORDER BY&lt;/code&gt; We have the &lt;code&gt;DESC&lt;/code&gt; and &lt;code&gt;ASC&lt;/code&gt; Keywords. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ASC&lt;/code&gt; Sorts the data from &lt;code&gt;A&lt;/code&gt; to &lt;code&gt;Z&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DESC&lt;/code&gt; Sorts the data from &lt;code&gt;Z&lt;/code&gt; to &lt;code&gt;A&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;ASC&lt;/code&gt; is the default sort order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sorting Customers by name in descending order:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt; 
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;CustomerName&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Aggregating Data (GROUP BY, HAVING,other functions)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Group By
&lt;/h4&gt;

&lt;p&gt;We've already come across &lt;code&gt;GROUP BY&lt;/code&gt;. It will categorize data and group them based on a specific column such as an &lt;code&gt;ID&lt;/code&gt; for example.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find the total order amount for each customer:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderAmount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;TotalOrderAmount&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  HAVING
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;HAVING&lt;/code&gt; is similar to the &lt;code&gt;WHERE&lt;/code&gt; clause but it uses the results of &lt;code&gt;GROUP BY&lt;/code&gt; rather than individual rows. This means that &lt;code&gt;HAVING&lt;/code&gt; Filters the groups made by &lt;code&gt;GROUP BY&lt;/code&gt; and checks if the condition provided is applied.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find Customers with a total order amount greater than 200:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderAmount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;TotalOrderAmount&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt;
&lt;span class="k"&gt;HAVING&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderAmount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  INNER JOIN
&lt;/h3&gt;

&lt;p&gt;We've previously seen &lt;code&gt;LEFT JOIN&lt;/code&gt;s and &lt;code&gt;RIGHT JOIN&lt;/code&gt;s, and how they return null values if the right or left row is missing a value.&lt;/p&gt;

&lt;p&gt;What if we want to return the rows that only have matching values in both tables and avoid the &lt;code&gt;null&lt;/code&gt; values?&lt;/p&gt;

&lt;p&gt;This is Where &lt;code&gt;INNER JOIN&lt;/code&gt; comes into play.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderDate&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  COALESCE FUNCTION
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;COALESCE&lt;/em&gt; function to replace null values with a specific one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;COALESCE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderDate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'No Orders'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;OrderDate&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Correlated Subqueries
&lt;/h4&gt;

&lt;p&gt;A correlated subquery is when a subquery references a column from the outer query for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerName&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;OrderDate&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2023-11-30'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  WITH
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;with&lt;/code&gt; clause also known as a common table expression, makes it possible to temporarily define result sets that can be referenced within a &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, or &lt;code&gt;DELETE&lt;/code&gt; statement. &lt;/p&gt;

&lt;p&gt;This means that it allows you to break down complex queries into smaller ones and make them more manageable.&lt;/p&gt;

&lt;p&gt;Let's say we want to find customers who have placed orders after a specific date using common table expression.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;RecentOrders&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;OrderDate&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2023-11-30'&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerName&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;RecentOrders&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;WITH&lt;/code&gt; clause improves readability and performance and it only exists for the duration of the query.&lt;/p&gt;

&lt;h3&gt;
  
  
  Complex Grouping
&lt;/h3&gt;

&lt;p&gt;Let's say we want to calculate the total sales for each month and year in the &lt;code&gt;Orders&lt;/code&gt; Table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="nb"&gt;YEAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderDate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;OrderYear&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;MONTH&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderDate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;OrderMonth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderAmount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;TotalSales&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;
    &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt;
    &lt;span class="nb"&gt;YEAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderDate&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="k"&gt;MONTH&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderDate&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We will select three columns &lt;code&gt;year&lt;/code&gt; of the order, the &lt;code&gt;month&lt;/code&gt; of the order, and the total sales amount for that month and year. Then we will need to group by the year and month.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In &lt;strong&gt;conclusion&lt;/strong&gt;, understanding the fundamentals and basic querying at the start of your journey to learn SQL is the building block of Mastering it. Understanding the concepts laid out in this article will give you a significant step forward and will help you become proficient in database management. The &lt;strong&gt;KEY&lt;/strong&gt; is to &lt;strong&gt;PRACTICE&lt;/strong&gt; and &lt;strong&gt;CONSISTENT APPLICATION&lt;/strong&gt;. &lt;/p&gt;

</description>
      <category>sql</category>
      <category>programming</category>
      <category>database</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>How to optimize your MERN workflow with a solid architecture</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Fri, 12 Jul 2024 20:06:41 +0000</pubDate>
      <link>https://dev.to/fullstackdev/optimize-your-mern-workflow-with-a-solid-architecture-37p4</link>
      <guid>https://dev.to/fullstackdev/optimize-your-mern-workflow-with-a-solid-architecture-37p4</guid>
      <description>&lt;p&gt;We've probably encountered a MERN stack project on the internet that was perhaps the messiest thing we've seen. Where everything was crammed into one single file. Where the front-end and back-end logic were squeezed together, files and variables have random names, making the codebase hard to explore and no error handling whatsoever. &lt;/p&gt;

&lt;p&gt;This is why a strong foundation has to be created before developing a MERN stack application or &lt;strong&gt;any other type of application for that matter&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A disorganized project structure can easily turn an app into a mess. With a proper template, you can develop an application that is functional, scalable, manageable, and easy to work with. &lt;/p&gt;

&lt;p&gt;Following standard practices can considerably improve the developer experience and code quality. Let's dive right in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Principles of project structure
&lt;/h2&gt;

&lt;p&gt;Before we go into these principles, here are some best practices you should follow to improve code readability and make your project easier to maintain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Best practices
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Data management is the proper handling of data flow and status.&lt;/li&gt;
&lt;li&gt;Use Linting and formatting tools to enforce code standards.&lt;/li&gt;
&lt;li&gt;Use version control like Git and Bitbucket to manage your code.&lt;/li&gt;
&lt;li&gt;implement unit tests to be able to find issues early on prevent unpredictable behavior from your code and ensure code stability&lt;/li&gt;
&lt;li&gt;Error management requires putting in place robust error-handling procedures.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Separation of concerns
&lt;/h3&gt;

&lt;p&gt;Separation of concerns or SoC, is an essential concept in programming that recommends breaking down a huge system into smaller, more manageable components, each with a role. Such as separating the Front-end from the Back-end. &lt;/p&gt;

&lt;h3&gt;
  
  
  Organization
&lt;/h3&gt;

&lt;p&gt;Creating a directory structure with consistent naming convention. Component-based architecture requires breaking down the user interface into reusable components. Routing includes setting up effective navigation within the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project architecture
&lt;/h2&gt;

&lt;p&gt;This is how our project architecture should look.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project-name/
├── client/
│   ├── public/
│   │   ├── index.html
│   │   └── assets/
│   ├── src/
|   │   ├── services/
│   │   ├── components/
│   │   ├── pages/
│   │   └── App.js
│   └── index.js
├── server/
│   ├── controllers/
│   ├── models/
│   ├── routes/
│   ├── middleware/
│   └── index.js
├── package.json
├── .env
└── README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;br&gt;
Let's talk about each folder and file in our structure and their role.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Root&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;package.json&lt;/strong&gt;: Contains information about the project, its dependencies, and scripts for running the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.env&lt;/strong&gt;: contains environment variables like API keys and other information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;README.md&lt;/strong&gt;: is the project documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Directory (frontend)&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  public
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;index.html&lt;/strong&gt;: The main HTML file for the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;assets&lt;/strong&gt;: Folder that can contain images, fonts, and other static resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  src
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;services&lt;/strong&gt;: For making HTTP requests to the backend using Axios or Fetch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;components&lt;/strong&gt;: Reusable components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pages&lt;/strong&gt;: Main views or screens of the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App.js&lt;/strong&gt;: The main entry point for the React application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;index.js&lt;/strong&gt;: The entry point for the client-side build process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Server Directory (backend)&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  controllers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Contains logic for handling incoming HTTP requests and responding to them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  models
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Defines the data structures (schemas) for the database.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  routes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Defines the API endpoints and maps them to controller functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  middleware
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Contains functions that process requests before they reach the controllers ( like error handling).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;index.js&lt;/strong&gt;: The entry point for the Node.js server, typically responsible for setting up the Express app, database connections, and route handlers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This architecture is &lt;strong&gt;MVC&lt;/strong&gt; (Model-View-Controller) on the backend and &lt;strong&gt;component-based&lt;/strong&gt; architecture on the frontend. &lt;/p&gt;

&lt;p&gt;The MVC architecture has a clear division, the three components are interconnected and each is responsible for a different aspect of the application making it easier to maintain.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>architecture</category>
    </item>
    <item>
      <title>How machines Learn: A look into machine learning.</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Wed, 08 May 2024 20:44:38 +0000</pubDate>
      <link>https://dev.to/fullstackdev/how-machines-learn-a-look-into-machine-learning-47gj</link>
      <guid>https://dev.to/fullstackdev/how-machines-learn-a-look-into-machine-learning-47gj</guid>
      <description>&lt;p&gt;We've all witnessed how powerful machine learning is by using applications like ChatGPT, Gemini, Midjourney, and LeonardoAI. Now you might or may not be familiar with how they work, but essentially algorithms are the secret sauce behind machine learning applications.&lt;/p&gt;

&lt;p&gt;A computer can only perform certain tasks in a certain order when it is given a set of precise instructions, this is what is known as algorithms. Think of algorithms as a chocolate cake recipe, which is a step-by-step plan you follow that should give you the same outcome every time. You can add certain ingredients to a recipe to make it better which is similar to feeding the algorithm more data to make it give you a better outcome. &lt;/p&gt;

&lt;p&gt;Now when it comes to machine learning there are three terms that you will constantly come across When you're starting out in this field:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supervised learning&lt;/li&gt;
&lt;li&gt;Unsupervised learning&lt;/li&gt;
&lt;li&gt;Reinforcement learning
These are the most common methods that machines learn.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  1. Supervised Learning
&lt;/h1&gt;

&lt;p&gt;A known link between input and output is used in supervised learning. Labeled data is valuable in this situation because it helps the algorithm learn from the "correct answers" in the training set and use those lessons for predicting future input data.&lt;/p&gt;

&lt;p&gt;The two key goals of supervised learning are &lt;strong&gt;Regression&lt;/strong&gt; and &lt;strong&gt;Classification&lt;/strong&gt;.&lt;br&gt;
There are two main goals for regression analysis.&lt;br&gt;
Regression is used to understand the type of relationship between the variables, and to estimate the value of the dependent variable based on the independent variables, and evaluating the relevance and strength of this relationship.&lt;/p&gt;

&lt;p&gt;In classification, the goal is to sort findings based on their characteristics into predefined groups or categories.&lt;/p&gt;

&lt;p&gt;Here's a simple example of how a supervised algorithm works. &lt;br&gt;
Let's imagine we have a set of images where each depicts either a banana or an apple. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a set of data marked as "correct" data, consisting of images of apples and bananas together with the matching class names.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Give the model the labeled training dataset. Between the input which is the picture and the output which is the class, the machine learning algorithm starts to "see" patterns. The algorithm may pick up connections, such as the color or the shape of the fruits.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Measure how well the model predicts the class by running it over some unknown data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  2. Unsupervised Learning
&lt;/h1&gt;

&lt;p&gt;The main distinction between supervised and unsupervised learning is the "correct" data we provided. Unsupervised learning algorithms just need input data. This learning method works well for cases when we don't know exactly what the solutions should look like. Its goal is for the algorithm to learn from the data.&lt;/p&gt;

&lt;p&gt;Let's keep it simple and stay with the fruit example. &lt;br&gt;
Imagine you're sorting a basket of fruits. There are no labels on the items identifying an orange or an apple. Unsupervised learning is like sorting these fruits based on their similarities, like color, shape, or size.&lt;br&gt;
Filtering or sorting these fruits based on similarities in size, color, or form is similar to unsupervised learning. In machine learning, your data points are the fruits, and the characteristics you use to group them are the sorting criteria.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Reinforcement learning
&lt;/h1&gt;

&lt;p&gt;In reinforcement learning, there is an agent which is the learner that learns through trial and error in an environment. This agent uses the algorithm to make decisions. &lt;/p&gt;

&lt;p&gt;Here's an example: &lt;br&gt;
Picture a toddler starting to walk. The kid gets a positive reward such as a hug a kiss or even verbal appreciation for taking steps and negative reinforcement such as a fall when taking a wrong step for errors, but no instructions are given. The kid gradually picks up the best techniques to reach the goal of walking.&lt;/p&gt;

&lt;p&gt;The goals of reinforcement learning are different from those of unsupervised learning. In comparison with unsupervised learning, which aims to identify clusters in the data, reinforcement learning looks for a suitable action model that increases the agent's total reward.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What i actually do to stay productive</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Tue, 07 May 2024 17:51:13 +0000</pubDate>
      <link>https://dev.to/fullstackdev/what-i-actually-do-to-stay-productive-34np</link>
      <guid>https://dev.to/fullstackdev/what-i-actually-do-to-stay-productive-34np</guid>
      <description>&lt;p&gt;It's no secret that sometimes work can be overwhelming. It's no secret either that sometimes you'd have so much work you don't even know where to start. It is like that for everyone, some people can manage just fine, and other times you just have to put in a little or A &lt;strong&gt;LOT MORE&lt;/strong&gt; extra effort to get things done.&lt;/p&gt;

&lt;p&gt;It took me some time to figure out what works for me, even the things and techniques I saw online looked stupid to me, and even though they wouldn't work until I tried them. I am now going to share what worked for me and to be completely honest what worked for me might now work for you, but that is &lt;strong&gt;OKAY&lt;/strong&gt; don't be discouraged. It's a trial and error kind of thing, you keep trying things until you find and stick to what works for you.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Learn the ins and outs of your environment
&lt;/h1&gt;

&lt;p&gt;Learn how your IDE/code editor works. Learn the &lt;strong&gt;hot keys&lt;/strong&gt; and the navigation &lt;strong&gt;shortcuts&lt;/strong&gt;. You might be asking "What's the big deal?". Trust me it is a big deal, using fewer mouse movements and more shortcuts will move a lot faster and lessen the chances of making errors, and will also reduce the strain on your wrist. &lt;/p&gt;

&lt;h1&gt;
  
  
  2. Make a list
&lt;/h1&gt;

&lt;p&gt;"Make a list" as in &lt;strong&gt;not&lt;/strong&gt; in actually making a list. Take a task and break it into smaller chunks. Take a chunk and estimate how much time it would take you.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prioritize Your tasks and break them down&lt;/li&gt;
&lt;li&gt;Do the chunk that takes less time&lt;/li&gt;
&lt;li&gt;If a chunk is taking more time than expected then &lt;strong&gt;It can be broken into smaller chunks&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Write off the finished chunks on the list.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  3. Time management
&lt;/h1&gt;

&lt;p&gt;When I first heard of this technique, I laughed at it and was very doubtful it would work. The &lt;strong&gt;Pomodoro Technique&lt;/strong&gt; turned out to be very useful to me. We all know how it works, but in case you don't know it here's how it works.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set a timer for 25 minutes&lt;/li&gt;
&lt;li&gt;Work for 25 minutes without any interruptions&lt;/li&gt;
&lt;li&gt;After 25 minutes take a small break preferably between 3 to 5 minutes&lt;/li&gt;
&lt;li&gt;After 4 pomodoros, meaning after 2 hours of work take a longer break which would be between 20 to 35 minutes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are a doom-scroller aka someone who likes to spend time on social media and get stuck scrolling you can use your longer breaks to scroll through social media😂&lt;/p&gt;

&lt;p&gt;** Do not use the small breaks to scroll through social media it will interrupt your productivity. Instead, get up and move around. Walk around and drink water! It is important to stay hydrated to keep your mind sharp. More importantly, give your eyes a break from the screen during your short breaks.**&lt;/p&gt;

&lt;h1&gt;
  
  
  4. Notifications
&lt;/h1&gt;

&lt;p&gt;Put your phone on Do not disturb while working or silence all the apps in your settings so that you do not receive notifications. Unless It is urgent calls or urgent texts do not interrupt your workflow, it will really be hard to regain focus after that. You can also leave your phone in another room (That doesn't mean you can open social media in the browser😂)&lt;/p&gt;

&lt;h1&gt;
  
  
  5. Stay Physically active
&lt;/h1&gt;

&lt;p&gt;Try to find some time to work out during the day or at night. Working out doesn't just keep your body in shape but also keeps your brain sharp. Staying physically active will improve your memory and keep you creative. It is also a way to relieve your stress and keep your mental health in check.&lt;/p&gt;

&lt;h1&gt;
  
  
  6. Listen to your body
&lt;/h1&gt;

&lt;p&gt;When you feel like you are tired and need a break, take a break. Do not push beyond what you can handle. It is a bad idea that will lead to burnout. Burnout is very real and it can be difficult to recover from if you do not listen to your body. So &lt;strong&gt;When you feel like you need a break, take a break&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;At the end of the day, You have to learn how to prioritize your tasks and how to make your life easier. Work smarter not harder right? Experiment with all the techniques you can find you might find some that work for you if my advice isn't fit for you. &lt;br&gt;
You can also try all the tools out there on the internet but Focus and dedication come from within you and not from outside and certainly not from an app. &lt;/p&gt;

&lt;p&gt;I hope you found this useful! Thank you for reading! Would love to hear your opinions.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>watercooler</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Everyone's Learning Python: 7 Reasons to Catch Up</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Mon, 06 May 2024 17:36:03 +0000</pubDate>
      <link>https://dev.to/fullstackdev/everyones-learning-python-7-reasons-to-catch-up-79e</link>
      <guid>https://dev.to/fullstackdev/everyones-learning-python-7-reasons-to-catch-up-79e</guid>
      <description>&lt;p&gt;As one of the most popular programming languages, Python is one of the best to learn especially for beginners. Python delivers a special mix of power and accessibility, making it suitable for broadening your skill set. Here are 7 reasons why you should dive in and explore Python.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Simple enough for beginners
&lt;/h1&gt;

&lt;p&gt;Python has an easy-to-read syntax and reads practically like plain English, in contrast to some languages that seem complex to read even if you're new or somewhat experienced in programming. The simplicity of the syntax allows you to concentrate more on the concept and idea you're trying to achieve rather than get stuck on the syntax.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Flexibility
&lt;/h1&gt;

&lt;p&gt;One of the main benefits of Python is its wide range of applications. Python can be used for multiple purposes such as data research, machine learning, web development, and automation. Because of its flexibility, it's a great tool for looking to improve skills.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Data Science
&lt;/h1&gt;

&lt;p&gt;Python is one of the leading data science languages in data science. Python allows you to easily analyze, and manipulate data using the strong and large range of libraries it has, such as NumPy, Pandas, and Matplotlib.&lt;/p&gt;

&lt;h1&gt;
  
  
  4. Artificial intelligence and Machine Learning
&lt;/h1&gt;

&lt;p&gt;Python is an essential language for machine learning and artificial intelligence, making it both AI and ML-ready. Because frameworks like TensorFlow and PyTorch use Python's capabilities so makes it the most suitable language for developing intelligent applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  5. Large collections of Libraries and Frameworks
&lt;/h1&gt;

&lt;p&gt;The Python ecosystem includes many frameworks and libraries that make development easier. Almost every coding work can be made easier with a Python library, from web development with Django to web scraping with Beautiful Soup.&lt;/p&gt;

&lt;h1&gt;
  
  
  6. Awesome community
&lt;/h1&gt;

&lt;p&gt;When it comes to programming communities, the Python community is among the friendliest and most supportive. When working with Python, you won't be far from support and direction thanks to the abundance of online forums, tutorials, and communities.&lt;/p&gt;

&lt;h1&gt;
  
  
  7. Career
&lt;/h1&gt;

&lt;p&gt;Python has great job opportunities because of the growing demand for programmers in many of fields. Here's how having Python skills could get you good chances and high pay:&lt;/p&gt;

&lt;p&gt;Python is a popular choice for skills in modern areas like AI and data science as we previously mentioned, and it's used by startups as well as major IT giants.&lt;/p&gt;

&lt;p&gt;Since Python is very popular across the world, developing skills with Python could bring forward remote work or if you're looking to leave your country it can bring the possibility of relocation.&lt;/p&gt;

&lt;p&gt;In conclusion, Python is a great investment for anybody looking to expand their skillset or get into IT given it has great flexibility, the demand keeps increasing, and it has job opportunities that pay well. Begin your Python dive today to open the door to the future you imagine.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Linux Ninja: Master Text Manipulation from Beginner to Badass in the CLI</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Fri, 03 May 2024 21:28:29 +0000</pubDate>
      <link>https://dev.to/fullstackdev/text-ninja-master-text-manipulation-from-beginner-to-badass-5do3</link>
      <guid>https://dev.to/fullstackdev/text-ninja-master-text-manipulation-from-beginner-to-badass-5do3</guid>
      <description>&lt;h2&gt;
  
  
  Standard out
&lt;/h2&gt;

&lt;p&gt;From your command line you are able to create a new file and insert text into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo &lt;/span&gt;Hello from the &lt;span class="nb"&gt;command &lt;/span&gt;line &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; test.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you try this command in your terminal, you'll notice a new file named &lt;code&gt;test.txt&lt;/code&gt; was created and if you open this file, you'll see the text &lt;code&gt;Hello from the command line&lt;/code&gt; inside of it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;echo&lt;/code&gt; prints the text &lt;code&gt;Hello from the command line&lt;/code&gt; to the screen.&lt;br&gt;
By default the &lt;code&gt;echo&lt;/code&gt; takes the input (standard input or stdin) from the keyboard and returns the output (standard output or stdout) to the screen.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;gt;&lt;/code&gt; is a redirection operator that allows us to send the standard output to go into a file.&lt;/p&gt;

&lt;p&gt;if you want to add more text to the file &lt;code&gt;test.txt&lt;/code&gt; you can use the &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; to append text to it instead of overwriting the file.&lt;/p&gt;
&lt;h2&gt;
  
  
  Standard input
&lt;/h2&gt;

&lt;p&gt;Just like the standard output redirection operator &lt;code&gt;&amp;gt;&lt;/code&gt; we can also use the is operator as well &lt;code&gt;&amp;lt;&lt;/code&gt; and what is it called? yes you guessed it! Standard input redirection operator!&lt;/p&gt;

&lt;p&gt;Let's look at an example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &amp;lt; test.txt &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; readme.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you don't know what the &lt;code&gt;cat&lt;/code&gt; command does Check out my article &lt;a href="https://dev.to/fullstackdev/master-the-linux-command-line-1aj"&gt;17 commands to master the Linux Command Line&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we redirected &lt;code&gt;test.txt&lt;/code&gt; file to be our standard input and the output of this file &lt;code&gt;Hello from the command line&lt;/code&gt; will be redirecte to the &lt;code&gt;readme.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;so if we tried to read the &lt;code&gt;readme.txt&lt;/code&gt; file it will have &lt;code&gt;Hello from the command line&lt;/code&gt; as output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;readme.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Standard Error
&lt;/h2&gt;

&lt;p&gt;So far we've seen 2 different streams standard input (stdin) that receives data as input &lt;code&gt;&amp;lt;&lt;/code&gt; and standard output which is what you see on the terminal and can be redirected to a file using &lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Standard Error or stderr is specifically for error messages produced by program on the terminal even if stdout is redirected. Here's an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /nonexistent_directory/ &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; test.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The error will be &lt;code&gt;No such file or directory&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can redirect an error message to the file by using file descriptors.&lt;br&gt;
What are file descriptors you may ask? Well a file descriptor is a positive number that is used to access a file. The file descriptors for stdin stdout and stderr is 0 1 and 2 respectively.&lt;/p&gt;

&lt;p&gt;To redirect the error message to a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /nonexistent_directory/ 2&amp;gt; test.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The error message should be inside &lt;code&gt;test.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We can also send the error message to the file and the result of &lt;code&gt;ls&lt;/code&gt; with it as well. (even if the directory doesn't exist there might be a minimal output which is not common). Common output will be an empty string or a new line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /nonexistent_directory/ &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; test.txt 2 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if we want to get rid of sderr messages you can use this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /nonexistent_directory/ 2 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Pipe and Tee
&lt;/h2&gt;

&lt;p&gt;The pipe operator is represented by &lt;code&gt;|&lt;/code&gt;, it acts as a connector by taking the output of a command and sending it as the input to another program.&lt;/p&gt;

&lt;p&gt;let's list the details about the &lt;code&gt;dev&lt;/code&gt; directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /dev/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can use the pipe and the 'less' command to navigate through the list using the up and down arrow keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /dev/ | less
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can send the output of of the command to a file. You can write of this command to two streams which will allow you to see the result of the command on the terminal and then in the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /dev/ | &lt;span class="nb"&gt;tee &lt;/span&gt;my_output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Environment
&lt;/h2&gt;

&lt;p&gt;An environment variable (PATH) exists on your system. When you write a command name this variable informs the computer where to look for the programs.&lt;br&gt;
If you download a program and place it in a directory where the variable PATH does not check and you try to use the tool it by typing its name in the terminal, what typically happens is thet the computer searches for it in the listed directory in PATH and since where you placed it is not checked by path you will get &lt;code&gt;command not found&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$USER&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The home directory path, your username and a list of path separated by colons that your system searches when it runs a command will be displayed on the terminal respectively.&lt;/p&gt;

&lt;h1&gt;
  
  
  cut
&lt;/h1&gt;

&lt;p&gt;The command &lt;code&gt;cut&lt;/code&gt; is used for extracting pieces of text from files. To grab the pieces of data the &lt;code&gt;cut&lt;/code&gt; command does it based on &lt;code&gt;fields&lt;/code&gt; which is a descrete pieve of data within a line such as a comma, tab, semicolon etc...&lt;br&gt;
We use the flag &lt;code&gt;-f&lt;/code&gt; which stands for fields to tell &lt;code&gt;cut&lt;/code&gt; what to extract. By default &lt;code&gt;cut&lt;/code&gt; uses the tab as delimiters to seperate fields.&lt;/p&gt;

&lt;p&gt;For example, we created a file named &lt;code&gt;text.txt&lt;/code&gt; with some data in it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'The bear jumped over the fence; The   snake followed it to the forest'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; text.txt

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 2 text.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command using cut will extract the word &lt;code&gt;snake&lt;/code&gt;. Let's break it down further.&lt;br&gt;
We told &lt;code&gt;cut&lt;/code&gt; to use the default delimiter which is tab by using -f and not specifying a delimiter and &lt;code&gt;2&lt;/code&gt; stands for the second column which is what comes after the &lt;code&gt;;&lt;/code&gt; semicolon. since the word snake is preceeded with tab then it will be extracted.&lt;/p&gt;

&lt;p&gt;Now let's specify a delimiter other than tab.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 1 &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;";"&lt;/span&gt; text.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we're telling cut to select the first column &lt;code&gt;1&lt;/code&gt; and assigned a new delimiter instead of tab which is the &lt;code&gt;;&lt;/code&gt; by using the &lt;code&gt;-d&lt;/code&gt; flag. The output will be &lt;code&gt;The bear jumped over the fence&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Paste
&lt;/h2&gt;

&lt;p&gt;The paste command appends lines in a file for example we have a file named &lt;code&gt;testing.txt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

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

 I am

 Learning

 How to use

 Linux commands
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say we want all the content of &lt;code&gt;testing.txt&lt;/code&gt; merged into one line&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;paste&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; testing.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we specified the the delimiter to be a space. There is a space from the second line down to the end in &lt;code&gt;testing.txt&lt;/code&gt;. &lt;code&gt;paste&lt;/code&gt; will make the &lt;code&gt;testing.txt&lt;/code&gt; a oneliner by bringing each sentence preceeded by a space to be appended to the first sentence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Head
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;head&lt;/code&gt; command will show you the first 10 lines in a file by default. You can also modify how many lines you want to see. For example you can choose to see 20 lines instead of 10 by using the &lt;code&gt;-n&lt;/code&gt; flag (number of lines).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;head &lt;/span&gt;path_of_file
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 20 path_of_file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Tail
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;tail&lt;/code&gt; command is the same as the &lt;code&gt;head&lt;/code&gt; command but it shows you the last 10 lines of a file instead of the first 10.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expand and unexpand
&lt;/h2&gt;

&lt;p&gt;Let's say you want to convert tabs in a file to spaces&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;expand &lt;/span&gt;name_of_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to convert the spaces back to tabs you can use this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;unexpand&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; name_of_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Joining and splitting files
&lt;/h2&gt;

&lt;p&gt;If you have two text files you want to combine you can use this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;join &lt;/span&gt;text_file_1.txxt text_file_2.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They will be joined by fields meaning the first line of both files will be on the first line, the second line of both files will be joined on the second line etc..&lt;/p&gt;

&lt;p&gt;This command will split a file into different files the default naming of the files will start with &lt;code&gt;x&lt;/code&gt; followed by alphabetical suffixes &lt;code&gt;aa, ab&lt;/code&gt; etc...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-a #&lt;/code&gt;: Sets the number of characters used in the suffix (default is 2).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;join&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="s1"&gt;','&lt;/span&gt; accounts.txt logged.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-t ','&lt;/code&gt;: defines the delimiter which is separating the fields&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The purpose of &lt;code&gt;join&lt;/code&gt; is to merge lines from multiple files based on a matching filed. For example both of your files could have numbered lines and will be merged based on that.&lt;/p&gt;

&lt;p&gt;You can split by size (bytes &lt;code&gt;-b&lt;/code&gt;) or by lines &lt;code&gt;-l&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;split&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; 1000 name_of_file.txt
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;split&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; 20 name_of_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Sort
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;sort&lt;/code&gt; command sorts lines in a file by alphabelitcal order&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sort &lt;/span&gt;file_name.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also sort in reverse alphabetical order&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; filename.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also numerically sort by using the &lt;code&gt;-n&lt;/code&gt; flag. If you've got a file with words in it, it will be sorted based on the &lt;code&gt;ASCII&lt;/code&gt; value of the first character in each word.&lt;/p&gt;

&lt;p&gt;Here's an example &lt;code&gt;fruits.txt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mango
Kiwi
Date
Pear
Banana
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;ASCII&lt;/code&gt; value for the first character of each fruit is 77, 75, 68, 80, 66 respectively.&lt;/p&gt;

&lt;p&gt;Now when we use it to numerically sort&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; fruits.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Banana
Date
Kiwi
Mango
Pear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command is also used to sort numbers inside a file. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;25
9
peach
5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;5
9
25
peach
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Translate
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;tr&lt;/code&gt; command is used to translate a set of characters into another.&lt;br&gt;
For example let's convert from lower to uppercase.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ tr a-z A-Z

hello

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Unique
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;uniq&lt;/code&gt; command allows you to remove duplicates within a file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;uniq &lt;/span&gt;file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the &lt;code&gt;-c&lt;/code&gt; flag you can get how many occurances each word has in the file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;uniq&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also find the unique value inside a file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;uniq&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also know what words are the duplicates inside a file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;uniq&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; text.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Word count
&lt;/h2&gt;

&lt;p&gt;You can know the total word count in a file by using the &lt;code&gt;wc&lt;/code&gt; coommand&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;wc &lt;/span&gt;file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This displays the lines, number of words and number of bytes respectively. You can select which one you want to see by using these flags&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-l&lt;/code&gt;: number of lines&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-w&lt;/code&gt;: number of words&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-c&lt;/code&gt;: number of bytes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;nl&lt;/code&gt; is another command you can use to check the number of lines in a file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;nl &lt;/span&gt;file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  grep
&lt;/h2&gt;

&lt;p&gt;It allows you to search files for characters that match a certain pattern.&lt;/p&gt;

&lt;p&gt;You want to know if a word exists in a file?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;grep &lt;/span&gt;hello testing.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will find the word hello in the file &lt;code&gt;testing.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;you can use regular expression in your pattern so you can add the &lt;code&gt;-i&lt;/code&gt; flag directly before the pattern you're looking for if it is case sensitive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;a-zA-Z0-9]&lt;span class="o"&gt;{&lt;/span&gt;6,10&lt;span class="o"&gt;}&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example we're trying to find a string that has a length between 6 and 10 characters and is alphanumeric and is case sensitive.&lt;/p&gt;

</description>
      <category>cli</category>
      <category>beginners</category>
      <category>basic</category>
      <category>bash</category>
    </item>
    <item>
      <title>17 commands to master the Linux Command Line</title>
      <dc:creator>Fullstack Dev</dc:creator>
      <pubDate>Thu, 02 May 2024 14:04:31 +0000</pubDate>
      <link>https://dev.to/fullstackdev/master-the-linux-command-line-1aj</link>
      <guid>https://dev.to/fullstackdev/master-the-linux-command-line-1aj</guid>
      <description>&lt;h1&gt;
  
  
  The Shell
&lt;/h1&gt;

&lt;p&gt;The shell is a program (Terminal) that takes commands from the user.&lt;br&gt;
The default shell program on almost all the Linux distributions is the &lt;code&gt;Bourne Again shell&lt;/code&gt; also known as &lt;code&gt;Bash&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;You can find other shells available such as &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Korn Shell &lt;code&gt;ksh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Z shell &lt;code&gt;zsh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;TENEX C shell &lt;code&gt;tcsh&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For most distributions, the shell prompt should have this format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;username@hostname:current_directory &lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;$&lt;/code&gt; is there by default and doesn't need to be added.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo &lt;/span&gt;Hello from bash
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; 
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;whoami&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;echo&lt;/code&gt; command prints the string &lt;code&gt;Hello from bash&lt;/code&gt; to the display.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;date&lt;/code&gt; will print the date and the &lt;code&gt;whoami&lt;/code&gt; will print your username&lt;/p&gt;

&lt;h2&gt;
  
  
  Print working directory
&lt;/h2&gt;

&lt;p&gt;Linux like every other Unix-based system has its files organized in a hierarchical structure and acts as a blueprint.&lt;br&gt;
&lt;/p&gt;

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

|-- bin

|   |-- file1

|   |-- file2

|-- etc

|   |-- file3

|   &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nt"&gt;--&lt;/span&gt; directory1

|       |-- file4

|       &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nt"&gt;--&lt;/span&gt; file5

|-- home

|-- var
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The root directory &lt;code&gt;/&lt;/code&gt; contains a number of folders and file and allows you to store more folders and files. &lt;/p&gt;

&lt;p&gt;Each of the location of these folders and files are called &lt;code&gt;paths&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;For example a folder named &lt;code&gt;home&lt;/code&gt; that contains a folder named &lt;code&gt;projects&lt;/code&gt; its path would look like this &lt;code&gt;/home/projects&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can use the &lt;code&gt;pwd&lt;/code&gt; command to  which directory you are in. &lt;/p&gt;

&lt;h2&gt;
  
  
  change directory
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; means change directory. It is used to navigate from one directory to another in the filesystem. &lt;/p&gt;

&lt;p&gt;There are two types of paths:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Absolute path, which means, this path starts from the root &lt;code&gt;/&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/home/pictures/vacations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Relative path, which means, this path starts from the directory you are in. For example let's say you are in &lt;code&gt;/home/pictures/vacations&lt;/code&gt; and you  want to get inside &lt;code&gt;vacations&lt;/code&gt; to a folder named &lt;code&gt;Italy&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;username@hostname:/home/pictures/vacations &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;Italy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In other words, we're navigating from our current directory to the "Italy" folder.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.&lt;/code&gt; (current directory). This is the directory you are currently in.&lt;br&gt;
&lt;code&gt;..&lt;/code&gt; (parent directory). Takes you to the directory above your current.&lt;br&gt;
&lt;code&gt;~&lt;/code&gt; (home directory). This directory defaults to your “home directory”. Such as /home/pictures.&lt;br&gt;
&lt;code&gt;-&lt;/code&gt; (previous directory). This will take you to the previous directory you were just at.&lt;/p&gt;
&lt;h2&gt;
  
  
  list directories
&lt;/h2&gt;

&lt;p&gt;You want to know what folders and files are available in a certain directory, you will need this command &lt;code&gt;ls&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can also specify the path you want to list the directories of&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /home/pictures/vacations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that files starting with &lt;code&gt;.&lt;/code&gt; will not be visible to us using the &lt;code&gt;ls&lt;/code&gt; command but we can pass the &lt;code&gt;-a&lt;/code&gt; flag to see them&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another helpful ls flag is &lt;code&gt;-l&lt;/code&gt; for long format, which displays the list of files in a long format. beginning on the left: file size, last modification time, owner name, owner group, number of links, file permissions, and file/directory name.&lt;/p&gt;

&lt;p&gt;you can combine both flags to have the same combined results &lt;code&gt;ls -la&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here are some useful flags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ls -r&lt;/code&gt; Lists the current directory's content in reverse order.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ls -t&lt;/code&gt; Lists and sorts the current directory's content by modification time starting by the newest.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  touch command
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;touch&lt;/code&gt; command is used to create empty files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;my_new_file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The touch command will also modify the modification and access time to the current system time.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-a: Updates only the access time.&lt;/li&gt;
&lt;li&gt;-c: Updates only the modification time &lt;/li&gt;
&lt;li&gt;-t: Allows setting a specific date and time for the timestamps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use &lt;code&gt;file name_of_file&lt;/code&gt; to get a description of the file's content. &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;cat&lt;/code&gt; command allows you to display the content of a file &lt;code&gt;$ cat file_name&lt;/code&gt;&lt;br&gt;
You can also combine multiple files and show you the output &lt;code&gt;$ cat file_name1 file_name2&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Less
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;less&lt;/code&gt; command opens the file in the terminal&lt;br&gt;
you can press &lt;code&gt;q&lt;/code&gt; to quit.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;g&lt;/code&gt; moves to the beginning of the file &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;G&lt;/code&gt; moves to the end of the file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-N&lt;/code&gt; displays line numbers&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/search&lt;/code&gt; is used to search for a specific text inside the file&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Viewing all the previous commands
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;history&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This command is useful to see all the commands you previously used. You can also use this shortcut &lt;code&gt;!!&lt;/code&gt; instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="o"&gt;!!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can hit the up arrow to go back to the previous command instead of typing it again&lt;/p&gt;

&lt;p&gt;if you are not sure about a certain command or remember a part of a command you can type &lt;code&gt;CTRL + R&lt;/code&gt; and start typing a part of the command you want and a match will become visible to you.&lt;/p&gt;

&lt;p&gt;You can also clear the terminal by writing clear&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or you can type &lt;code&gt;CTRL + l&lt;/code&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Copy, move, make and remove files and directories.
&lt;/h2&gt;

&lt;p&gt;By giving the name of the file and the path to the location you wish to copy it to, you can copy a single file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;name_of_file /home/myFiles/newDocs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can copy several files and folders and use wildcards. A wildcard is a character that can increase the flexibility of your search by substituting it for a pattern-based choice. Wildcards are additionally versatile as they can be used in any command.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;* it's used to represent all single characters or any string.&lt;/li&gt;
&lt;li&gt;? used to represent one character&lt;/li&gt;
&lt;li&gt;[] used to represent any character within the brackets
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;.txt /home/Documents/videos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this will copy all the files with the &lt;code&gt;.txt&lt;/code&gt; extension in the current directory to the videos directory.&lt;/p&gt;

&lt;p&gt;Using the -r flag when running a command can be helpful since it copies files and directories within a directory recursively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; vacation/ /home/Documents/videos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you copy a file to a directory that has the same filename, the file will be overwritten with whatever you're copying over. You can use the &lt;code&gt;-i&lt;/code&gt; flag to avoid that.&lt;br&gt;
The &lt;code&gt;-i&lt;/code&gt; flag will prompt you to confirm if you wanna overwrite a file before you overwrite it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; myfile /home/Documents/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  moving files and directories
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;mv&lt;/code&gt; command allows you to move a file to a different directory by taking the file's name and the location to where you want it moved.&lt;br&gt;
This also works for directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;file1 /home/Documents
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;myfolder /home/documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also move multiple files by providing the names of the files and the path to where you want them moved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;file1 file2 /home/Documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use the &lt;code&gt;-i&lt;/code&gt; flag to prompt a confirmation before overwriting anything. &lt;/p&gt;

&lt;p&gt;we can also create a backup of a directory using the &lt;code&gt;-b&lt;/code&gt; flag&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; myfolder myfolder_backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use the &lt;code&gt;mv&lt;/code&gt; command to rename files like so&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;myfile new_file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  making a new directory and removing a directory
&lt;/h3&gt;

&lt;p&gt;You can use the &lt;code&gt;mkdir&lt;/code&gt; command to create a directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;folder folder1 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can also use the &lt;code&gt;-p&lt;/code&gt; flag to create subdirectories at the same time&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; folder/folder1/folder2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can remove files using the &lt;code&gt;rm&lt;/code&gt; command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm &lt;/span&gt;myfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using rm doesn't mean the removed files will be in the trash. Once this command is used the files will be completely gone.&lt;/p&gt;

&lt;p&gt;You can use the &lt;code&gt;-f&lt;/code&gt; flag to force remove the files even if they're write-protected ( you can't rename, move, or delete its parent directory.)&lt;/p&gt;

&lt;p&gt;You can also use the &lt;code&gt;-i&lt;/code&gt; flag to prompt for confirmation.&lt;/p&gt;

&lt;p&gt;You can't use the &lt;code&gt;rm&lt;/code&gt; on its own to remove a directory, you need to use the &lt;code&gt;-r&lt;/code&gt; flag. Using this flag will allow the removal of all the files and any subdirectories it has.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; myfolder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can remove a directory by using &lt;code&gt;rmdir&lt;/code&gt; command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rmdir &lt;/span&gt;folder1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Find a specific file
&lt;/h2&gt;

&lt;p&gt;You can use the &lt;code&gt;find&lt;/code&gt; command if you're trying to find a specific file. You need to specify the directory you'll be searching and what you're searching for. It also looks inside subdirectories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;find /home &lt;span class="nt"&gt;-name&lt;/span&gt; coffee.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also specify the type of file you are trying to find.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;find /home/Documents &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-name&lt;/span&gt; videos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Manual
&lt;/h2&gt;

&lt;p&gt;If you need some information about a specific command you can use the &lt;code&gt;man&lt;/code&gt; or &lt;code&gt;whatis&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;man &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;whatis &lt;span class="nb"&gt;cp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Alias
&lt;/h2&gt;

&lt;p&gt;You can give an alias to repetitive commands instead of typing them especially if they're long ones.&lt;br&gt;
To create an alias:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;la&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'las -la`
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can type &lt;code&gt;la&lt;/code&gt; instead of &lt;code&gt;ls -la&lt;/code&gt; command and you will have the same output.&lt;/p&gt;

&lt;p&gt;If you want to remove the alias you can use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;unalias &lt;/span&gt;la
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check flags
&lt;/h2&gt;

&lt;p&gt;If you wanna know what flags are available for a certain command you can use &lt;code&gt;help&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Feel free to leave a question in the comment section! &lt;/p&gt;

</description>
      <category>cli</category>
      <category>bash</category>
      <category>basic</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
