<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – SQL</title>
    <link>https://www.devkuma.com/en/tags/sql/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/sql/logo/180x180.jpg</url>
      <title>SQL</title>
      <link>https://www.devkuma.com/en/tags/sql/</link>
    </image>
    <description>Recent content in SQL on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/sql/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>SQL Basics | SQL</title>
      <link>https://www.devkuma.com/en/docs/sql/sql/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/sql/</guid>
      <description>
        
        
        &lt;p&gt;SQL (Structured Query Language) is a special-purpose programming language designed to manage data in relational database management systems (RDBMS). It was created for searching and managing data in relational database management systems, creating and modifying database schemas, and controlling access to database objects. Many database-related programs adopt SQL as a standard.&lt;/p&gt;
&lt;h2 id=&#34;types-of-commands&#34;&gt;Types of commands&lt;/h2&gt;
&lt;p&gt;SQL commands are divided into data definition (DDL), data manipulation (DML), and data control (DCL).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data Definition Language (DDL)&lt;/li&gt;
&lt;li&gt;Data Manipulation Language (DML)&lt;/li&gt;
&lt;li&gt;Data Control Language (DCL)&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | SQL | Comments</title>
      <link>https://www.devkuma.com/en/docs/sql/comments/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/comments/</guid>
      <description>
        
        
        &lt;p&gt;Comments are used to explain logic or disable code. Comments do not affect the code. SQL provides two types of comments.&lt;/p&gt;
&lt;h2 id=&#34;single-line-comment&#34;&gt;Single-line comment&lt;/h2&gt;
&lt;p&gt;A single-line comment uses &lt;code&gt;--&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;--Select all:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customer&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;multi-line-comment&#34;&gt;Multi-line comment&lt;/h2&gt;
&lt;p&gt;Everything from &lt;code&gt;/*&lt;/code&gt; to &lt;code&gt;*/&lt;/code&gt; is treated as a comment.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/*Select all the columns
of all the records
in the customers table:*/
SELECT * FROM customer;
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics</title>
      <link>https://www.devkuma.com/en/docs/sql/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/</guid>
      <description>
        
        
        &lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/sql/sql_devkuma.png&#34; alt=&#34;SQL Basics&#34;&gt;&lt;/p&gt;
&lt;p&gt;This section explains SQL.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DDL: Data Definition Language</title>
      <link>https://www.devkuma.com/en/docs/sql/ddl-:-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%A0%95%EC%9D%98-%EC%96%B8%EC%96%B4/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/ddl-:-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%A0%95%EC%9D%98-%EC%96%B8%EC%96%B4/</guid>
      <description>
        
        
        &lt;p&gt;DDL (Data Definition Language) is used to define or manipulate database schemas. It defines, changes, and deletes SCHEMA, DOMAIN, TABLE, VIEW, and INDEX objects with the following commands.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DDL: Data Definition Language | DATABASE</title>
      <link>https://www.devkuma.com/en/docs/sql/database/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/database/</guid>
      <description>
        
        
        &lt;h2 id=&#34;create-database&#34;&gt;CREATE DATABASE&lt;/h2&gt;
&lt;p&gt;The CREATE DATABASE statement is used to create a database for the first time.&lt;/p&gt;
&lt;h3 id=&#34;create-database-syntax&#34;&gt;CREATE DATABASE syntax&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DATABASE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;database_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;];&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;create-database-example&#34;&gt;CREATE DATABASE example&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DATABASE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;devkuma&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;drop-database&#34;&gt;DROP DATABASE&lt;/h2&gt;
&lt;p&gt;The DROP DATABASE statement is used to delete a database.&lt;/p&gt;
&lt;h3 id=&#34;drop-database-syntax&#34;&gt;DROP DATABASE syntax&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DROP&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DATABASE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;databasename&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;drop-database-example&#34;&gt;DROP DATABASE example&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DATABASE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;devkuma&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DDL: Data Definition Language | TABLE</title>
      <link>https://www.devkuma.com/en/docs/sql/table/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/table/</guid>
      <description>
        
        
        &lt;p&gt;A table is the basic structure for storing data in a database. A table is divided into columns and rows. Each row represents one record, and each column represents part of that record. For example, if a table stores customer data, its columns may include name, address, and date of birth. When defining a table, you specify each column name and the data type of that field.&lt;/p&gt;
&lt;p&gt;Data can take many forms. It may be an integer, such as &lt;code&gt;1&lt;/code&gt;; a real number, such as &lt;code&gt;0.55&lt;/code&gt;; a string, such as &lt;code&gt;&#39;sql&#39;&lt;/code&gt;; a date and time, such as &lt;code&gt;&#39;2000-JAN-25 03:22:22&#39;&lt;/code&gt;; or binary data. These forms are called data types. When defining a table, you must define the data type for each column. For example, the data type of a &lt;code&gt;name&lt;/code&gt; field may be &lt;code&gt;char(50)&lt;/code&gt;, which represents a string of 50 characters. However, data types differ by database, so check the documentation for the database you are using when defining a table.&lt;/p&gt;
&lt;h2 id=&#34;create-table&#34;&gt;CREATE TABLE&lt;/h2&gt;
&lt;p&gt;The CREATE TABLE statement is used to create a table.&lt;/p&gt;
&lt;h3 id=&#34;create-table-syntax&#34;&gt;CREATE TABLE syntax&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE &amp;#34;table_name&amp;#34; (
    &amp;#34;field_name1&amp;#34; &amp;#34;data_type&amp;#34;,
    &amp;#34;field_name2&amp;#34; &amp;#34;data_type&amp;#34;,
    &amp;#34;field_name3&amp;#34; &amp;#34;data_type&amp;#34;,
    ...
);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For example, to create customer data, enter SQL as shown below.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE customer (
    first_name char(50),
    last_name char(50),
    address char(50),
    city char(50),
    country char(25),
    birth_date datetime
);
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;drop-table&#34;&gt;DROP TABLE&lt;/h2&gt;
&lt;p&gt;The DROP TABLE statement is used to delete a data table.&lt;/p&gt;
&lt;p&gt;There are cases where a table must be removed from a database. If it is not removed when needed, it can cause serious problems because the database administrator (DBA) may not be able to manage the database efficiently. SQL provides the DROP TABLE statement to remove a table. The DROP TABLE statement is written as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DROP&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;TABLE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To delete a table, enter the following.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DROP&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;TABLE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customer&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;truncate-table&#34;&gt;TRUNCATE TABLE&lt;/h2&gt;
&lt;p&gt;When you delete a table with DROP TABLE, the entire table disappears. In contrast, when you use TRUNCATE TABLE, all data in the table is removed, but the table itself remains.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TRUNCATE TABLE &amp;#34;table_name&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To delete the data in a table, enter the following.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TRUNCATE TABLE customer;
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DDL: Data Definition Language | VIEW</title>
      <link>https://www.devkuma.com/en/docs/sql/view/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/view/</guid>
      <description>
        
        
        &lt;p&gt;A view can be seen as a virtual table. The difference from a table is that data is physically stored in a table, while a view does not store data in the structure created from the table.&lt;/p&gt;
&lt;h2 id=&#34;create-view&#34;&gt;CREATE VIEW&lt;/h2&gt;
&lt;p&gt;The statement for creating a view is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE VIEW &amp;#34;VIEW_NAME&amp;#34; AS &amp;#34;SQL statement&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL statement can be any SQL.&lt;/p&gt;
&lt;h3 id=&#34;creating-a-view&#34;&gt;Creating a VIEW&lt;/h3&gt;
&lt;p&gt;For example, suppose you have the following table.&lt;/p&gt;
&lt;h4 id=&#34;customer-table&#34;&gt;customer table&lt;/h4&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Column name&lt;/th&gt;
          &lt;th&gt;Data type&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;first_name&lt;/td&gt;
          &lt;td&gt;char(50)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;last_name&lt;/td&gt;
          &lt;td&gt;char(50)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;address&lt;/td&gt;
          &lt;td&gt;char(50)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;city&lt;/td&gt;
          &lt;td&gt;char(50)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;country&lt;/td&gt;
          &lt;td&gt;char(25)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;birth_date&lt;/td&gt;
          &lt;td&gt;datetime&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To create a view that contains the three fields first_name, last_name, and country from this table, enter the following.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE VIEW v_customer
AS SELECT first_name, last_name, country
FROM customer;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This creates a view named v_customer.&lt;/p&gt;
&lt;h4 id=&#34;v_customer-view&#34;&gt;v_customer view&lt;/h4&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Column name&lt;/th&gt;
          &lt;th&gt;Data type&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;first_name&lt;/td&gt;
          &lt;td&gt;char(50)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;last_name&lt;/td&gt;
          &lt;td&gt;char(50)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;country&lt;/td&gt;
          &lt;td&gt;char(25)&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;view-created-by-joining-tables&#34;&gt;VIEW created by joining tables&lt;/h3&gt;
&lt;p&gt;You can also join two tables by using a view. This lets users check the information they need through a view without directly combining two different tables. Suppose you have the following two tables.&lt;/p&gt;
&lt;h4 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h4&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&#34;geography-table&#34;&gt;Geography table&lt;/h4&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;region_name&lt;/th&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;New York&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;You can create a view that includes sales by region with the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE VIEW v_region_sales
AS SELECT A1.region_name region, SUM(A2.sales) sales
FROM geography A1, store_Information A2
WHERE A1.store_name = A2.store_name
GROUP BY A1.region_name;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This creates a view named &lt;strong&gt;v_region_sales&lt;/strong&gt;. The view contains sales data for each region. To retrieve data from this view, enter the following.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT * FROM v_region_sales;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result of the command above is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;region&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;east&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;west&lt;/td&gt;
          &lt;td&gt;2050&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;drop-view&#34;&gt;DROP VIEW&lt;/h2&gt;
&lt;p&gt;Use the DROP VIEW command to delete an existing view.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;DROP VIEW &amp;#34;[database_name.]VIEW_NAME&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DDL: Data Definition Language | INDEX</title>
      <link>https://www.devkuma.com/en/docs/sql/index/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/index/</guid>
      <description>
        
        
        &lt;p&gt;An index helps retrieve data from a table quickly and efficiently. However, while retrieval becomes faster, operations such as INSERT and UPDATE can become slower, so care is required. It is recommended to create indexes on tables that are queried frequently.&lt;/p&gt;
&lt;h2 id=&#34;create-index&#34;&gt;CREATE INDEX&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INDEX&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;index_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ON&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;drop-index&#34;&gt;DROP INDEX&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DROP&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INDEX&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;IF&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;EXISTS&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;index_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DDL: Data Definition Language | Primary Key</title>
      <link>https://www.devkuma.com/en/docs/sql/primary-key/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/primary-key/</guid>
      <description>
        
        
        &lt;p&gt;Each value of a primary key is unique within a table. In other words, a primary key is used to uniquely identify each row of data in a table. A primary key can be a field from the original data or a generated field that is unrelated to the original data. A primary key can include one or more fields. When a primary key includes multiple fields, it is called a composite key.&lt;/p&gt;
&lt;p&gt;A primary key can be set when creating a new table with CREATE TABLE, or when changing the structure of an existing table with ALTER TABLE.&lt;/p&gt;
&lt;h2 id=&#34;setting-a-primary-key-when-creating-a-table&#34;&gt;Setting a primary key when creating a table&lt;/h2&gt;
&lt;p&gt;The following are examples of setting a primary key when creating a new table.&lt;/p&gt;
&lt;h3 id=&#34;mysql&#34;&gt;MySQL:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE customer  (
  sid INTEGER,
  last_name VARCHAR(30),
  first_name VARCHAR(30),
  PRIMARY KEY (sid)
);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;oracle&#34;&gt;Oracle:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE Customer (
  sid integer PRIMARY KEY,
  last_name VARCHAR(30),
  first_name VARCHAR(30)
);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;sql-server&#34;&gt;SQL Server:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE Customer (
  sid INTEGER PRIMARY KEY,
  last_name VARCHAR(30),
  first_name VARCHAR(30)
);
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;setting-a-primary-key-when-changing-a-table-structure&#34;&gt;Setting a primary key when changing a table structure&lt;/h2&gt;
&lt;p&gt;The following are examples of setting a primary key when changing the structure of an existing table.&lt;/p&gt;
&lt;h3 id=&#34;mysql-1&#34;&gt;MySQL:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ALTER TABLE customer ADD PRIMARY KEY (sid);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;oracle-1&#34;&gt;Oracle:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ALTER TABLE customer ADD PRIMARY KEY (sid);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;sql-server-1&#34;&gt;SQL Server:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ALTER TABLE customer ADD PRIMARY KEY (sid);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Before setting a primary key with ALTER TABLE, make sure the field used as the primary key is set to NOT NULL. In other words, the field must always contain data.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DDL: Data Definition Language | Foreign Key</title>
      <link>https://www.devkuma.com/en/docs/sql/foreign-key/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/foreign-key/</guid>
      <description>
        
        
        &lt;p&gt;A foreign key is used to ensure referential integrity by pointing to the primary key field of one or more other tables. In other words, it ensures that only allowed data values are stored in the database.&lt;/p&gt;
&lt;h2 id=&#34;foreign-key-example&#34;&gt;Foreign key example&lt;/h2&gt;
&lt;p&gt;For example, suppose there are two tables. One is the customer table, which records all customer data, and the other is the orders table, which records all customer orders. There is one constraint: every customer in the order data must exist in the customer table. Here, you set a foreign key on the orders table, and that foreign key references the primary key of the customer table. This ensures that every customer in the orders table exists in the customer table. In other words, the orders table contains data for customers that exist in the customer table.&lt;/p&gt;
&lt;p&gt;The structure of the two tables is as follows.&lt;/p&gt;
&lt;h3 id=&#34;customer-table&#34;&gt;customer table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Field name&lt;/th&gt;
          &lt;th&gt;Property&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;sid&lt;/td&gt;
          &lt;td&gt;Primary key&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;last_name&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;first_name&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;orders-table&#34;&gt;orders table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Field name&lt;/th&gt;
          &lt;th&gt;Property&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;order_id&lt;/td&gt;
          &lt;td&gt;Primary key&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;order_date&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;customer_sid&lt;/td&gt;
          &lt;td&gt;Foreign key&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;amount&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In the example above, the customer_sid field in the orders table is a foreign key that points to the sid field in the customer table.&lt;/p&gt;
&lt;p&gt;The following are several ways to specify a foreign key when creating the orders table.&lt;/p&gt;
&lt;h3 id=&#34;mysql&#34;&gt;MySQL:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE orders  (
    order_id INTEGER,
    order_date DATE,
    customer_sid INTEGER,
    amount DOUBLE,
    PRIMARY KEY (order_id),
    FOREIGN KEY (customer_sid) REFERENCES customer (sid)
);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;oracle&#34;&gt;Oracle:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE orders (
    order_id INTEGER PRIMARY KEY,
    order_date DATE,
    customer_sid INTEGER REFERENCES customer (sid),
    amount DOUBLE
);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;sql-server&#34;&gt;SQL Server:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE orders  (
    order_id integer PRIMARY KEY,
    order_date DATETIME,
    customer_sid INTEGER REFERENCES customer(sid),
    amount DOUBLE
);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Next, look at examples of specifying a foreign key by changing the table structure.&lt;br&gt;
Here, assume that the orders table has already been created and no foreign key has been specified.&lt;/p&gt;
&lt;h3 id=&#34;mysql-1&#34;&gt;MySQL:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ALTER TABLE orders
ADD FOREIGN KEY (customer_sid) REFERENCES customer (sid);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;oracle-1&#34;&gt;Oracle:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ALTER TABLE orders
ADD (CONSTRAINT fk_orders1) FOREIGN KEY (customer_sid) REFERENCES customer(sid);
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;sql-server-1&#34;&gt;SQL Server:&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ALTER TABLE orders
ADD FOREIGN KEY (customer_sid) REFERENCES customer (sid);
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DCL: Data Control Language</title>
      <link>https://www.devkuma.com/en/docs/sql/dcl/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/dcl/</guid>
      <description>
        
        
        &lt;p&gt;DCL (Data Control Language) is a language for controlling data. It is used to define data security, integrity, recovery, and concurrency control.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;COMMIT: Applies the result of a transaction&lt;/li&gt;
&lt;li&gt;ROLLBACK: Cancels a transaction and restores it to its original state&lt;/li&gt;
&lt;li&gt;GRANT: Grants privileges to a user&lt;/li&gt;
&lt;li&gt;REVOKE: Revokes user privileges&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;tcl&#34;&gt;TCL&lt;/h2&gt;
&lt;p&gt;Some sources separate COMMIT and ROLLBACK, which are commands that control transactions within DCL, and refer to them as TCL (Transaction Control Language).&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language</title>
      <link>https://www.devkuma.com/en/docs/sql/dml/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/dml/</guid>
      <description>
        
        
        
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | SELECT</title>
      <link>https://www.devkuma.com/en/docs/sql/select/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/select/</guid>
      <description>
        
        
        &lt;p&gt;The SELECT statement is used to retrieve data from a database.&lt;/p&gt;
&lt;p&gt;The returned data is stored in a result set.&lt;/p&gt;
&lt;h2 id=&#34;select-syntax&#34;&gt;SELECT syntax&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here, column_name1, column_name2, and so on are the names of the fields in the table from which data will be selected. They are called columns. To select all available fields from a table, use the following syntax.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;select-examples&#34;&gt;SELECT examples&lt;/h2&gt;
&lt;h3 id=&#34;column-example&#34;&gt;Column example&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can load multiple columns at once, and you can select several pieces of data from a table.&lt;/p&gt;
&lt;h2 id=&#34;select-demo&#34;&gt;SELECT demo&lt;/h2&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;sql&#34;&gt;sql&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_information&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;result&#34;&gt;Result&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | DISTINCT</title>
      <link>https://www.devkuma.com/en/docs/sql/distinct/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/distinct/</guid>
      <description>
        
        
        &lt;p&gt;The DISTINCT keyword removes duplicate rows from the result of a SELECT statement.&lt;/p&gt;
&lt;p&gt;With a SELECT statement, you can load all data from one or more fields in a table. Even when the same value is repeated, all data can be loaded. In data processing, you often need to know which different values exist. In other words, rather than the number of times each value appears, you need to know which distinct values are present in the table or field. SQL makes this easy. Add DISTINCT after SELECT.&lt;/p&gt;
&lt;h2 id=&#34;distinct-syntax&#34;&gt;DISTINCT syntax&lt;/h2&gt;
&lt;p&gt;The DISTINCT statement is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DISTINCT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;distinct-example&#34;&gt;DISTINCT example&lt;/h2&gt;
&lt;p&gt;For example, suppose you want to find the names of different stores in the following Store_Information table.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT DISTINCT store_name FROM store_information;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | WHERE</title>
      <link>https://www.devkuma.com/en/docs/sql/where/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/where/</guid>
      <description>
        
        
        &lt;p&gt;The WHERE clause is used to filter records. It extracts only records that satisfy the specified condition.&lt;/p&gt;
&lt;p&gt;You do not always load all data from a table. Often, you load data selectively. For example, if you need to retrieve only data with sales of $1,000 or more, use the WHERE clause.&lt;/p&gt;
&lt;h2 id=&#34;where-syntax&#34;&gt;WHERE syntax&lt;/h2&gt;
&lt;p&gt;The WHERE clause is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;condition&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;where-example&#34;&gt;WHERE example&lt;/h2&gt;
&lt;p&gt;Suppose you need to retrieve data with sales of $1,000 or more from the following table.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT Store_Name
FROM Store_Information
WHERE Sales &amp;gt; 1000;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Store_Name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | AND, OR</title>
      <link>https://www.devkuma.com/en/docs/sql/and-or/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/and-or/</guid>
      <description>
        
        
        &lt;p&gt;The previous page explained how to load data that meets a condition from a table with the WHERE clause. A condition can be simple, as in the previous example, or complex. A complex condition combines two or more simple conditions with AND or OR. A single SQL statement can use any number of simple conditions.&lt;/p&gt;
&lt;h2 id=&#34;and--or-syntax&#34;&gt;AND | OR syntax&lt;/h2&gt;
&lt;p&gt;The AND | OR statement is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT &amp;#34;field_name&amp;#34;
FROM &amp;#34;table_name&amp;#34;
WHERE &amp;#34;condition&amp;#34;
{[AND|OR] &amp;#34;condition&amp;#34;}+;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;{}+&lt;/code&gt; means that the condition inside &lt;code&gt;{}&lt;/code&gt; can occur one or more times. Here, it shows that adding an AND condition or adding an OR condition can occur one or more times. You can also use parentheses to indicate the priority order of conditions.&lt;/p&gt;
&lt;h2 id=&#34;and--or-example&#34;&gt;AND | OR example&lt;/h2&gt;
&lt;p&gt;Suppose you need to retrieve data with sales of $1,000 or more from the following table.&lt;/p&gt;
&lt;p&gt;Suppose you need to retrieve all data from the Store_Information table where Sales is $1,000 or more, or where Sales is between $500 and $275.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Francisco&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT store_name
FROM store_information
WHERE Sales &amp;gt; 1000
OR (sales &amp;lt; 500 AND Sales &amp;gt; 275);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Francisco&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | IN, NOT IN</title>
      <link>https://www.devkuma.com/en/docs/sql/in-not-in/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/in-not-in/</guid>
      <description>
        
        
        &lt;p&gt;SQL uses the IN operator in two situations. This page explains one of them: the situation related to WHERE. For this usage, you must know at least one required value. All known values are then entered in the IN clause.&lt;/p&gt;
&lt;h2 id=&#34;in-not-in-syntax&#34;&gt;IN, NOT IN syntax&lt;/h2&gt;
&lt;p&gt;The IN clause is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT &amp;#34;field_name&amp;#34;
FROM &amp;#34;table_name&amp;#34;
WHERE &amp;#34;field_name&amp;#34; IN (&amp;#39;value1&amp;#39;, &amp;#39;value2&amp;#39;, ...);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There is one or more value inside the parentheses, and the values are separated by commas. A value can be a number or a string. If there is only one value inside the parentheses, it is equivalent to the following.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;WHERE &amp;#34;field_name&amp;#34; = &amp;#39;value1&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To query the opposite of the IN clause, use NOT IN.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT &amp;#34;field_name&amp;#34;
FROM &amp;#34;table_name&amp;#34;
WHERE &amp;#34;field_name&amp;#34; NOT IN (&amp;#39;value1&amp;#39;, &amp;#39;value2&amp;#39;, ...);
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;in-example&#34;&gt;IN example&lt;/h2&gt;
&lt;p&gt;For example, suppose you want to retrieve all data that includes Los Angeles or San Diego from the store_information table.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT *
FROM store_information
WHERE store_name IN (&amp;#39;Los Angeles&amp;#39;, &amp;#39;San Diego&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;not-in-example&#34;&gt;NOT IN example&lt;/h2&gt;
&lt;p&gt;Conversely, to retrieve all data excluding Los Angeles and San Diego, use the following.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT *
FROM store_information
WHERE store_name NOT IN (&amp;#39;Los Angeles&amp;#39;, &amp;#39;San Diego&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | BETWEEN</title>
      <link>https://www.devkuma.com/en/docs/sql/between/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/between/</guid>
      <description>
        
        
        &lt;p&gt;The IN operator retrieves matching values from a database by limiting them to one or more discrete values. BETWEEN retrieves matching values from a database within a certain range.&lt;/p&gt;
&lt;h2 id=&#34;between-syntax&#34;&gt;BETWEEN syntax&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BETWEEN&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;value1&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;AND&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;value2&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This lets you query data whose field value is between value1 and value2.&lt;/p&gt;
&lt;h2 id=&#34;between-example&#34;&gt;BETWEEN example&lt;/h2&gt;
&lt;p&gt;For example, suppose you want to retrieve data from the store_information table between January 6, 2018 and January 10, 2018.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Francisco&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Depending on the database, dates may be stored in different ways. The format shown here is one of those storage methods.&lt;/p&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT *
FROM Store_Information
WHERE Txn_Date BETWEEN &amp;#39;Jan-06-2018&amp;#39; AND &amp;#39;Jan-10-2018&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Francisco&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | LIKE</title>
      <link>https://www.devkuma.com/en/docs/sql/like/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/like/</guid>
      <description>
        
        
        &lt;p&gt;LIKE is another operator used in the WHERE clause. Basically, LIKE lets you find the data you need according to a pattern.&lt;/p&gt;
&lt;h2 id=&#34;like-syntax&#34;&gt;LIKE syntax&lt;/h2&gt;
&lt;p&gt;The LIKE clause syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;LIKE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;pattern&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;{pattern}&lt;/code&gt; includes wildcards. The following are some examples.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&amp;lsquo;A_Z&amp;rsquo;&lt;/strong&gt;: A string that starts with &lt;code&gt;A&lt;/code&gt;, has any single character after it, and ends with &lt;code&gt;Z&lt;/code&gt;. &lt;code&gt;ABZ&lt;/code&gt; and &lt;code&gt;A2Z&lt;/code&gt; match this pattern, but &lt;code&gt;AKKZ&lt;/code&gt; does not because there are two characters between A and Z, not one.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&amp;lsquo;ABC%&amp;rsquo;&lt;/strong&gt;: A string that starts with &lt;code&gt;ABC&lt;/code&gt;. For example, &lt;code&gt;ABCD&lt;/code&gt; and &lt;code&gt;ABCABC&lt;/code&gt; match this pattern.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&amp;rsquo;%XYZ&amp;rsquo;&lt;/strong&gt;: A string that ends with &lt;code&gt;XYZ&lt;/code&gt;. For example, &lt;code&gt;WXYZ&lt;/code&gt; and &lt;code&gt;ZZXYZ&lt;/code&gt; match this pattern.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&amp;rsquo;%AN%&amp;rsquo;&lt;/strong&gt;: A string that contains &lt;code&gt;AN&lt;/code&gt;. For example, &lt;code&gt;LOS ANGELES&lt;/code&gt; and &lt;code&gt;SAN FRANCISCO&lt;/code&gt; match this pattern.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When the last example above is used with the store_information table, it works as follows.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Francisco&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT *
FROM Store_Information
WHERE Store_Name LIKE &amp;#39;%AN%&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;LOS ANGELES&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;SAN DIEGO&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;SAN FRANCISCO&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | IS NULL, IS NOT NULL</title>
      <link>https://www.devkuma.com/en/docs/sql/is-null-is-not-null/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/is-null-is-not-null/</guid>
      <description>
        
        
        &lt;p&gt;These conditions check whether a field value is empty, that is, whether it is NULL.&lt;/p&gt;
&lt;h2 id=&#34;is-null-is-not-null-syntax&#34;&gt;IS NULL, IS NOT NULL syntax&lt;/h2&gt;
&lt;p&gt;The IS NULL condition is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;IS&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;NULL&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To query the opposite of the IS NULL condition, use the following.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;IS&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;NOT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;NULL&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;is-null-example&#34;&gt;IS NULL example&lt;/h2&gt;
&lt;p&gt;Given the store_information table below, suppose sales is empty.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT *
FROM store_information
WHERE sales IS NULL
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;is-not-null-example&#34;&gt;IS NOT NULL example&lt;/h2&gt;
&lt;p&gt;When sales is not empty, use the following.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT *
FROM store_information
WHERE sales IS NOT NULL
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | EXISTS</title>
      <link>https://www.devkuma.com/en/docs/sql/exists/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/exists/</guid>
      <description>
        
        
        &lt;p&gt;EXISTS returns rows when the condition executed in WHERE has a result.&lt;/p&gt;
&lt;h2 id=&#34;exists-syntax&#34;&gt;EXISTS syntax&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;EXISTS&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;search_condition&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;exists-example&#34;&gt;EXISTS example&lt;/h2&gt;
&lt;p&gt;Given the following two tables, suppose you want to retrieve information for stores in the East region.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;geography-table&#34;&gt;geography table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;region_name&lt;/th&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;New York&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To retrieve information for stores in the East region, use the following.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT *
FROM store_information A1
WHERE EXISTS
(SELECT * FROM geography WHERE region_name = &amp;#39;East&amp;#39; AND store_name = A1.store_name);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | ORDER BY</title>
      <link>https://www.devkuma.com/en/docs/sql/order-by/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/order-by/</guid>
      <description>
        
        
        &lt;p&gt;The ORDER BY keyword is used to sort a result set in ascending or descending order.&lt;/p&gt;
&lt;p&gt;By default, ORDER BY sorts records in ascending order. To sort records in descending order, use the DESC keyword.&lt;/p&gt;
&lt;h2 id=&#34;order-by-syntax&#34;&gt;ORDER BY syntax&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;table_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ORDER&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;column_name2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ASC&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DESC&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;order-by-examples&#34;&gt;ORDER BY examples&lt;/h2&gt;
&lt;h3 id=&#34;example-1&#34;&gt;Example 1&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customers&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ORDER&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;country&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;example-2&#34;&gt;Example 2&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customers&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ORDER&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;country&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customer_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;example-3&#34;&gt;Example 3&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customers&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ORDER&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;country&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ASC&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;customer_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DESC&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | GROUP BY</title>
      <link>https://www.devkuma.com/en/docs/sql/group-by/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/group-by/</guid>
      <description>
        
        
        &lt;p&gt;The GROUP BY clause is used to group rows that have the same value.&lt;/p&gt;
&lt;p&gt;Returning to aggregate functions, suppose you calculated all Sales with the SUM command. If you want to calculate Sales for each Store_Name, you need to do two things. First, select the store_name and Sales fields. Second, calculate sales for each store_name. The syntax is as follows.&lt;/p&gt;
&lt;h2 id=&#34;group-by-syntax&#34;&gt;GROUP BY syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT &amp;#34;field1&amp;#34;, SUM(&amp;#34;field2&amp;#34;)
FROM &amp;#34;table_name&amp;#34;
GROUP BY &amp;#34;field1&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For example:&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT store_name, SUM(sales)
FROM store_Information
GROUP BY store_name;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;SUM(sales)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1800&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;When you select more than one field and at least one of them includes a function calculation, you must use GROUP BY. In this case, check the other fields together with GROUP BY. In other words, after identifying the field that includes the function, put the other selected field in the GROUP BY clause.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | HAVING</title>
      <link>https://www.devkuma.com/en/docs/sql/having/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/having/</guid>
      <description>
        
        
        &lt;p&gt;This section explains how to apply conditions to function values.&lt;/p&gt;
&lt;p&gt;For example, suppose you want to retrieve only stores with sales of $1,500 or more. This cannot be done with WHERE alone. In that case, use a command such as HAVING. In general, the HAVING clause appears at the end of an SQL statement. SQL that includes a HAVING clause does not necessarily have to include a GROUP BY clause.&lt;/p&gt;
&lt;h2 id=&#34;having-syntax&#34;&gt;HAVING syntax&lt;/h2&gt;
&lt;p&gt;The HAVING statement syntax is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT &amp;#34;column1&amp;#34;, SUM(&amp;#34;field2&amp;#34;)
FROM &amp;#34;table_name&amp;#34;
GROUP BY &amp;#34;field1&amp;#34;
HAVING (function_condition);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The GROUP BY clause is not always required.&lt;/p&gt;
&lt;h2 id=&#34;having-example&#34;&gt;HAVING example&lt;/h2&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Given the table above, enter the following statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT store_name, SUM(sales)
FROM store_Information
GROUP BY store_name
HAVING SUM(sales) &amp;gt; 1500;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result of the statement above is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;SUM(sales)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1800&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | AS - Aliases</title>
      <link>https://www.devkuma.com/en/docs/sql/as--aliases/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/as--aliases/</guid>
      <description>
        
        
        &lt;p&gt;AS stands for alias. It is used to provide a temporary name, or alias, for a table or a table field. Aliases are often used to make column names easier to read, and they exist only while a query is running.&lt;/p&gt;
&lt;p&gt;In short, field aliases are used to make SQL results easier to understand. In the example, summing sales produces the field name SUM(sales). That is fine in this case, but if the field is not a simple sum and becomes a complex expression, the field name also becomes complex. By using an alias for such a field, the field name shown in the result becomes easier to understand.&lt;/p&gt;
&lt;p&gt;The second type of alias is a table alias. To add an alias to a table, put one space after the table name in the FROM clause and specify the alias. This is very useful when reading data from different tables with SQL.&lt;/p&gt;
&lt;h2 id=&#34;as-syntax&#34;&gt;AS syntax&lt;/h2&gt;
&lt;p&gt;Field and table aliases are specified as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_alias&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;AS&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_alias&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;AS&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_alias&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Basically, both aliases are specified after a table name or field name with one space. You can also explicitly write AS.&lt;/p&gt;
&lt;h2 id=&#34;as-example&#34;&gt;AS example&lt;/h2&gt;
&lt;p&gt;Consider the following store_information table.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Use GROUP BY as follows and add a field alias and table alias.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT A1.store_name Store, SUM(A1.sales) &amp;#39;Total Sales&amp;#39;
FROM store_information A1
GROUP BY A1.store_name;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Store&lt;/th&gt;
          &lt;th&gt;Total Sales&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1800&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The data itself is the same in the result, but the field headings have changed. This is the use of field aliases. Instead of the heading &amp;ldquo;Sum (Sales)&amp;rdquo; for the second field, the heading &amp;ldquo;Total Sales&amp;rdquo; is displayed. Clearly, &amp;ldquo;Total Sales&amp;rdquo; shows the meaning of the field more clearly than &amp;ldquo;Sum(sales)&amp;rdquo;.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | JOIN</title>
      <link>https://www.devkuma.com/en/docs/sql/join/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/join/</guid>
      <description>
        
        
        &lt;p&gt;JOIN is used to combine tables with other tables.&lt;/p&gt;
&lt;p&gt;The following are several types of JOIN in SQL.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;(INNER) JOIN: Returns records that have matching values in both tables.&lt;/li&gt;
&lt;li&gt;LEFT (OUTER) JOIN: Returns all records from the left table and matching records from the right table.&lt;/li&gt;
&lt;li&gt;RIGHT (OUTER) JOIN: Returns all records from the right table and matching records from the left table.&lt;/li&gt;
&lt;li&gt;FULL (OUTER) JOIN: Returns all records from the left or right table.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/sql/sql_join1.png&#34; alt=&#34;SQL JOINS&#34;&gt;&lt;/p&gt;
&lt;p&gt;You can also control the returned values as follows.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/sql/sql_join2.png&#34; alt=&#34;SQL JOINS&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;join-syntax&#34;&gt;JOIN syntax&lt;/h2&gt;
&lt;h3 id=&#34;inner-join&#34;&gt;INNER JOIN&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;s&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INNER&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;JOIN&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ON&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;left-outer-join&#34;&gt;LEFT (OUTER) JOIN&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;s&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;LEFT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;JOIN&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ON&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;right-outer-join&#34;&gt;RIGHT (OUTER) JOIN&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;s&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;RIGHT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;JOIN&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ON&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;full-outer-join&#34;&gt;FULL (OUTER) JOIN&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;s&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FULL&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;OUTER&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;JOIN&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ON&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;column_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;inner-join-example&#34;&gt;INNER JOIN example&lt;/h2&gt;
&lt;p&gt;This is an example of SQL JOIN.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;geography-table&#34;&gt;geography table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;region_name&lt;/th&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;New York&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;An inner join returns data only when matching values exist in both tables.&lt;/p&gt;
&lt;p&gt;We will examine sales by region_name. The geography table shows stores in each region, and the store_information table shows sales for each store. To check sales by region, combine the data from these two tables. Looking closely, you can see that the two tables can be joined by the store_name field.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;region_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;REGION&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SUM&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;sales&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;SALES&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;geography&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;JOIN&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_information&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ON&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;GROUP&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;region_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;region_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;REGION&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SUM&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;sales&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;SALES&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;geography&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_information&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;GROUP&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;A1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;region_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;REGION&lt;/th&gt;
          &lt;th&gt;SALES&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;2050&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In the first line, SQL selects two fields. The first is the region_name field from the geography table, aliased as REGION, and the second is the sales field from the store_information table, aliased as SALES. Here, the table alias for Geography is A1 and the alias for store_information is A2. Without table aliases, the first line would look like this.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Geography&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;region_name&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;REGION&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SUM&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Store_Information&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Sales&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;SALES&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, writing out all table names makes the statement longer and more complex. Table aliases make SQL statements easier to understand, especially when a statement includes multiple tables.&lt;/p&gt;
&lt;p&gt;Next, in the FROM clause on the second line, the store_name field in the geography table is connected to the store_name field in the store_information table with JOIN.&lt;/p&gt;
&lt;h2 id=&#34;outer-join-example&#34;&gt;OUTER JOIN example&lt;/h2&gt;
&lt;p&gt;Use OUTER JOIN when a data value in one table does not appear at all in another table.&lt;/p&gt;
&lt;p&gt;Outer join syntax can differ by database. For example, Oracle places &lt;code&gt;(+)&lt;/code&gt; after every table loaded in the WHERE clause to indicate that the table&amp;rsquo;s data is required.&lt;/p&gt;
&lt;p&gt;We will retrieve sales for each store. If an inner join is used, data for the New York store, which does not exist in the store_information table, is omitted. In that case, use an outer join.&lt;/p&gt;
&lt;p&gt;The Oracle outer join used here is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT A1.store_name, SUM(A2.sales) SALES
FROM geography A1, store_information A2
WHERE A1.store_name = A2.store_name (+)
GROUP BY A1.store_name;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;SALES&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;New York&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1800&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;When there is no matching data in the second table, SQL inserts a NULL value. In this example, because New York does not exist in the store_information table, its SALES field becomes NULL.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | Subquery</title>
      <link>https://www.devkuma.com/en/docs/sql/subquery/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/subquery/</guid>
      <description>
        
        
        &lt;p&gt;You can put another SQL statement inside a single SQL statement. When another SQL statement is inserted in a WHERE clause or HAVING clause, you can use a subquery. Subqueries are first used to combine tables, and sometimes a subquery is the only way to join two tables.&lt;/p&gt;
&lt;h2 id=&#34;subquery&#34;&gt;Subquery&lt;/h2&gt;
&lt;p&gt;A subquery is written as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT &amp;#34;field1&amp;#34; FROM &amp;#34;table1&amp;#34;
WHERE &amp;#34;field2&amp;#34; [comparison_operator] (SELECT &amp;#34;field1&amp;#34; FROM &amp;#34;table2&amp;#34; WHERE &amp;#34;condition&amp;#34;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Comparison operators include &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;, and &lt;code&gt;&amp;lt;=&lt;/code&gt;, as well as string operators such as &lt;code&gt;LIKE&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;subquery-example&#34;&gt;Subquery example&lt;/h2&gt;
&lt;p&gt;This is an example related to SQL joins.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;geography-table&#34;&gt;geography table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;region_name&lt;/th&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;New York&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To use a subquery to calculate all sales for stores in the West region, use the following SQL.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT SUM(sales) FROM store_information
WHERE store_name IN
(SELECT store_name FROM geography
WHERE region_name = &amp;#39;West&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;SUM(sales)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;2050&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In this example, the two tables are not joined directly, but the total sales for stores in the West region can still be calculated. First, it checks which stores are in the West region. Then it calculates and sums the sales for those stores.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | UNION, UNION ALL</title>
      <link>https://www.devkuma.com/en/docs/sql/union-union-all/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/union-union-all/</guid>
      <description>
        
        
        &lt;p&gt;The UNION operator is used to combine the result sets of two or more SELECT statements.&lt;/p&gt;
&lt;p&gt;UNION combines the results of two SQL statements. In that sense, UNION is somewhat similar to JOIN because both commands can retrieve data from multiple tables. However, UNION has a limitation: the fields produced by the two SQL statements must use the same data types. Also, when UNION is used, duplicate data is not output, similar to SELECT DISTINCT.&lt;/p&gt;
&lt;h2 id=&#34;conditions-for-union&#34;&gt;Conditions for UNION&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Each SELECT statement in a UNION must have the same number of columns.&lt;/li&gt;
&lt;li&gt;The columns must have similar data types.&lt;/li&gt;
&lt;li&gt;The columns in each SELECT statement must also be in the same order.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;UNION ALL is also used to combine the results of two SQL statements. The difference from UNION is that UNION ALL displays all data that matches the condition even when data values are duplicated.&lt;/p&gt;
&lt;h2 id=&#34;union-union-all-syntax&#34;&gt;UNION, UNION ALL syntax&lt;/h2&gt;
&lt;p&gt;UNION is used as follows.&lt;/p&gt;
&lt;h3 id=&#34;union-syntax&#34;&gt;UNION syntax&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[SQL statement 1]
UNION
[SQL statement 2];
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Two SQL statements are entered here.&lt;/p&gt;
&lt;p&gt;UNION ALL is used as follows.&lt;/p&gt;
&lt;h3 id=&#34;union-all-syntax&#34;&gt;UNION ALL syntax&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[SQL statement 1]
UNION ALL
[SQL statement 2];
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Except for adding ALL, it is the same as UNION.&lt;/p&gt;
&lt;h2 id=&#34;union-example&#34;&gt;UNION example&lt;/h2&gt;
&lt;p&gt;Suppose you have the following two tables.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;internet_sales-table&#34;&gt;internet_sales table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-10-2018&lt;/td&gt;
          &lt;td&gt;535&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-11-2018&lt;/td&gt;
          &lt;td&gt;320&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-12-2018&lt;/td&gt;
          &lt;td&gt;750&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To check all sales dates, use the following SQL statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT txn_date FROM store_information
UNION
SELECT txn_date FROM internet_sales;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The execution result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-10-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-11-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-12-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;One thing to note is that using &lt;code&gt;SELECT DISTINCT txn_date&lt;/code&gt; in the SQL statement, or in both clauses where applicable, produces the same result.&lt;/p&gt;
&lt;h2 id=&#34;union-all-example&#34;&gt;UNION ALL example&lt;/h2&gt;
&lt;p&gt;Now retrieve the dates that have store sales and internet sales. In this case, use the following SQL statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT txn_date FROM store_information
UNION ALL
SELECT txn_date FROM internet_sales;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-10-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-11-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-12-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | INTERSECT</title>
      <link>https://www.devkuma.com/en/docs/sql/intersect/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/intersect/</guid>
      <description>
        
        
        &lt;p&gt;INTERSECT is similar to UNION and is used to process the results of two SQL statements. The difference is that UNION is basically like OR: if a value exists in the first statement or the second statement, it is selected and output. INTERSECT is closer to AND: a value is selected only when it exists in both the first and second statements. UNION is a union, while INTERSECT is an intersection.&lt;/p&gt;
&lt;h2 id=&#34;intersect-syntax&#34;&gt;INTERSECT syntax&lt;/h2&gt;
&lt;p&gt;The INTERSECT command is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[SQL statement 1]
INTERSECT
[SQL statement 2];
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;intersect-example&#34;&gt;INTERSECT example&lt;/h2&gt;
&lt;p&gt;Suppose you have the following two tables.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;internet_sales-table&#34;&gt;internet_sales table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-10-2018&lt;/td&gt;
          &lt;td&gt;535&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-11-2018&lt;/td&gt;
          &lt;td&gt;320&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-12-2018&lt;/td&gt;
          &lt;td&gt;750&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To check which dates have both store sales and internet sales, use the following SQL statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT txn_date FROM store_information
INTERSECT
SELECT txn_date FROM internet_sales;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL execution result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Note that the INTERSECT command displays each distinct value only once.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | MINUS</title>
      <link>https://www.devkuma.com/en/docs/sql/minus/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/minus/</guid>
      <description>
        
        
        &lt;p&gt;MINUS is a command used with two SQL statements. MINUS first checks the result of the first SQL statement. It then checks whether the retrieved result exists in the result of the second SQL statement. If it does, that data is removed and does not appear in the final result. Data that does not appear in the first SQL statement&amp;rsquo;s result is excluded.&lt;/p&gt;
&lt;h2 id=&#34;minus-syntax&#34;&gt;MINUS syntax&lt;/h2&gt;
&lt;p&gt;The MINUS command is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[SQL statement 1]
MINUS
[SQL statement 2];
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;minus-example&#34;&gt;MINUS example&lt;/h2&gt;
&lt;p&gt;Suppose you have the following two tables.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;internet_sales-table&#34;&gt;internet_sales table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-10-2018&lt;/td&gt;
          &lt;td&gt;535&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-11-2018&lt;/td&gt;
          &lt;td&gt;320&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-12-2018&lt;/td&gt;
          &lt;td&gt;750&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To check which dates have store sales but no internet sales, use the following SQL statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT txn_date FROM store_information
MINUS
SELECT txn_date FROM Internet_sales;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL execution result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;code&gt;Jan-05-2018&lt;/code&gt;, &lt;code&gt;Jan-07-2018&lt;/code&gt;, and &lt;code&gt;Jan-08-2018&lt;/code&gt; are returned by &lt;code&gt;SELECT txn_date FROM store_information&lt;/code&gt;. Among them, &lt;code&gt;Jan-07-2018&lt;/code&gt; exists in the result of &lt;code&gt;SELECT txn_date FROM internet_sales&lt;/code&gt;, so it does not appear in the final result.&lt;/p&gt;
&lt;p&gt;Note that the MINUS statement displays each distinct value only once based on the statement result.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | INSERT</title>
      <link>https://www.devkuma.com/en/docs/sql/insert/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/insert/</guid>
      <description>
        
        
        &lt;p&gt;Basically, there are two ways to insert data into a table. One inserts one row at a time. The other inserts multiple rows at once.&lt;/p&gt;
&lt;h2 id=&#34;insert-syntax&#34;&gt;INSERT syntax&lt;/h2&gt;
&lt;p&gt;The most basic SQL for inserting data is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INSERT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INTO&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;VALUES&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;value1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;value2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the order of the fields in the table matches the order of the entered values, the field names can be omitted.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INSERT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INTO&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;VALUES&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;value1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;value2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also insert multiple rows at once with SELECT. Unlike the previous example, the SELECT command specifies the data to insert into the table. If you are wondering whether that means the data comes from another table, that is not necessarily the case. SQL for inserting multiple rows at once is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INSERT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;INTO&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;table1&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;condition&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the most basic form. The SQL statement can also include joins, aliases, and clauses such as WHERE, GROUP BY, and HAVING.&lt;/p&gt;
&lt;h2 id=&#34;insert-example-inserting-one-row&#34;&gt;INSERT example: inserting one row&lt;/h2&gt;
&lt;p&gt;Suppose you have a table with the following structure.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Field name&lt;/th&gt;
          &lt;th&gt;Data type&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;store_name&lt;/td&gt;
          &lt;td&gt;char(50)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;sales&lt;/td&gt;
          &lt;td&gt;float&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;txn_date datetime&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To insert sales data of $900 for the Los Angeles store on Jan-10-2018 into this table, enter the following SQL statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;INSERT INTO store_information (store_name, sales, txn_Date)
VALUES (&amp;#39;Los Angeles&amp;#39;, 900, &amp;#39;Jan-10-2018&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or you can enter it as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;INSERT INTO store_information VALUES (&amp;#39;Los Angeles&amp;#39;, 900, &amp;#39;Jan-10-2018&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;insert-example-inserting-multiple-rows&#34;&gt;INSERT example: inserting multiple rows&lt;/h2&gt;
&lt;p&gt;Suppose you want to insert sales data from 2017 into the store_information table, and that data is obtained from the sales_information table. Enter the following SQL.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;INSERT INTO store_information (store_name, sales, txn_date)
SELECT store_name, sales, txn_date
FROM sales_information
WHERE Year(txn_date) = 2017;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here, a SQL Server function is used to retrieve the year from the date, but the syntax differs by database. For example, in Oracle, you can use &lt;code&gt;WHERE TO_CHAR(Txn_Date, &#39;yyyy&#39;) = 2017&lt;/code&gt;.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | UPDATE</title>
      <link>https://www.devkuma.com/en/docs/sql/update/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/update/</guid>
      <description>
        
        
        &lt;p&gt;Use the UPDATE command when modifying data in a table.&lt;/p&gt;
&lt;h2 id=&#34;update-syntax&#34;&gt;UPDATE syntax&lt;/h2&gt;
&lt;p&gt;The basic SQL for an UPDATE statement is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;UPDATE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SET&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;new_value&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also modify multiple fields at the same time.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;UPDATE &amp;#34;table_name&amp;#34;
SET &amp;#34;field1&amp;#34; = [value1], &amp;#34;field2&amp;#34; = [value2]
WHERE &amp;#34;condition&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;update-example&#34;&gt;UPDATE example&lt;/h2&gt;
&lt;p&gt;Suppose you have the following table.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Later, you find that the actual sales for the Los Angeles store on 2018/01/08 were $500, not the $300 stored in the table. Use the following SQL to modify the data.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;UPDATE store_information
SET Sales = 500
WHERE Store_Name = &amp;#39;Los Angeles&amp;#39;
AND Txn_Date = &amp;#39;Jan-08-2018&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you query the table again, you can confirm that it has been updated as follows.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table-1&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;500&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In this example, only one row matches the condition in the WHERE clause. If multiple rows match the condition, all matching rows are modified.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | DML: Data Manipulation Language | DELETE</title>
      <link>https://www.devkuma.com/en/docs/sql/delete/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/delete/</guid>
      <description>
        
        
        &lt;p&gt;You can delete some data directly from a database. Use DELETE to delete data.&lt;/p&gt;
&lt;h2 id=&#34;delete-syntax&#34;&gt;DELETE syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;DELETE FROM &amp;#34;table_name&amp;#34;
WHERE &amp;#34;condition&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;delete-example&#34;&gt;DELETE example&lt;/h2&gt;
&lt;p&gt;Consider the following example table.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;To delete all data for Los Angeles, use the following SQL statement.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;DELETE FROM store_information
WHERE store_name = &amp;#39;Los Angeles&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After running this SQL, the table becomes as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions</title>
      <link>https://www.devkuma.com/en/docs/sql/%ED%95%A8%EC%88%98/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/%ED%95%A8%EC%88%98/</guid>
      <description>
        
        
        &lt;p&gt;In databases, much of the data is represented as numbers, and functions are used for numeric operations. For example, they can calculate the sum of those numbers or compute an average.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;AVG&lt;/li&gt;
&lt;li&gt;COUNT&lt;/li&gt;
&lt;li&gt;MAX&lt;/li&gt;
&lt;li&gt;MIN&lt;/li&gt;
&lt;li&gt;SUM&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;function-syntax&#34;&gt;Function syntax&lt;/h2&gt;
&lt;p&gt;Functions are used as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT &amp;#34;function_name&amp;#34;(&amp;#34;field_name&amp;#34;)
FROM &amp;#34;table_name&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | AVG</title>
      <link>https://www.devkuma.com/en/docs/sql/avg-%ED%8F%89%EA%B7%A0/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/avg-%ED%8F%89%EA%B7%A0/</guid>
      <description>
        
        
        &lt;p&gt;AVG calculates the average of the data retrieved from a table.&lt;/p&gt;
&lt;h2 id=&#34;avg-syntax&#34;&gt;AVG syntax&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;AVG&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;avg-example&#34;&gt;AVG example&lt;/h2&gt;
&lt;p&gt;For example, suppose you want to find the average of the sales field in the table below.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT AVG(sales)
FROM store_information
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;AVG(sales)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;687.5000&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | COUNT</title>
      <link>https://www.devkuma.com/en/docs/sql/count-%EC%B9%B4%EC%9A%B4%ED%8A%B8/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/count-%EC%B9%B4%EC%9A%B4%ED%8A%B8/</guid>
      <description>
        
        
        &lt;p&gt;COUNT can retrieve how many rows of data are returned from a table.&lt;/p&gt;
&lt;h2 id=&#34;count-syntax&#34;&gt;COUNT syntax&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;COUNT&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;count-example&#34;&gt;COUNT example&lt;/h2&gt;
&lt;p&gt;For example, suppose you want to find how many non-empty values exist in the store_name field of the table below.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT COUNT(store_name)
FROM store_information
WHERE store_name IS NOT NULL;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;COUNT(store_name)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;4&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;code&gt;IS NOT NULL&lt;/code&gt; indicates that this field is not NULL, meaning it is not empty.&lt;/p&gt;
&lt;p&gt;COUNT and DISTINCT are used together when you want to remove duplicate data from a table and count how many distinct values remain. For example, to count how many store_name values exist in the table, enter the following.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;COUNT&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;DISTINCT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;store_information&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;COUNT(DISTINCT store_name)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;3&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | MAX, MIN</title>
      <link>https://www.devkuma.com/en/docs/sql/max-%EC%B5%9C%EB%8C%80%EA%B0%92-min-%EC%B5%9C%EC%86%8C%EA%B0%92/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/max-%EC%B5%9C%EB%8C%80%EA%B0%92-min-%EC%B5%9C%EC%86%8C%EA%B0%92/</guid>
      <description>
        
        
        &lt;p&gt;MAX and MIN return the maximum and minimum values of data retrieved from a table.&lt;/p&gt;
&lt;h2 id=&#34;max-min-syntax&#34;&gt;MAX, MIN syntax&lt;/h2&gt;
&lt;p&gt;The function for finding the maximum value is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;MAX&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The function for finding the minimum value is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;MIN&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;max-min-example&#34;&gt;MAX(), MIN() example&lt;/h2&gt;
&lt;p&gt;For example, suppose you want to find the maximum and minimum values of the sales field in the table below.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT MAX(sales), MIN(sales)
FROM store_information
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result can be obtained as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;MAX(sales)&lt;/th&gt;
          &lt;th&gt;MIN(sales)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | SUM</title>
      <link>https://www.devkuma.com/en/docs/sql/sum/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/sum/</guid>
      <description>
        
        
        &lt;p&gt;SUM can retrieve the total of data returned from a table.&lt;/p&gt;
&lt;h2 id=&#34;sum-syntax&#34;&gt;SUM syntax&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SUM&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;field_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;table_name&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;sum-example&#34;&gt;SUM example&lt;/h2&gt;
&lt;p&gt;For example, suppose you want to calculate the total of the sales field in the example table.&lt;/p&gt;
&lt;h3 id=&#34;store_information-table&#34;&gt;store_information table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;store_name&lt;/th&gt;
          &lt;th&gt;sales&lt;/th&gt;
          &lt;th&gt;txn_date&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;1500&lt;/td&gt;
          &lt;td&gt;Jan-05-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
          &lt;td&gt;250&lt;/td&gt;
          &lt;td&gt;Jan-07-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Boston&lt;/td&gt;
          &lt;td&gt;700&lt;/td&gt;
          &lt;td&gt;Jan-08-2018&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enter the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT SUM(sales) FROM store_information;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;SUM(sales)&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;2750&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;2750 is the total of all sales fields: 1500 + 250 + 300 + 700.&lt;/p&gt;
&lt;p&gt;In addition to functions, SQL can also perform simple mathematical operations such as addition (+) and subtraction (-). SQL also has several string processing functions for character data, such as concatenation, trim, and substring. Functions differ by database. To check how to use those functions, refer to the information for the database you are using.&lt;/p&gt;

      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | Substring</title>
      <link>https://www.devkuma.com/en/docs/sql/substring/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/substring/</guid>
      <description>
        
        
        &lt;p&gt;In SQL, the substring function is used to read part of the data in a field. The function name differs by database.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MySQL: SUBSTR(), SUBSTRING()&lt;/li&gt;
&lt;li&gt;Oracle: SUBSTR()&lt;/li&gt;
&lt;li&gt;SQL Server: SUBSTRING()&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is generally used as follows. Here, SUBSTR() is used as an example.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SUBSTR(str, pos)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reads all characters from the &lt;code&gt;pos&lt;/code&gt; position in &lt;code&gt;str&lt;/code&gt;. Note that this syntax does not apply to SQL Server.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SUBSTR(str, pos, len)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reads &lt;code&gt;len&lt;/code&gt; characters from the &lt;code&gt;pos&lt;/code&gt; position in &lt;code&gt;str&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;substring-example&#34;&gt;Substring example&lt;/h2&gt;
&lt;p&gt;Suppose you have the following table.&lt;/p&gt;
&lt;h3 id=&#34;geography-table&#34;&gt;geography table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;region_name&lt;/th&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;New York&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;example-1&#34;&gt;Example 1&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT SUBSTR(store_name, 3)
FROM geography
WHERE store_name = &amp;#39;Los Angeles&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;s Angeles&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;example-2&#34;&gt;Example 2&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT SUBSTR(store_name, 2, 4)
FROM geography
WHERE store_name = &amp;#39;San Diego&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;an D&amp;#39;
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | Concatenate</title>
      <link>https://www.devkuma.com/en/docs/sql/concatenate/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/concatenate/</guid>
      <description>
        
        
        &lt;p&gt;Sometimes you need to combine data from different fields. Each database has a way to achieve this.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MySQL: CONCAT()&lt;/li&gt;
&lt;li&gt;Oracle: CONCAT(), ||&lt;/li&gt;
&lt;li&gt;SQL Server: +&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;concatenate-syntax&#34;&gt;Concatenate syntax&lt;/h2&gt;
&lt;p&gt;CONCAT() is used as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CONCAT(string1, string2, string3, ...)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It combines string1, string2, string3, and so on. Note that Oracle&amp;rsquo;s CONCAT() accepts two parameters. In other words, it can combine only two strings at a time. To combine multiple strings at once, use &lt;code&gt;||&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;concatenate-example&#34;&gt;Concatenate example&lt;/h2&gt;
&lt;p&gt;For example, suppose you have the following table.&lt;/p&gt;
&lt;h3 id=&#34;geography-table&#34;&gt;geography table&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;region_name&lt;/th&gt;
          &lt;th&gt;store_name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;Boston&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;East&lt;/td&gt;
          &lt;td&gt;New York&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;Los Angeles&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;West&lt;/td&gt;
          &lt;td&gt;San Diego&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;example-1&#34;&gt;Example 1&lt;/h3&gt;
&lt;p&gt;MySQL / Oracle:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT CONCAT(region_name, store_name) FROM geography
WHERE store_name = &amp;#39;Boston&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;EastBoston&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;example-2&#34;&gt;Example 2&lt;/h3&gt;
&lt;p&gt;Oracle:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT region_name || &amp;#39; &amp;#39; || store_name FROM geography
WHERE store_name = &amp;#39;Boston&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;East Boston&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;example-3&#34;&gt;Example 3&lt;/h3&gt;
&lt;p&gt;SQL Server:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT region_name + &amp;#39; &amp;#39; + store_name FROM geography
WHERE store_name = &amp;#39;Boston&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;East Boston&amp;#39;
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | Trim</title>
      <link>https://www.devkuma.com/en/docs/sql/trim/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/trim/</guid>
      <description>
        
        
        &lt;p&gt;The SQL function TRIM is used to remove part of the beginning or end of a string. Commonly, the function name differs by database.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MySQL: TRIM(), RTRIM(), LTRIM()&lt;/li&gt;
&lt;li&gt;Oracle: RTRIM(), LTRIM()&lt;/li&gt;
&lt;li&gt;SQL Server: RTRIM(), LTRIM()&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Each trim function is as follows.&lt;/p&gt;
&lt;h2 id=&#34;trimposition-remove_string-from-string&#34;&gt;TRIM([[position] [remove_string] FROM] string)&lt;/h2&gt;
&lt;p&gt;The value entered for [position] is LEADING (beginning), TRAILING (end), or BOTH (beginning and end). This function removes [remove_string] from the beginning, end, or both beginning and end of the string. If [remove_string] is not specified, spaces are removed.&lt;/p&gt;
&lt;h2 id=&#34;ltrim-string&#34;&gt;LTRIM (string)&lt;/h2&gt;
&lt;p&gt;Removes spaces from the beginning of the string.&lt;/p&gt;
&lt;h2 id=&#34;rtrim-string&#34;&gt;RTRIM (string)&lt;/h2&gt;
&lt;p&gt;Removes spaces from the end of the string.&lt;/p&gt;
&lt;h2 id=&#34;trim-example&#34;&gt;Trim example&lt;/h2&gt;
&lt;h3 id=&#34;trim-example-1&#34;&gt;TRIM() example&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT TRIM(&amp;#39;   Sample   &amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;Sample&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;ltrim-example&#34;&gt;LTRIM() example&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT LTRIM(&amp;#39;   Sample   &amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;Sample   &amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;rtrim-example&#34;&gt;RTRIM() example&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT RTRIM (&amp;#39;   Sample   &amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;   Sample&amp;#39;
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
    <item>
      <title>SQL Basics | Functions | Replace</title>
      <link>https://www.devkuma.com/en/docs/sql/replace/</link>
      <pubDate>Sat, 17 Jun 2017 18:14:13 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/sql/replace/</guid>
      <description>
        
        
        &lt;p&gt;In SQL, the Replace function is used to replace part of the data in a field. The function name differs by database.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MySQL: REPLACE()&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;replace-syntax&#34;&gt;Replace syntax&lt;/h2&gt;
&lt;p&gt;REPLACE() is used as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;REPLACE&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;string&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;string_to_replace&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;replacement_string&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;replace-example&#34;&gt;Replace example&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;REPLACE&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;abcdefg&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;abc&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;aaa&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;| REPLACE(&amp;#39;abcdefg&amp;#39;, &amp;#39;abc&amp;#39;, &amp;#39;aaa&amp;#39;) |
|--|
| aaadefg |
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>SQL</category>
      
      <category>Database</category>
      
    </item>
    
  </channel>
</rss>
