<?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/"
	>

<channel>
	<title>MySQL Join Tutorials</title>
	<atom:link href="http://mysqljoin.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysqljoin.com</link>
	<description>...mysql join syntax by example</description>
	<lastBuildDate>Thu, 18 Oct 2012 19:39:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>In depth explanation of SQL join types</title>
		<link>http://mysqljoin.com/joins/in-depth-explanation-of-sql-join-types/</link>
		<comments>http://mysqljoin.com/joins/in-depth-explanation-of-sql-join-types/#comments</comments>
		<pubDate>Tue, 03 Jul 2012 20:26:40 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Hints]]></category>

		<guid isPermaLink="false">http://mysqljoin.com/?p=625</guid>
		<description><![CDATA[While we at mysqljoin.com want to provide simply and straightforward tutorials which are easy to understand, we love in depth documentation as well. And since relational databases are very complex, a documentation can be much more technical than our tutorials are. We just came across such a documentation, a very detailed explanation of SQL join [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>While we at mysqljoin.com want to provide simply and straightforward tutorials which are easy to understand, we love in depth documentation as well. And since relational databases are very complex, a documentation can be much more technical than our tutorials are.</p>
<p>We just came across such a documentation, a very <a href="http://www.gplivna.eu/papers/sql_join_types.htm">detailed explanation of SQL join types</a>. We felt that we have to share this with our readers. It&#8217;s a very nice follow up reading for everybody who&#8217;s currently learning about MySQL joins. Beside many interesting facts you&#8217;ll find probably the most interesting visualisation of joined tables we&#8217;ve ever seen as well as a visualized classification schemes for SQL joins.</p>
<blockquote><p>There are different classification schemes and different criteria according to what joins are classified. As a result there is a bit mess in the process of understanding them. I haven&#8217;t found a nice scheme or even textual description how each one of various classification schemes and join types relates to other. In the following Meta model there is one possible variant of that, however theoreticians probably would break lances around other possible classification schemes. - <a href="http://www.gplivna.eu/papers/sql_join_types.htm">SQL join types</a></p></blockquote>
<p>&nbsp;</p>

<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/in-depth-explanation-of-sql-join-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do you like a question section?</title>
		<link>http://mysqljoin.com/joins/do-you-like-a-question-section/</link>
		<comments>http://mysqljoin.com/joins/do-you-like-a-question-section/#comments</comments>
		<pubDate>Tue, 03 Jul 2012 19:20:41 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Questions]]></category>

		<guid isPermaLink="false">http://mysqljoin.com/joins/do-you-like-a-question-section/</guid>
		<description><![CDATA[I thought it would be useful if people could simply ask questions about MySQL joins and have a place where they get an answer. Do you think it&#8217;s a useful feature?]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>I thought it would be useful if people could simply ask questions about MySQL joins and have a place where they get an answer. Do you think it&#8217;s a useful feature?</p>

<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/do-you-like-a-question-section/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google fighting against regular content as well?</title>
		<link>http://mysqljoin.com/joins/google-fighting-against-regular-content-as-well/</link>
		<comments>http://mysqljoin.com/joins/google-fighting-against-regular-content-as-well/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 13:18:02 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://mysqljoin.com/?p=584</guid>
		<description><![CDATA[Whatever Google intended to do with the latest update, I personally think there was some collateral damage done to sites like mysqljoin.com . Since this is only a site I created to show people how joins can be used within MySQL (for free), I never spent money to a SEO agency or something. All I [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>Whatever Google intended to do with the latest update, I personally think there was some collateral damage done to sites like <a href="http://mysqljoin.com">mysqljoin.com</a> . Since this is only a site I created to show people how joins can be used within MySQL (for free), I never spent money to a SEO agency or something. All I did was installing a SEO Plugin for WordPress. Am I guilty of &#8220;over optimizing&#8221; now?</p>
<p>The site is approx. 1,5 years old and it grew slowly. The first few month nothing really happened, then people somehow started to link to us , people on stackoverflow.com started to reference us and things like that. To me, this looks really organic. However, the traffic dropped overnight from approx. 1500 unique visitors per day to approx. 300 unique visitors.</p>
<p>If this update works to fight again spammy sites in the organic results, I&#8217;m fine with it. Even though I have no idea why Google penalized us (no message in webmaster tools or the like), it looks like it makes some form of &#8220;reverse SEO&#8221; possible: Instead of focussing on improving your own search engine ranking that much to outperform the competition, simply attack the competition by whatever Google now obviously doesn&#8217;t tolerate any more.</p>
<p>Honestly, do you as a reader thing the MySQL Join Tutorials are spam? Is it &#8220;valuable content&#8221; as it&#8217;s called by Google? A lot of people who commented on the posts seem to be happy about them.</p>
<p>We&#8217;re open to new ideas! What would you love to see as a tutorial as well? What don&#8217;t you like about our current tutorials. Any feedback is more than welcome.</p>
<p>Thank you very much, Jan</p>

<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/google-fighting-against-regular-content-as-well/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>MySQL DELETE Join example</title>
		<link>http://mysqljoin.com/joins/mysql-delete-join-example/</link>
		<comments>http://mysqljoin.com/joins/mysql-delete-join-example/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 20:58:47 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Tutorials]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[inner join]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://mysqljoin.com/?p=568</guid>
		<description><![CDATA[A very useful helper in your join toolbox can be a delete join. Even though it&#8217;s not a special join type but a join used within DELETE statements, it&#8217;s still worth mentioning. However, from time to time when I want to make use of delete joins  on my own, I somehow managed it to forgot [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>A very useful helper in your join toolbox can be a <a href="http://mysqljoin.com/joins/mysql-delete-join-example/">delete join</a>. Even though it&#8217;s not a special join type but a join used within DELETE statements, it&#8217;s still worth mentioning. However, from time to time when I want to make use of delete joins  on my own, I somehow managed it to forgot the syntax and have to look it up somewhere. Therefor, here is a description as well as an example.</p>
<p><strong>Take care:</strong> A delete join is a very powerful weapon. And with great power comes great responsibility! I recommend to develop the delete join on a development database. At least, make sure you have a working an recent backup before trying to delete things. A delete statement that uses joins makes it easy to shot yourself in the foot. And if you do, it probably blows away your hole leg.</p>
<p>&nbsp;</p>
<h4>DELETE join syntax</h4>
<p>When you delete data in MySQL using DELETE statements you are able to define a condition which specifies which rows should be removed. Take a look at the following database model:</p>
<p><a href="http://mysqljoin.com/wp-content/uploads/2012/04/delete-join.png"><img class="alignleft size-full wp-image-576" title="DELETE join example" src="http://mysqljoin.com/wp-content/uploads/2012/04/delete-join.png" alt="DELETE join" width="401" height="110" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>In our example the table <em>files</em> keeps track of filenames. Now, when a user wants to delete a file we first have to delete the file itself. Afterwards we can remove the record from our database. But since it could take a little while until we&#8217;re done and don&#8217;t want our users to wait, we are simply adding a record to the table <em>delete_queue</em> and wait for a background process to clean up. This isn&#8217;t a far fetched scenario, especially in the web environment.</p>
<p>Our background process could use the following statement that uses inner join to add the WHERE condition:</p>
<pre>

DELETE f FROM files f
INNER JOIN delete_queue USING (file_id)

</pre>
<p>&nbsp;</p>
<p>You can add additional join clauses to your statement like in SELECT statements for example. Adding a WHERE-clause is possible as well:</p>
<pre>
DELETE f FROM files f
INNER JOIN delete_queue USING (file_id)
WHERE file_id &gt; 100
</pre>
<p>&nbsp;</p>
<h4>More Information</h4>
<p>For more information about MySQL joins please also see:</p>
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/join.html" rel="nofollow">Official MySQL JOIN documentation</a></li>
</ul>


<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/mysql-delete-join-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UPDATE joins in MySQL</title>
		<link>http://mysqljoin.com/joins/update-join-mysql/</link>
		<comments>http://mysqljoin.com/joins/update-join-mysql/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 21:31:58 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Tutorials]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://mysqljoin.com//?p=526</guid>
		<description><![CDATA[When you want to update rows that are stored in MySQL tables you use update statements. Usually the table you&#8217;re updating has to be defined and in case you want to update only certain rows a condition for the update operation has to be specified. If the condition can be expressed based on columns of [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>When you want to <strong>update</strong> rows that are stored in MySQL tables you use update statements. Usually the table you&#8217;re updating has to be defined and in case you want to update only certain rows a condition for the update operation has to be specified. If the condition can be expressed based on columns of the same table, you most probably do this by adding a WHERE-clause. But what if there are rows in <em>tableA</em> which you want to update based on a condition that depends on related rows from <em>tableB</em>? The answer? Drumroll please&#8230;: Use a join as you would do in SELECT statements!</p>
<h4>Syntax</h4>
<p>When you&#8217;re updating data in MySQL, you can specify a condition to specify which rows should be affected. The following <a href="http://mysqljoin.com//joins/update-join-mysql/">update join example</a> makes use of an inner join. However, you can use any other join operation MySQL supports, like an outer join for example, as well. In the following example we&#8217;re going to raise prices for all books written by Steve Jobs who recently passed away (R.I.P. Steve!):</p>
<pre>
UPDATE b SET price = price + 5
FROM book AS b
INNER JOIN author a ON b.id = a.book_id
WHERE a.name LIKE 'Steve Jobs'
</pre>
<p>This example is based on a simple book database. Books are stored in one table, and authors are stored in another one. One book can have more than one author. The <a href="http://sqlrelationship.com/one-to-many-relationship/">one-to-many relationship (1:n)</a> between the two tables is represented by the column &#8220;book_id&#8221; in the authors table. Of course, on author can write more than one book as well, but I simplified the example for the purpose of this tutorial.</p>

<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/update-join-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A visualisation of SQL Joins</title>
		<link>http://mysqljoin.com/joins/visualisation-of-mysql-joins/</link>
		<comments>http://mysqljoin.com/joins/visualisation-of-mysql-joins/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 09:42:20 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Hints]]></category>

		<guid isPermaLink="false">http://mysqljoin.com//?p=503</guid>
		<description><![CDATA[Generally speaking, every result set that is created by a join is a certain combination of rows which are stored in MySQL tables. Even if you join more than two tables, MySQL always combines two result sets at a time. These result sets can be visualized with the help of so called Venn Diagramms, a mathematical [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>Generally speaking, every result set that is created by a <strong>join</strong> is a certain combination of rows which are stored in MySQL tables. Even if you join more than two tables, MySQL always combines two result sets at a time. These result sets can be visualized with the help of so called Venn Diagramms, a mathematical representation of sets. Taking a look at them sometimes makes it easier to understand what&#8217;s actually happening. In addition, the human brain can store information like the different MySQL join operations or the related <strong>MySQL join syntax</strong> if it can connect them with some kind of picture. That&#8217;s the reason why we provide a graphical representation (a Venn Diagramm) for every <a href="http://mysqljoin.com">MySQL join tutorial</a>. You can access them by browsing all available &#8220;<a href="http://mysqljoin.com//reference/mysql-supported-joins/">join tutorials</a>&#8220;.</p>
<p>In addition, the following pages provides an overview which is very interesting as well. It combines all the different possible result sets in just one graphic:</p>
<ul>
<li><a href="http://mxtutorial.com/2011/05/visual-sql-joins/">http://mxtutorial.com/2011/05/visual-sql-joins/</a></li>
</ul>
<p>&nbsp;</p>

<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/visualisation-of-mysql-joins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joins in MySQL 5: #1054 &#8211; Unknown column &#8216;&#8230;&#8217; in &#8216;on clause&#8217;</title>
		<link>http://mysqljoin.com/joins/joins-in-mysql-5-1054-unknown-column-in-on-clause/</link>
		<comments>http://mysqljoin.com/joins/joins-in-mysql-5-1054-unknown-column-in-on-clause/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 17:04:03 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Hints]]></category>
		<category><![CDATA[ansi sql]]></category>
		<category><![CDATA[inner join]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql 5]]></category>
		<category><![CDATA[unknown column]]></category>

		<guid isPermaLink="false">http://mysqljoin.com//?p=483</guid>
		<description><![CDATA[If you used to write MySQL joins for MySQL versions &#60; 5.0 or upgrade your server from MySQL 4 to MySQL &#62;= 5.0 you maybe run into a problem when you execute the following query: SELECT * FROM mytable1, mytable2 INNER JOIN mytable3 ON mytable1.mycolumnname = mytable3.mycolumnname WHERE mytable1.id = mytable2.id; #1054 &#8211; Unknown column [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>If you used to write MySQL joins for MySQL versions &lt; 5.0 or upgrade your server from MySQL 4 to MySQL &gt;= 5.0 you maybe run into a problem when you execute the following query:</p>
<pre>
SELECT *
FROM mytable1, mytable2
INNER JOIN mytable3
ON mytable1.mycolumnname = mytable3.mycolumnname
WHERE mytable1.id = mytable2.id;
</pre>
<p><strong>#1054 &#8211; Unknown column ‘mytable.mycolumnname’ in ‘on clause’</strong></p>
<p>Even though you made sure that the column exists, the problem persists. It can be a very annoying and time-consuming task to track this kind of error down to it&#8217;s cause: MySQL starting from version 5.0 tries to be more compliant to <a href="http://en.wikipedia.org/wiki/SQL#Standardization">ANSI SQL</a>. The tables are beeing joined in a different order. The solution to this problem is actually very simple. <span style="text-decoration: underline;">Surround the tables in the FROM clause with round bracket</span>s:</p>
<pre>
SELECT *
FROM (mytable1, mytable2)
INNER JOIN mytable3
ON mytable1.mycolumnname = mytable3.mycolumnname
WHERE mytable1.id = mytable2.id;
</pre>
<p>Even a better solution is to rewrite the query and make use of ANSI joins:</p>
<pre>
SELECT *
FROM mytable1
INNER JOIN mytable2
ON mytable1.id = mytable2.id
INNER JOIN mytable3
ON mytable1.mycolumnname = mytable3.mycolumnname;
</pre>


<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/joins-in-mysql-5-1054-unknown-column-in-on-clause/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MySQL INNER JOIN Tutorial: the comma operator</title>
		<link>http://mysqljoin.com/joins/inner-join-comma-operator/</link>
		<comments>http://mysqljoin.com/joins/inner-join-comma-operator/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 12:29:44 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Tutorials]]></category>
		<category><![CDATA[comma operator]]></category>
		<category><![CDATA[cross join]]></category>
		<category><![CDATA[inner join]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://mysql-join.com/?p=357</guid>
		<description><![CDATA[<p><img width="210" height="210" src="http://mysqljoin.com/wp-content/uploads/2010/12/inner_join1.png" class="attachment-medium wp-post-image" alt="MySQL inner join" title="MySQL inner join" /></p>Here you find information about writing inner joins with the comma operator. It&#8217;s the most basic way to combine (join) two tables. There is an alternative syntax that can be used, because in MySQL you can write inner joins in two different ways. Another popular way is it to use the INNER JOIN command or synonymous keywords [...]]]></description>
			<content:encoded><![CDATA[<p><img width="210" height="210" src="http://mysqljoin.com/wp-content/uploads/2010/12/inner_join1.png" class="attachment-medium wp-post-image" alt="MySQL inner join" title="MySQL inner join" /></p>
<!-- google_ad_section_start -->
<p>Here you find information about writing inner joins with the <a href="http://mysqljoin.com/joins/inner-join-comma-operator">comma operator</a>. It&#8217;s the most basic way to combine (join) two tables. There is an alternative syntax that can be used, because in MySQL you can write inner joins in two different ways. Another popular way is it to use the <a href="http://mysqljoin.com/joins/inner-join-tutorial/">INNER JOIN</a> command or synonymous keywords like <a href="http://mysqljoin.com/joins/inner-join-tutorial/">CROSS JOIN</a> and <a href="http://mysqljoin.com/joins/inner-join-tutorial/">JOIN</a>. Please make sure to read our dedicated documentation for more information when you understand the comma operator syntax.</p>

<h4>Syntax</h4>
<p>The following examples are equivalent to the <a href="http://mysqljoin.com/joins/inner-join-tutorial/">INNER JOIN examples</a>, to make it easy to compare them. The first example builds the Cartesian product of two tables: Every row in the left table is combined with every row in the right table. In ANSI SQL,  this is called a cross join. MySQL however doesn&#8217;t distinguish between inner joins and cross joins.</p>
<p style="padding-left: 30px;">
<pre>
-- inner join without a condition: a cross join
SELECT *
FROM &lt;firstTable&gt; a, &lt;anotherTable&gt; b
</pre>
</p>
<p style="padding-left: 30px;">
<p style="padding-left: 30px;">
<pre>
-- inner join with WHERE-clause
SELECT *
FROM &lt;firstTable&gt; a, &lt;anotherTable&gt; b
WHERE a.&lt;columnName&gt; = b.&lt;columnName&gt;
</pre>
</p>
<p>When you write inner joins using the comma operator, there is only one way to specify the join condition: with a WHERE-clause.</p>
<h4>Basics</h4>
<p>An inner join combines all matching rows from two related tables. Two rows match if they are related, for example because they share a common column. When you write an inner join with the comma operator, the join condition which reflects a relationship between tables is added as a WHERE clause. You can use inner joins to SELECT, UPDATE or DELETE data that is stored within MySQL tables. Here are two more examples which are equivalent to the <a href="http://mysqljoin.com/joins/inner-join-tutorial/">INNER JOIN examples</a>:</p>
<p style="padding-left: 30px;">
<pre>
SELECT *
FROM tableA a, tableB b
WHERE a.someColumn = b.otherColumn
</pre>
</p>
<p style="padding-left: 30px;">
<pre>
SELECT *
FROM tableA a, tableB b
WHERE a.columnName = b.columnName
</pre>
</p>
<h4>Further information</h4>
<p>You have seen how to write inner joins with the comma operator. From our point of view, it&#8217;s &#8220;OK&#8221; to use this feature. However, using the alternative syntax makes it easier to read your joins. It&#8217;s considered as a good behavior to write statements where you can directly see if it&#8217;s an INNER JOIN or a CROSS JOIN (the Cartesian product of two tables). Also see:</p>
<ul>
<li>Write inner joins with keywords: <a href="http://mysqljoin.com/joins/inner-join-tutorial">INNER JOIN</a> / <a href="http://mysqljoin.com/joins/inner-join-tutorial">CROSS JOIN</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/join.html">MySQL Join Documentation</a></li>
<li><a href="http://en.wikipedia.org/wiki/Join_(SQL)">Wikipedia &#8211; SQL Joins</a></li>
</ul>


<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/inner-join-comma-operator/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>MySQL NATURAL JOIN Tutorial &amp; Examples</title>
		<link>http://mysqljoin.com/joins/natural-join-tutorial/</link>
		<comments>http://mysqljoin.com/joins/natural-join-tutorial/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 22:26:51 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Tutorials]]></category>
		<category><![CDATA[inner join]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[natural join]]></category>
		<category><![CDATA[outer join]]></category>

		<guid isPermaLink="false">http://mysql-join.com/?p=325</guid>
		<description><![CDATA[This tutorial explains how you can use NATURAL JOINs and what a natural join is actually. Included are syntax details and example statements. Generally speaking, the keyword NATURAL can be treated as a join condition which is added implicitly. If used, it replaces the keywords ON and USING altogether. In MySQL writing natural joins means adding the [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<div>
<p>This tutorial explains how you can use <a href="http://mysqljoin.com/joins/natural-join-tutorial">NATURAL JOINs</a> and what a natural join is actually. Included are syntax details and example statements.</p>
<p>Generally speaking, the keyword NATURAL can be treated as a join condition which is added implicitly. If used, it replaces the keywords ON and USING altogether. In MySQL writing natural joins means adding the keyword NATURAL to either an <a href="http://mysqljoin.com/joins/inner-join-tutorial">INNER JOIN</a> or an <a href="http://mysqljoin.com/joins/outer-join-tutorial">OUTER JOIN</a>. Let&#8217;s take a look at how a natural join implies a join condition.</p>

<h4>Syntax</h4>
<p>First of all, some natural join syntax examples. As mentioned earlier, <strong>a natural join adds a implicit condition</strong> to inner and outer join statements:</p>
<p style="padding-left: 30px;">
<pre>
-- natural inner join
SELECT *
FROM tableA
NATURAL JOIN tableB
</pre>
</p>
<p style="padding-left: 30px;">
<pre>
-- natural left outer join
SELECT *
FROM tableA
NATURAL LEFT OUTER JOIN tableB
</pre>
</p>
<p style="padding-left: 30px;">
<pre>
-- natural right outer join
SELECT *
FROM tableA
NATURAL RIGHT OUTER JOIN tableB
</pre>
</p>
<p style="padding-left: 30px;">
<p>Now, let&#8217;s take a look at the join condition a natural join implies. See the documentation about <a href="http://mysqljoin.com/joins/inner-join/">INNER JOINs</a> and <a href="http://mysqljoin.com/joins/left-outer-join-tutorial">LEFT JOINs</a> / <a href="http://mysqljoin.com/joins/right-outer-join-tutorial">RIGHT JOINs</a> for a general description of the used joins.</p>
<h4>Natural joins</h4>
<p>When you combine (join) two tables using a natural join, MySQL compares the columns of both tables to find columns with the same name. If the tables have nothing in common, MySQL builds the Cartesian product (see <a href="http://mysqljoin.com/joins/inner-join-tutorial">INNER JOIN</a> for more information). If there is at least one common column, it&#8217;s used to build a join condition. To make things clear, take a look at the following statements. They generate the same result set. The only assumption we make is that they both have a column named &#8216;id&#8217;:</p>
<p style="text-align: justify; padding-left: 30px;">
<pre>
SELECT *
FROM tableA
NATURAL JOIN tableB
</pre>
</p>
<p style="text-align: justify; padding-left: 30px;">
<pre>
SELECT *
FROM tableA a, tableB b
WHERE a.id = b.id
</pre>
</p>
<p>This also works when there is more than one common column. MySQL simply implies another condition. In this example we assume there are two common columns: &#8216;id and &#8216;email&#8217;:</p>
<p style="padding-left: 30px;">
<pre>
SELECT *
FROM tableA
NATURAL JOIN tableB
</pre>
</p>
<p style="padding-left: 30px;">
<pre>
SELECT *
FROM tableA a, tableB b
WHERE a.id = b.id
AND a.email = b.email
</pre>
</p>
<p>It may look convenient to write shorter statements, but you should avoid using natural joins if possible. A natural join Let&#8217;s take a look at the drawbacks a natural join</p>
<p style="text-align: justify;">
<h4>Drawbacks</h4>
<p>Using natural joins has some drawbacks which are not MySQL specific. A natural join is generally not the best way to solve a problem: First of all, it makes it harder to read statements. The join condition is based on the column names of the joined tables and therefor you have to compare two tables to know what&#8217;s going on.</p>
<p>Additionally, natural joins may cause problems when you rename or add columns. Imagine that you have to debug your code at some point in the future. Probably somebody changed the table structure without asking you and the application stopped working. It can be very time consuming to debug such errors. Remember that you have to <strong>use natural joins with caution</strong>!</p>
<h4>More Information</h4>
<p>For more information about <a href="http://mysqljoin.com/joins/natural-join-tutorial">NATURAL JOINs</a> please also see:</p>
<ul>
<li><a rel="nofollow" href="http://dev.mysql.com/doc/refman/5.1/en/join.html">Official MySQL JOIN documentation</a></li>
</ul>
</div>


<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/natural-join-tutorial/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MySQL STRAIGHT JOIN Tutorial &amp; Examples</title>
		<link>http://mysqljoin.com/joins/straight-join-tutorial/</link>
		<comments>http://mysqljoin.com/joins/straight-join-tutorial/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 18:49:49 +0000</pubDate>
		<dc:creator>jbrinkmann</dc:creator>
				<category><![CDATA[Join Tutorials]]></category>
		<category><![CDATA[inner join]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[straight join]]></category>

		<guid isPermaLink="false">http://mysql-join.com/?p=317</guid>
		<description><![CDATA[<p><img width="210" height="210" src="http://mysqljoin.com/wp-content/uploads/2010/12/inner_join1.png" class="attachment-medium wp-post-image" alt="MySQL inner join" title="MySQL inner join" /></p>This tutorial shows you how to write straight joins in MySQL and when an it makes sense to do so. Included are a general description, syntax examples and a comparison of straight and inner joins. . Straight Join A STRAIGHT_JOIN identifies and combines matching rows which are stored in two related tables. This is what an inner join [...]]]></description>
			<content:encoded><![CDATA[<p><img width="210" height="210" src="http://mysqljoin.com/wp-content/uploads/2010/12/inner_join1.png" class="attachment-medium wp-post-image" alt="MySQL inner join" title="MySQL inner join" /></p>
<!-- google_ad_section_start -->
<p>This tutorial shows you how to write <a href="http://mysqljoin.com/joins/straight-join-tutorial/">straight joins</a> in MySQL and when an it makes sense to do so. Included are a general description, syntax examples and a comparison of straight and inner joins.</p>
<p><span id="more-317"></span></p>
<div style="height: 75px;"><span style="display:none;">.</span></div>

<h4>Straight Join</h4>
<p>A <a href="http://mysqljoin.com/joins/straight-join-tutorial/">STRAIGHT_JOIN</a> identifies and combines matching rows which are stored in two related tables. This is what an inner join also does. The difference between an inner join and a straight join is that a straight join<strong> </strong>forces MySQL to read the left table first.</p>
<p>To see if the STRAIGHT_JOIN hint would make sense, you have to use EXPLAIN to analyze your queries. When you feel that another join order could improve the performance, use a straight join.</p>
<h4>Left table?</h4>
<p>The STRAIGHT_JOIN keyword or hint, forces MySQL to read the left table first. And what is the left table exactly? When you join two tables, you always have a left and a right table:</p>
<ul style="text-align: justify;">
<li style="text-align: justify;">left table is listed on the left side of the STRAIGHT_JOIN keyword</li>
<li>right table is listed on the right side of the STRAIGHT_JOIN keyword</li>
</ul>
<p style="text-align: justify; padding-left: 30px;">
<pre>
SELECT *
FROM leftTable l STRAIGHT_JOIN rightTable r
ON l.id = r.id
</pre>
</p>
<p style="text-align: justify;">
<h4 style="text-align: justify;">More Information</h4>
<p>For more information on the <a href="http://mysqljoin.com/joins/straight-join-tutorial/">STRAIGHT JOIN</a> syntax which is equivalent to the syntax of inner joins, please see our <a href="http://mysqljoin.com/joins/inner-join-tutorial">description of MySQL inner joins.</a> However, keep in mind that the MySQL join optimizer does a good job most of the time.<br />
</p>

<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://mysqljoin.com/joins/straight-join-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  mysqljoin.com/feed/ ) in 0.59394 seconds, on May 25th, 2013 at 6:57 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 25th, 2013 at 7:57 pm UTC -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- Quick Cache Is Fully Functional :-) ... A Quick Cache file was just served for (  mysqljoin.com/feed/ ) in 0.00042 seconds, on May 25th, 2013 at 7:35 pm UTC. -->