<?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>Paul Brunt &#187; query</title>
	<atom:link href="http://www.paulbrunt.co.uk/tag/query/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paulbrunt.co.uk</link>
	<description>faster, better; faster, better!</description>
	<lastBuildDate>Sun, 24 Jan 2010 13:57:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MySQL Hints and Tips</title>
		<link>http://www.paulbrunt.co.uk/2008/09/13/mysql-hints-and-tips/</link>
		<comments>http://www.paulbrunt.co.uk/2008/09/13/mysql-hints-and-tips/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 12:15:05 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Programing]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.paulbrunt.co.uk/?p=74</guid>
		<description><![CDATA[MySQL linking a table to itself.
To link a table to itself you simply have to use alias names on the tables, ie:
select * from table as a left join table as b on a.field=b.otherfield;
et viola you have a table linking to itself.
Retrieve the query to recreate a table
This query is very useful when you just [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MySQL linking a table to itself.</strong><br />
To link a table to itself you simply have to use alias names on the tables, ie:<br />
<em>select * from table as a left join table as b on a.field=b.otherfield;</em><br />
et viola you have a table linking to itself.<span id="more-74"></span></p>
<p><strong>Retrieve the query to recreate a table</strong><br />
This query is very useful when you just want to quickly copy a table structure from one place to another.<br />
<em>SHOW CREATE TABLE {tablename}</em></p>
<p><strong>Get the list of tables in a database</strong><br />
I personally don&#8217;t use this one very often but when your stuck with the command line to access your database it proves very useful:<br />
<em>SHOW TABLES</em></p>
<p><strong>Get back wasted space</strong><br />
If like me your host only offers a limited amount of space for you DB this is very useful.  When you delete rows from MySQL it doesn&#8217;t automatically reclaim the space and instead just marks the row as deleted. Do clean out your tables and reclaim that space simply use this query:<br />
<em>OPTIMIZE TABLE</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbrunt.co.uk/2008/09/13/mysql-hints-and-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
