<?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>me talking out loud &#187; database</title>
	<atom:link href="http://www.khankennels.com/blog/index.php/archives/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.khankennels.com/blog</link>
	<description>Lig&#039;s accidentally overheard ramblings on MySQL/PHP and life in general</description>
	<lastBuildDate>Tue, 27 Jul 2010 15:20:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Attending Tampa Bay BarCamp</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2010/07/27/attending-tampa-bay-barcamp/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2010/07/27/attending-tampa-bay-barcamp/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 15:20:20 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/?p=736</guid>
		<description><![CDATA[I have never been to a barcamp so far &#8211; though I have been wanting to go. As far as I know my local Jacksonville doesn&#8217;t hold one so I have to go further out to try and find fellow geeks. Up until now I have either heard about the barcamps after they occur or [...]]]></description>
			<content:encoded><![CDATA[<p>I have never been to a barcamp so far &#8211; though I have been wanting to go.  As far as I know my local Jacksonville doesn&#8217;t hold one so I have to go further out to try and find fellow geeks.  Up until now  I have either heard about the barcamps after they occur or in the case of the <a href="http://www.barcamporlando.org/">Orlando</a> barcamp, it is during a major holiday weekend so&#8230; yeah family doesn&#8217;t like that.</p>
<p>I am currently planning to attend the <a href="http://barcamptampabay.org/">Tampa Barcamp</a> on the Dev day (Sept 26th) with my good friend <a href="http://daveyshafik.com/">Davey Shafik</a>.  And like a good camper (think that is the term they use), I have a few MySQL talks ready to present if the crowd wants/picks them for the schedule.  I am both excited and happy to finally be able to lose my complete n00b status and be able to say I have been to a barcamp!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2010/07/27/attending-tampa-bay-barcamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking at Zend Con 2010</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2010/06/25/speaking-at-zend-con-2010/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2010/06/25/speaking-at-zend-con-2010/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 17:59:37 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/?p=731</guid>
		<description><![CDATA[I am proud that I have been selected to speak again at the Zend Conference. I will again be speaking on MySQL topics including &#8216;MySQL Server Performance Tuning 101&#8242; and an &#8216;Intro to MySQL EXPLAIN&#8217;. I look forward to seeing everyone there!]]></description>
			<content:encoded><![CDATA[<p>I am proud that I have been selected to speak again at the <a href="http://www.zendcon.com/">Zend Conference</a>.  I will again be speaking on MySQL topics including &#8216;MySQL Server Performance Tuning 101&#8242; and an &#8216;Intro to MySQL EXPLAIN&#8217;.</p>
<p>I look forward to seeing everyone there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2010/06/25/speaking-at-zend-con-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Attending TekX</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2010/05/24/attending-tekx/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2010/05/24/attending-tekx/#comments</comments>
		<pubDate>Mon, 24 May 2010 18:04:23 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/?p=717</guid>
		<description><![CDATA[TekX was held last week and again it a fabulous conference. The conference started out with the typical day 0 &#8211; Tutorials Day. I only attended the MongoDB talk mostly to learn a bit about it. Kristina was a wonderful speaker who really knew her stuff. And as a MySQL geek, I have to admit [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tek.phparch.com/">TekX</a> was held last week and again it a fabulous conference.  </p>
<p>The conference started out with the typical day 0 &#8211; Tutorials Day.  I only attended the <a href="http://joind.in/talk/view/1567">MongoDB talk</a> mostly to learn a bit about it.  Kristina was a wonderful speaker who really knew her stuff.  And as a MySQL geek, I have to admit that it was interesting seeing seeing my world (RDBMS world) from a different perspective.  I even managed not to say a single thing throughout the entire talk though there were a couple of times the others I was with had fun laughing at me holding back.</p>
<p>The first actual day of the conference started out with <a href="http://www.joshholmes.com/blog/">Josh Holmes</a> keynote on <em><a href="http://joind.in/talk/view/1654">The Lost Art of Simplicity</a></em>.  It was a fabulous talk that forced me to find myself on the wrong side more then once.  </p>
<p>From there I went to <a href="http://eliw.com/">Eli White&#8217;s</a>  talk on <em><a href="http://joind.in/talk/view/1579">Anti-Spam and Anti-Gaming</a></em>.  The talk again was extremely interesting and some of his ideas would never of occurred to me.  Good thing we have Eli to teach me.</p>
<p>On to <a href="http://nerderati.com/">Joel Perras&#8217;s</a> talk on <em><a href="http://joind.in/talk/view/1582">Graphs, Edges, and Nodes</a></em>.  Again a fabulous talk, that I have to admit &#8211; lost me a bit.  But it is something I definitely want to learn more about.</p>
<p>From there to <em><a href="http://joind.in/talk/view/1571">Large Scale Systems</a></em> with <a href="http://fourkitchens.com/bios/david-strauss">David Strauss</a>.  This was one of the best talks I will be in at the conference. Learned lots &#8211; most of which I did not know enough to ask about&#8230; but I do now.</p>
<p>After that I kinda got into practicing for my own presentations and missed a lot in the actual sessions, but still enjoyed the hallway track.  I must admit that it has been quite a while since I attended that many sessions at a conference, and all of them top notch talks.</p>
<p>As for my own talks, I thought they went well and seem to be well received.  You can find the slides for my talks on my Presentations page.</p>
<p>So to wrap up I had a fabulous time at the conference, learning lots and hopefully teaching others stuff they did not know.  I can&#8217;t wait for next years.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2010/05/24/attending-tekx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jacksonville SQL Saturday</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2010/05/10/jacksonville-sql-saturday/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2010/05/10/jacksonville-sql-saturday/#comments</comments>
		<pubDate>Mon, 10 May 2010 02:17:22 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/?p=712</guid>
		<description><![CDATA[So this last Saturday I attended the local SQL Saturday event. I have to admit I was a little concerned about attending an event based around SQL Server. After all it is not my normal RDBMS and I have no connections into that community. But it was recommended to me by my friend Joe Healy [...]]]></description>
			<content:encoded><![CDATA[<p>So this last Saturday I attended the local<a href="http://www.sqlsaturday.com/38/eventhome.aspx"> SQL Saturday</a> event.  I have to admit I was a little concerned about attending an event based around SQL Server.  After all it is not my normal RDBMS and I have no connections into that community.  But it was recommended to me by my friend <a href="http://www.devfish.net/">Joe Healy</a> and we are all supposed to be geeks (unite!)  I mean WTH &#8211; a database is a database so I shouldn&#8217;t be completely lost.  So why not go and get the lay of the land, maybe learn something new and meet a few interesting people.  </p>
<p>So off I go &#8211; totally clueless and completely unprepared since I figure &#8211; hey I&#8217;m just an attendee.  And yes &#8211; I go from bad to worse.  </p>
<p>So off to <a href="http://www.unf.edu/">UNF</a> I go.  AFAIK SQL Saturday is going to be held in the <a href="http://www.unf.edu/ccec/cis/">College of Computing &#038; Engineering</a>  &#8211; hey my old alma mater &#8211; cool!  Never mind that it has been 8 years since I was on campus, I know my way around right?!  Wrong <img src='http://www.khankennels.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />   </p>
<p>I got completely lost since almost all the old parking lots are gone and the ones that are still there are designated parking only&#8230; and did I mention that the event is in building 50?  Yeah &#8211; well, that building wasn&#8217;t around when I attended UNF so I then proceeded to get confused because it was a different building then the one I attended. All told I spent about 15-20 minutes being lost and befuddled.  Should have given me a clue what an idiot I was being.</p>
<p>I eventually find my way there, check in and grab a free donut and coffee (Dunkin&#8217; donuts &#8211; Mmm).  The place is just starting to get busy so I kinda meander around watching.  I have to admit that in new situations I like to people watch.</p>
<p>First thing I noticed was that this crowd while similar to a crowd I would see at an open source conference &#8211; was also distinctly different.  The crowd seemed to be older (more my own age rather then younger then me) with a *lot* more women attending then I expected (easily twice to maybe 3 times as many women around then I would see at an OS conference) and very few people had a laptop with them.  It kinda threw me there &#8211; in a rather good way.</p>
<p>I hang out a bit outside and chat a bit with various people.  Once they find out I work for <a href="http://www.oracle.com/us/products/mysql/index.html">MySQL/Oracle</a>, I of course get the requisite &#8220;Dark Side&#8221; joke and I try to refrain from commenting that <a href="http://www.whatonearthcatalog.com/graphics/products/regular/AX9602.jpg">&#8220;we have cookies&#8221;</a>.</p>
<p>I eventually make my way to my first session &#8211; <a href="http://www.sqlsaturday.com/viewsession.aspx?sat=38&#038;sessionid=1213">SQL University 101: Starting the SQL Journey</a>  I have to say it &#8211; it was a great session.  It provided a nice intro into the SQL Server world that was both intro and technical enough to keep me occupied for the whole class&#8230; I even won a poster for knowing what SQL stood for.</p>
<p>Next I attended the <a href="http://www.sqlsaturday.com/viewsession.aspx?sat=38&#038;sessionid=1421">T-SQL 102: Aliases and Table Joins</a> talk figuring it would cover anything interesting on how SQL Server handles JOINs (indexing techniques, what kind of index it uses, optimization techniques, etc.).  Well it turns out it was more like a basic intro to writing SQL JOINs so not that interesting for me.  What I did find humorous when I first noticed it was that the instructor used Venn Diagrams to explain JOINs&#8230; which is something I have <a href="http://www.khankennels.com/blog/index.php/archives/2007/04/20/getting-joins/">posted on in the past</a>.  </p>
<p>Now at the time of my Venn diagram post, AFAIK I was the only one who thought of them that way.  (Turns out I am not &#8211; the instructor stated they first came across the idea back in 2000.)  I (being the arrogant POS that I am) wondered if the instructor had somehow come across that information and was using it in their presentation.  (Have I mentioned I am a complete idiot most days.)  I tried to speak with the instructor for a brief while on the subject and ended up making a total and complete fool of myself with them (someone write a big &#8220;L&#8221; on my forehead).</p>
<p>So I officially would like to 1) apologize to the instructor for giggling in their class.  I am an idiot. 2) apologize for just being an arrogant sh*t.  I really do try and keep that under control.  I am sorry and I have no excuse.  </p>
<p>After that I took a walk around campus for a while.  As I said it has been 8 years since I was on campus and so much had changed.  I actually was lost until I finally got my bearings finding old landmarks.  It was nice being back.</p>
<p>So during lunch I sat in on a couple of mini-sessions.  One on becoming a DBA and the other on networking at technical events.  Both were very good covering areas that to me are similar in the open source world.  One thing I did find interesting is that neither of the instructors discussed participation in open source projects &#8211; even if it is on <a href="http://www.codeplex.com/">CodePlex</a> &#8211; Microsoft&#8217;s open source portal.  </p>
<p>I am unsure if it is simply not a known conduit for the SQL Server community, or if the culture of the community does not push it the way that, obviously, the open source community would.  That would be an interesting discussion to have one day.</p>
<p>The final session I attended was the <a href="http://www.sqlsaturday.com/viewsession.aspx?sat=38&#038;sessionid=1120">Introduction to Data Warehousing</a> talk.  Again it was a very good talk that covered general concepts as well as SQL Server specific tools.  I particularly enjoyed the discussion on design of a data warehouse and the general patterns of them &#8211; star and snowflake.  The examples given and discussed were easy to understand and follow even though the terminology I am most familiar with was slightly different.</p>
<p>Relatively soon after the end of that session I left to go home and be with the family (it was the day before Mother&#8217;s Day after all).  </p>
<p>I had a fabulous time at SQL Saturday and if I had a complaint about anything it would have to be the network (of course).  Because I have Skype on my machine I was quarantined/locked out of the network a number of times so my connection was intermittent at best.</p>
<p>Now that I have had a chance to see the SQL Server community I have to admit I plan to try and get to a Jacksonville SQL Server User Group meeting some time in the near future if I can.  It is always nice to learn new stuff about databases&#8230; Don&#8217;t get me wrong &#8211; I love my RDBMS and plan to stay here a long time but being &#8220;the n00b&#8221; and adding more tools to my toolbox is not a bad place to be.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2010/05/10/jacksonville-sql-saturday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking at TekX</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2010/03/30/speaking-at-tekx/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2010/03/30/speaking-at-tekx/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 13:50:44 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/?p=703</guid>
		<description><![CDATA[I have been lucky enough (or found the right bribe) to be selected to speak at this years TekX conference up in Chicago. I have to admit, they have a fantastic lineup again this year and can&#8217;t wait to get there to see old friends and make new ones. Every year I go it just [...]]]></description>
			<content:encoded><![CDATA[<p>I have been lucky enough (or found the right bribe) to be selected to speak at this years <a href="http://tek.phparch.com/">TekX</a> conference up in Chicago.  I have to admit, they have a fantastic lineup again this year and can&#8217;t wait to get there to see old friends and make new ones.  Every year I go it just gets better.</p>
<p>The conference this year will be held from May 18-21 at the <a href="http://www.starwoodhotels.com/sheraton/search/hotel_detail.html?propertyID=40">Sheraton Gateway Suites O’Hare</a>  (same as the past couple of years).  If you have already been to the conference, you already know about playing Tek frogger &#8211; and if you don&#8217;t or this is your first conference &#8211; be sure to find me at the conference so we can discuss it as we sit and have a drink at &#8220;Shirtless Slim&#8217;s&#8221;.</p>
<p>For those that are interested I will be giving 2 talks on MySQL this year.  One will be an <a href="http://tek.phparch.com/talks#TEKXS06">introduction to MySQL replication</a> and the other will go over the <a href="http://tek.phparch.com/talks#TEKXS18">new features found in MySQL 5.5</a>.  Both are new talks for me, so I am rather excited about speaking on the subjects and would love feedback.</p>
<p>I hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2010/03/30/speaking-at-tekx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing MySQL on Mac 10.5</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2008/04/21/installing-mysql-on-mac-105/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2008/04/21/installing-mysql-on-mac-105/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 21:21:40 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/index.php/archives/2008/04/21/installing-mysql-on-mac-105/</guid>
		<description><![CDATA[Ok &#8211; I had to install MySQL on my Mac for the first time &#8211; using a tar of the binaries none the less. And it has been interesting. These are notes mostly for myself but if others find them helpful &#8211; great. instructions I used &#8211; http://dev.mysql.com/doc/refman/5.0/en/installing-binary.html to create a group in 10.5 &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Ok &#8211; I had to install MySQL on my Mac for the first time &#8211; using a tar of the binaries none the less.  And it has been interesting.  These are notes mostly for myself but if others find them helpful &#8211; great.</p>
<ol>
<li>instructions I used &#8211; http://dev.mysql.com/doc/refman/5.0/en/installing-binary.html</li>
<li>to create a group in 10.5 &#8211; use dscl.  In my case &#8216;dscl . -create /groups/mysql&#8217;</li>
<li>to create a user in 10.5 &#8211; again use dscl.  &#8216;dscl .-create /Users/mysql&#8217;</li>
<li>I had to make /usr/local with mkdir -m 775</li>
<li>I did not have to decompress things since the Mac did it for me &#8211; but I did have to place it in my Library dir and make the ln to it in my /usr/local dir</li>
<li>DO NOT FORGET to give your root user a password and either drop the anonymous user or put a password on it!</li>
</ol>
<p>Other notables (yes I am a server noob):</p>
<ul>
<li>start the deamon with &#8216;sudo bin/mysqld_safe &#8211;user=mysql &#038;&#8217;</li>
<li>If you forget the ampersand at the end &#8211; use cntl+z to escape then use &#8216;bg&#8217; to put the deamon in the background</li>
<li>stop the deamon with &#8216;bin/mysqladmin -u root shutdown&#8217;</li>
</ul>
<p>Other notes to self on having multiple versions available:</p>
<ol>
<li>option 1 &#8211; have multiple binary installs in their own folders and just change the ln.. or have multiple ln with individual names.  since I do not need to have all of them running at one time &#8211; I can start and stop the deamons as I need.</li>
<li>option 2 &#8211;  is provided in the manual at http://dev.mysql.com/doc/refman/5.0/en/multiple-servers.html</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2008/04/21/installing-mysql-on-mac-105/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>MySQL &#8211; here I come</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2008/04/03/mysql-here-i-come/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2008/04/03/mysql-here-i-come/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 01:46:25 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/index.php/archives/2008/04/03/mysql-here-i-come/</guid>
		<description><![CDATA[I am pleased and proud to say that come Monday &#8211; I will be working for MySQL (*sigh* &#8211; Ok Sun). I will be working for a Dream Company of mine &#8211; doing a Dream Job. Life does not get better then that. So to everyone who kept telling me I would get the job [...]]]></description>
			<content:encoded><![CDATA[<p>I am pleased and proud to say that come Monday &#8211; I will be working for <a href="http://www.mysql.com">MySQL</a> (*sigh* &#8211; Ok Sun).  I will be working for a Dream Company of mine &#8211; doing a Dream Job.  Life does not get better then that.</p>
<p>So to everyone who kept telling me I would get the job when I swore there was no way (you know who you are) &#8211; feel free to tell me &#8220;I told you so&#8221; next time we talk &#8211; and first beer is on me when we meet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2008/04/03/mysql-here-i-come/feed/</wfw:commentRss>
		<slash:comments>68</slash:comments>
		</item>
		<item>
		<title>back in the saddle again</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2008/03/24/back-in-the-saddle-again/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2008/03/24/back-in-the-saddle-again/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 19:54:38 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/index.php/archives/2008/03/24/back-in-the-saddle-again/</guid>
		<description><![CDATA[It has been a really long time since I wrote anything &#8211; luckily the folks at phparchitect gave me just the push I needed to get back to my writing. Took me a while to get back in the hang of it again &#8211; but I did it &#8211; and even finished by my deadline [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a really long time since I wrote anything &#8211; luckily the folks at <a href="http://phparch.com/">phparchitect</a> gave me just the push I needed to get back to my writing.  Took me a while to get back in the hang of it again &#8211; but I did it &#8211; and even finished by my deadline (even if it was turned in a day late).</p>
<p>So if you feel the need to learn a bit more about foreign keys and what they can do for you the coder &#8211; be sure to check out <a href="http://c7y.phparch.com/c/entry/1/art,foreign_keys_in_mysql">my article</a> on them at <a href="http://c7y.phparch.com/">c7y</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2008/03/24/back-in-the-saddle-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Getting&#8221; Joins</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2007/04/20/getting-joins/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2007/04/20/getting-joins/#comments</comments>
		<pubDate>Fri, 20 Apr 2007 06:01:29 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/index.php/archives/2007/04/20/getting-joins/</guid>
		<description><![CDATA[NOTE: I highly recommend people read the Coding Horror extension of my post. I wrote this up as a quick and dirty cheat for a friend. Coding Horror actually takes his time with the subject and gives it a better explanation. I was asked to post this after explaining it to someone on IRC. If [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>NOTE:</strong> I highly recommend people read the <a href="http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html">Coding Horror extension </a>of my post.  I wrote this up as a quick and dirty cheat for a friend.  Coding Horror actually takes his time with the subject and gives it a better explanation.</em></p>
<p>I was asked to post this after explaining it to someone on IRC.</p>
<p>If you have tried to understand how joins work and constantly get confused about what join to use,  you just need to keep a simple picture in mind ( I like pictures). I will be explaining joins by referencing a Venn diagram.  Have no fear &#8211; I won&#8217;t get into any of the set theory/math involved.  This is just a basic overview to give you an idea the data a particular join will return to you.  This is not a technical discussion &#8211; just concepts.</p>
<p>We will start with just an empty diagram:<br />
<img id="image463" src="http://www.khankennels.com/blog/wp-content/uploads/2007/04/basicvenn.png" alt="basicvenn.thumbnail.png" /></p>
<p>The T1 circle represents all the records in table 1. The T2 circle represents all the records in table 2.  Notice how there is a bit of overlap of the 2 circles in the middle. Simple right?</p>
<p>I will use red to signify the records that will be returned by a particular join.</p>
<p><strong>INNER JOIN</strong><br />
An inner join only returns those records that have &#8220;matches&#8221; in both tables.  So for every record returned in T1 &#8211; you will also get the record linked by the foreign key in T2. In programming logic &#8211; think in terms of AND.</p>
<p><img id="image465" src="http://www.khankennels.com/blog/wp-content/uploads/2007/04/venn1.png" alt="venn1.thumbnail.png" /></p>
<p><strong>OUTER JOIN</strong><br />
An outer join is the inverse of the inner join.  It only returns those records not in T1 and T2.  &#8220;Give me the records that DON&#8217;T have a match.&#8221; In programming logic &#8211; think in terms of NOT AND.</p>
<p><img id="image460" src="http://www.khankennels.com/blog/wp-content/uploads/2007/04/outervenn.png" alt="outervenn.thumbnail.png" /></p>
<p><strong>LEFT JOIN</strong><br />
A left join returns all the records in the &#8220;left&#8221; table (T1) whether they have a match in the right table or not.  </p>
<p>If, however,  they do have a match in the right table &#8211; give me the &#8220;matching&#8221; data from the right table as well.  If not &#8211; fill in the holes with null.</p>
<p><img id="image462" src="http://www.khankennels.com/blog/wp-content/uploads/2007/04/left_venn.png" alt="left_venn.thumbnail.png" /></p>
<p>It should be noted that the same thing is possible with a right join &#8211; most people just use a left one.</p>
<p><strong>LEFT OUTER JOIN</strong><br />
A left outer join combines the ideas behind a left join and an outer join.  Basically &#8211; if you use a left outer join you will get the records in the left table that DO NOT have a match in the right table.</p>
<p><img id="image461" src="http://www.khankennels.com/blog/wp-content/uploads/2007/04/leftOutervenn.png" alt="leftOutervenn.thumbnail.png" /></p>
<p>Again it is noted that the same thing is possible with a right outer join &#8211; most people just use a left one.</p>
<p><strong>Theta JOIN</strong><br />
A theta join is the Cartesian product of the 2 tables and not normally what people are looking for &#8211; but what they sometimes get by mistake.  How many of us have written a join similar to this only to get way more then we were ever expecting.<br />
<code><br />
SELECT t1.*, t2.*<br />
   FROM table1 t1, table2 t2<br />
   WHERE t1.id = 5;<br />
</code></p>
<p><img id="image459" src="http://www.khankennels.com/blog/wp-content/uploads/2007/04/thetavenn.png" alt="thetavenn.thumbnail.png" /> </p>
<p>So there you have the basic concepts of joins.  Next time you need to use a join and have no clue what to do to get the data you need from the database, draw a picture.  It may help you figure out what join to use.  Least it helps me.</p>
<p><strong>Important:</strong>Please be sure to read the comments below.  There are definite situations where my simplistic drawings are invalid and brought to light.</p>
<p><strong>Disclaimer</strong>: I am by no means a database guru.  Please be sure to learn more about joins from the many online articles available.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2007/04/20/getting-joins/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MySQL User Defined Functions</title>
		<link>http://www.khankennels.com/blog/index.php/archives/2006/09/23/mysql-user-defined-functions/</link>
		<comments>http://www.khankennels.com/blog/index.php/archives/2006/09/23/mysql-user-defined-functions/#comments</comments>
		<pubDate>Sat, 23 Sep 2006 02:20:51 +0000</pubDate>
		<dc:creator>lig</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.khankennels.com/blog/index.php/archives/2006/09/23/mysql-user-defined-functions/</guid>
		<description><![CDATA[MySQL User Defined Functions Did you know you could make custom functions for use in your SQL queries? You could make an entire library of custom functions to work and manipulate your data on your database making them application and language independant. A few possible functions you could make &#8211; Calculate an Employee&#8217;s Accumulated Vacation [...]]]></description>
			<content:encoded><![CDATA[<h1>MySQL User Defined Functions</h1>
<p>Did you know you could make custom functions for use in your SQL queries?  You could make an entire library of custom functions to work and manipulate your data on your database making them application and language independant.  A few possible functions you could make &#8211; </p>
<ul>
<li>Calculate an Employee&#8217;s Accumulated Vacation Time &#8211; maybe pass in the Employee ID and return the number of Hours they have in vacation time available.</li>
<li>Customer Address &#8211; Pass in the Customer ID or name and return their mailing address in a standardized format.</li>
<li>Account Balance &#8211; Pass in the Account number and return the Current Balance (assuming you have a table of debits and credits)</li>
</ul>
<p>So now you would not have to worry about doing the calculations in the application &#8211; you can leave it to the database.  Pretty Cool.</p>
<p>MySQL&#8217;s user defined function syntax is very similar to stored procedures and kinda self explainatory.  Below is a simple example.</p>
<h3>Example</h3>
<pre>
mysql> CREATE FUNCTION isOdd(value INT) RETURNS TINYINT
    -> RETURN value%2;
Query OK, 0 rows affected (0.19 sec)
</pre>
<p>This is example of a user defined function simply tells us TRUE(1) or FALSE(0) if a number we pass to it is odd.</p>
<p><i>Create</i></p>
<pre>
mysql> CREATE FUNCTION isOdd(value INT) RETURNS TINYINT
</pre>
<p>This line states that we are going to create a user defined function by the name of isOdd.  The function isOdd will take in an integer that we will call value, and return out a tinyint.  Makes sense when we say it like that, but can you point to all the parts?  As we said &#8211; it is similar to a stored procedure that you feel like you should know it &#8211; but syntatically different enough that you can trip and fall a couple of timesif you don&#8217;t pay attention.</p>
<p><i>Return</i></p>
<pre>
    -> RETURN value%2;
Query OK, 0 rows affected (0.19 sec)
</pre>
<p>Here is where we actually calculate what to return and then return that value, just like in a PHP user defined function.</p>
<p><i>Usage</i></p>
<pre>
mysql> select isOdd(13);
+-----------+
| isOdd(13) |
+-----------+
|         1 |
+-----------+
1 row in set (0.00 sec)

mysql> select isOdd(14);
+-----------+
| isOdd(14) |
+-----------+
|         0 |
+-----------+
1 row in set (0.00 sec)
</pre>
<p>Here we demonstrate how we can now use the newly created user defined function in a standard SQL statement.  These SQL statements could have been sent from the developers application just like any other MySQL function.  Again we made sure to do some basic testing of the function.</p>
<p>Right about now I guess I should note that this is a very simple example and that all the logical controls and looping functions that are available to stored procedures do work in stored user defined functions as well.  You can make the functions as simple or complex as you need.</p>
<p>So there you have it.  Now go &#8211; and create your own functions to use in MySQL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.khankennels.com/blog/index.php/archives/2006/09/23/mysql-user-defined-functions/feed/</wfw:commentRss>
		<slash:comments>76</slash:comments>
		</item>
	</channel>
</rss>
