<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
>

<channel>
	<title>howto</title>
	<atom:link href="https://www.datadeck.com/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.datadeck.com/en/blog</link>
	<description>Datadeck Blog - For all you data n00bz out there</description>
	<lastBuildDate>Sun, 17 Feb 2019 06:28:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.8</generator>

<image>
	<url>https://www.datadeck.com/en/blog/wp-content/uploads/2018/08/cropped-dd-favi-32x32.png</url>
	<title>howto</title>
	<link>https://www.datadeck.com/en/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">145765474</site>	<item>
		<title>Data Blending &#8211; Basic SQL Instructions for Datadeck</title>
		<link>https://www.datadeck.com/en/blog/2018/11/12/data-blending-basic-sql-instructions-for-datadeck/</link>
		<comments>https://www.datadeck.com/en/blog/2018/11/12/data-blending-basic-sql-instructions-for-datadeck/#respond</comments>
		<pubDate>Tue, 13 Nov 2018 01:58:36 +0000</pubDate>
		<dc:creator><![CDATA[Guy Geeraedts]]></dc:creator>
				<category><![CDATA[Digital Marketing For Beginners]]></category>
		<category><![CDATA[General Tips & Stuff]]></category>
		<category><![CDATA[Learn Datadeck]]></category>
		<category><![CDATA[Big Data]]></category>
		<category><![CDATA[Cheat sheet]]></category>
		<category><![CDATA[Datadeck]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">https://www.datadeck.com/en/blog/?p=1427</guid>
		<description><![CDATA[<p>Do you have “no” knowledge of SQL? Think SQL is hard? Well, if you want to use Datadeck’s new data blending feature you will need to know some basic SQL....</p>
<p>The post <a rel="nofollow" href="https://www.datadeck.com/en/blog/2018/11/12/data-blending-basic-sql-instructions-for-datadeck/">Data Blending &#8211; Basic SQL Instructions for Datadeck</a> appeared first on <a rel="nofollow" href="https://www.datadeck.com/en/blog"></a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><span style="font-weight: 400;">Do you have “no” knowledge of SQL?<br />
</span><span style="font-weight: 400;">Think SQL is hard? </span></p>
<p><span style="font-weight: 400;">Well, if you want to use Datadeck’s new data blending feature you will need to know some basic SQL. However, if you don’t, we got you covered.</span></p>
<p><span style="font-weight: 400;">In this article I’m showing you how easy SQL and I’m including a </span><b>SQL Cheat Sheet</b><span style="font-weight: 400;"> so you don’t have to remember anything just </span><b>copy &#8211; paste</b><span style="font-weight: 400;">!</span></p>
<p><span style="font-weight: 400;">Datadeck now has the power to blend data from multiple data sources into one chart/card and because of that, it’s time to improve your basic </span><a href="https://en.wikipedia.org/wiki/SQL"><span style="font-weight: 400;">SQL</span></a><span style="font-weight: 400;"> query skills to make the most out of this new feature. </span></p>
<p><span style="font-weight: 400;">For this sample I’d like to use the Tableau &#8211; </span><a href="https://community.tableau.com/servlet/JiveServlet/downloadBody/1236-102-2-15278/Sample%20-%20Superstore.xls"><span style="font-weight: 400;">Superstore Demo spreadsheet</span></a><span style="font-weight: 400;">. </span><i><span style="font-weight: 400;">(If you want to practice, download it and upload it into your Datadeck account)</span></i></p>
<p><span style="font-weight: 400;">Let’s start with some basics.</span></p>
<h2>What is SQL?</h2>
<p><span style="font-weight: 400;">SQL stands for </span><b>S</b><span style="font-weight: 400;">tructured </span><b>Q</b><span style="font-weight: 400;">uery </span><b>L</b><span style="font-weight: 400;">anguage, which is the language we use in our Data blending feature. SQL is used to talk with tables and data sources</span>.</p>
<h2>What is a SQL query?</h2>
<p><span style="font-weight: 400;">A SQL query or SQL statement is nothing more than a sentence we use to talk to Datadeck and let it get the data we need. So think about like this… <em>&#8220;Hey Datadeck, get me the latest sales from the superstore excel file for Toy cars.&#8221;</em></span></p>
<p>This would be plain English but in a SQL query it’s actually not very different.</p>
<h2>SQL Basics</h2>
<p>We always start with:</p>
<p><span style="color: #0000ff;">SELECT</span><br />
<span style="color: #0000ff;">FROM</span></p>
<p>We know both of these words. <span style="color: #0000ff;">SELECT</span> will represent the actual result you would like to see. In the sample I used <span style="color: #0000ff;">SELECT</span> Sales.</p>
<p>FROM is referring to the column of the source… so FROM Orders.</p>
<p>The full SQL query will look like this:<br />
<span style="color: #0000ff;">SELECT</span> Sales <span style="color: #0000ff;">FROM</span> Orders</p>
<p>Here you go! You just created your first query.</p>
<p>In my Sample I also used November 2018. Adding that is actually quite easy. For that we can use <span style="color: #0000ff;">WHERE</span></p>
<p><span style="color: #0000ff;">WHERE</span> Productname = <code>"Toy cars"</code></p>
<p>The new SQL query will be:<br />
<span style="color: #0000ff;">SELECT</span> Sales <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">WHERE</span> Productname = <code>"Toy cars"</code></p>
<h2>Datadeck&#8217;s SQL Cheat Sheet</h2>
<p>We created an overview of some easy to use to SQL queries that will help you make the most out of our Data Blending feature in Datadeck. Feel free to ask us for help or submit some extra queries we can share with our users.</p>
<h3><strong>Select all rows in “Orders” table, include all fields</strong></h3>
<p><span style="color: #0000ff;">SELECT</span> <strong>*</strong> <span style="color: #0000ff;">FROM</span> Orders</p>
<h3>Select all rows in “Orders” table, sort by “Order Date” field</h3>
<p><span style="color: #0000ff;">SELECT</span> <strong>*</strong> <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">ORDER BY</span> Orders.<code>`Order Date`</code></p>
<h3>Select all rows in “Orders” table, reversely sort by “Sales” field</h3>
<p><span style="color: #0000ff;">SELECT</span> <strong>*</strong> <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">ORDER BY</span> Orders.<code>Sales</code> <span style="color: #0000ff;">DESC</span></p>
<h3>Select rows in “Orders” table where “Sales” field value is greater than 1000, include selected fields</h3>
<p><span style="color: #0000ff;">SELECT</span> Orders.<code>`Order ID`</code>, Orders.<code>`Order Date`</code>, Orders.<code>Sales</code> <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">WHERE</span> Orders.<code>Sales</code> &gt; 1000</p>
<h3>Select rows in “Orders” table and add a calculated field</h3>
<p><span style="color: #0000ff;">SELECT</span> Orders.*, (Orders.<code>Sales</code> / Orders.<code>Discount</code>) <span style="color: #0000ff;">AS</span> BeforeDiscount <span style="color: #0000ff;">FROM</span> Orders</p>
<h3>Group rows in “Orders” table by “Country” field, include sum of sales and profit</h3>
<p><span style="color: #0000ff;">SELECT</span> Orders.<code>Country</code>, <span style="color: #0000ff;">SUM</span>(Orders.<code>Sales</code>) <span style="color: #0000ff;">AS</span> TotalSales, <span style="color: #0000ff;">SUM</span>(Orders.<code>Profit</code>) <span style="color: #0000ff;">AS</span> TotalProfit <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">GROUP BY</span> Orders.<code>Country</code></p>
<h3>Join “Orders” table and “Returns” table by matching on “Order ID” field, only keep rows that exist in both tables</h3>
<p><span style="color: #0000ff;">SELECT</span> Orders.* <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">INNER JOIN</span> Returned <span style="color: #0000ff;">ON</span> Orders.<code>`Order ID`</code> = Returned.<code>`Order ID`</code></p>
<h3>Join “Orders” table and “Returns” table by matching on “Order ID” field, keep all rows that exist in the “Orders” table</h3>
<p><span style="color: #0000ff;">SELECT</span> Orders.*, Returned.<code>Returned</code> <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">LEFT JOIN</span> Returned <span style="color: #0000ff;">ON</span> Orders.<code>`Order ID`</code> = Returned.<code>`Order ID`</code></p>
<h3>Everything together: group all returned orders by country and get total sales and profit with sorting</h3>
<p><span style="color: #0000ff;">SELECT</span> Orders.<code>Country</code>, <span style="color: #0000ff;">SUM</span>(Orders.<code>Sales</code>) <span style="color: #0000ff;">AS</span> TotalSales, <span style="color: #0000ff;">SUM</span>(Orders.<code>Profit</code>) <span style="color: #0000ff;">AS</span> TotalProfit <span style="color: #0000ff;">FROM</span> Orders <span style="color: #0000ff;">INNER JOIN</span> Returned <span style="color: #0000ff;">ON</span> Orders.<code>`Order ID`</code> = Returned.<code>`Order ID`</code> <span style="color: #0000ff;">GROUP BY</span> Orders.<code>Country</code> <span style="color: #0000ff;">ORDER BY</span> TotalSales <span style="color: #0000ff;">DESC</span></p>
<p>The post <a rel="nofollow" href="https://www.datadeck.com/en/blog/2018/11/12/data-blending-basic-sql-instructions-for-datadeck/">Data Blending &#8211; Basic SQL Instructions for Datadeck</a> appeared first on <a rel="nofollow" href="https://www.datadeck.com/en/blog"></a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.datadeck.com/en/blog/2018/11/12/data-blending-basic-sql-instructions-for-datadeck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<post-id xmlns="com-wordpress:feed-additions:1">1427</post-id>	</item>
	</channel>
</rss>
