<?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>Friendly Froggy ;-) &#187; MySQL</title>
	<atom:link href="http://www.friendly-froggy.net/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.friendly-froggy.net</link>
	<description>Ubuntu, logiciels libres et entrepreneurs</description>
	<lastBuildDate>Thu, 05 Jan 2012 12:07:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SQL : faire un UPDATE avec jointures sur plusieurs tables</title>
		<link>http://www.friendly-froggy.net/2010/03/24/sql-faire-un-update-avec-jointures-sur-plusieurs-tables/</link>
		<comments>http://www.friendly-froggy.net/2010/03/24/sql-faire-un-update-avec-jointures-sur-plusieurs-tables/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 17:19:47 +0000</pubDate>
		<dc:creator>PH</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[JOIN]]></category>
		<category><![CDATA[jointure]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[plusieure tables]]></category>
		<category><![CDATA[SET]]></category>
		<category><![CDATA[UPDATE]]></category>
		<category><![CDATA[WHERE]]></category>

		<guid isPermaLink="false">http://www.friendly-froggy.net/?p=601</guid>
		<description><![CDATA[J&#8217;ai cherché pendant un moment la solution à cette requête SQL donc autant vous la faire partager. Imaginons que vous ayez 3 tables sous MySQL : walk walk_photo photo Dans votre table photo certaines photos n&#8217;ont pas de titre (title) ou celui-ci est en NULL. Vous voulez donc faire un UPDATE de la table photo [...]]]></description>
			<content:encoded><![CDATA[<p>J&#8217;ai cherché pendant un moment la solution à cette requête SQL donc autant vous la faire partager.</p>
<p>Imaginons que vous ayez 3 tables sous MySQL :</p>
<ol>
<li><strong>walk</strong></li>
<li><strong>walk_photo</strong></li>
<li><strong>photo</strong></li>
</ol>
<p>Dans votre table <em><strong>photo</strong></em> certaines photos n&#8217;ont pas de titre (title) ou celui-ci est en NULL. Vous voulez donc faire un <strong>UPDATE</strong> de la table <em><strong>photo</strong></em> en associant les titres de la table <em><strong>walk</strong></em> correspondant aux photos.</p>
<p><span style="text-decoration: underline;"><strong>Problème :</strong></span> si vous n&#8217;aviez que 2 tables, cela ne poserait aucun problème car il suffirait de faire un UPDATE en joignant les 2 par un <strong>WHERE walk.id = photo.id</strong> . Or ici ce n&#8217;est pas possible car l&#8217;on a une table entre les deux (walk_photo) qui lie les 2 tables, les deux premières n&#8217;ayant pas de clé commune.</p>
<p>Donc voici la solution:</p>
<pre><strong>UPDATE photo
SET photo.title = walk.title
JOIN walk_photo ON walk_photo.photo = photo.id
JOIN walk ON walk.id = walk_photo.walk
WHERE photo.title IS NULL OR photo.title = ''</strong></pre>
<p>Je pense que la requête est assez claire pour être dispensé de commentaire, néanmoins pensez à mettre le <strong>SET</strong> <span style="text-decoration: underline;"><strong>avant</strong></span> la jointure! Sinon ça ne marchera pas! Au début j&#8217;avais commencé par faire ma jointure avant de faire le set et je ne comprenais pas pourquoi ça ne marchait pas&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.friendly-froggy.net/2010/03/24/sql-faire-un-update-avec-jointures-sur-plusieurs-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Faire un schéma de sa base de donnée: MySQL Workbench 5.1</title>
		<link>http://www.friendly-froggy.net/2010/01/21/faire-un-schema-de-sa-base-de-donnee-mysql-mysql-workbench-5-1/</link>
		<comments>http://www.friendly-froggy.net/2010/01/21/faire-un-schema-de-sa-base-de-donnee-mysql-mysql-workbench-5-1/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:48:22 +0000</pubDate>
		<dc:creator>PH</dc:creator>
				<category><![CDATA[Serveur]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Workbench]]></category>

		<guid isPermaLink="false">http://www.friendly-froggy.net/?p=583</guid>
		<description><![CDATA[Dans le cadre de mon stage on m&#8217;a montré un beau schéma de la base de donnée de l&#8217;un des sites internet de l&#8217;entreprise et ma première pensée, un tantinet primitive, fût: &#171;&#160;Quoi??!! C&#8217;est possible de faire ça??!! Trop coooool!!!! &#160;&#187; Ni une, ni deux, a peine rentré chez moi que je me mets à [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-585" title="MySQL Workbench Ubuntu" src="http://www.friendly-froggy.net/wp-content/uploads/2010/01/mysql-workbench.png" alt="mysql-workbench" width="544" height="160" /></p>
<p>Dans le cadre de mon stage on m&#8217;a montré un beau schéma de la base de donnée de l&#8217;un des sites internet de l&#8217;entreprise et ma première pensée, un tantinet primitive, fût: <strong>&laquo;&nbsp;Quoi??!! C&#8217;est possible de faire ça??!! Trop coooool!!!! <img src='http://www.friendly-froggy.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> &nbsp;&raquo;</strong></p>
<p>Ni une, ni deux, a peine rentré chez moi que je me mets à faire quelques recherche sur Google pour tomber sur <strong>MySQL Workbench</strong>. Aïe ça marche sous Linux ça?? Ben oui!!! <img src='http://www.friendly-froggy.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Après avoir installé le .deb <a title="MySQL Workbench 5.1 pour Ubuntu" href="http://www.friendly-froggy.net/wp-content/uploads/2010/01/mysql-workbench-oss-5.1.16-1-i386.deb">MySQL Workbench 5.1.16 (i386) </a>je me suis mis à faire un petit schéma d&#8217;une base sous <strong>Magento</strong> pour voir ce que ça donne (et c&#8217;est un joyeux bordel! :s).</p>
<p>Donc voici les explications en images une fois le paquet installé.</p>
<p>Tout d&#8217;abord se rendre dans: <strong>Applications</strong> =&gt; <strong>Programmation </strong>=&gt; <strong>MySQL Workbench</strong></p>
<p><span id="more-583"></span></p>
<p><a href="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture1.png"><img class="alignleft size-full wp-image-586" title="Capture" src="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture1.png" alt="Capture" width="691" height="432" /></a></p>
<p>Il vous faut ensuite cliquer sur: <strong>Database</strong> =&gt; <strong>Manage Connection</strong></p>
<p>Ensuite cliquez sur &laquo;&nbsp;New&nbsp;&raquo; pour rentrer une nouvelle connexion à un serveur MySQL. Dans mon exemple je suis en local, donc je rentre localhost (127.0.0.1), root en user et le mot de passe root.</p>
<p><a href="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-1.png"><img class="alignleft size-full wp-image-587" title="Capture-1" src="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-1.png" alt="Capture-1" width="691" height="432" /></a></p>
<p>Cliquez ensuite sur: <strong>Database</strong> =&gt; <strong>Reverse Engineer</strong></p>
<p>Ensuite selection la connextion crée précédement et cliquez sur Next</p>
<p><a href="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-2.png"><img class="alignleft size-full wp-image-588" title="Capture-2" src="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-2.png" alt="Capture-2" width="691" height="432" /></a></p>
<p>Choisissez ensuite la base pour laquelle vous voulez faire un schéma, puis Next (ici j&#8217;ai selectionné Joomla, mais en fait c&#8217;est Magento)</p>
<p><a href="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-3.png"><img class="alignleft size-full wp-image-589" title="Capture-3" src="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-3.png" alt="Capture-3" width="691" height="432" /></a></p>
<p>Et voila! Ici un petit zoom sur quelques tables</p>
<p><a href="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-4.png"><img class="alignleft size-full wp-image-590" title="Capture-4" src="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-4.png" alt="Capture-4" width="691" height="432" /></a></p>
<p>Et ici un dezoom sur l&#8217;ensemble des tables de Magento&#8230; bon courage pour s&#8217;y retrouver&#8230;.</p>
<p><a href="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-5.png"><img class="alignleft size-full wp-image-592" title="Capture-5" src="http://www.friendly-froggy.net/wp-content/uploads/2010/01/Capture-5.png" alt="Capture-5" width="691" height="432" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.friendly-froggy.net/2010/01/21/faire-un-schema-de-sa-base-de-donnee-mysql-mysql-workbench-5-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

