<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Geek Mama &#187; SQL</title>
	<atom:link href="http://blogs.law.harvard.edu/lianaleahy/category/professional/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.law.harvard.edu/lianaleahy</link>
	<description>exploits of a mom on rails</description>
	<lastBuildDate>Wed, 25 Nov 2009 18:11:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
		<item>
		<title>Select Into</title>
		<link>http://blogs.law.harvard.edu/lianaleahy/2009/11/12/select-into/</link>
		<comments>http://blogs.law.harvard.edu/lianaleahy/2009/11/12/select-into/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 15:57:34 +0000</pubDate>
		<dc:creator>lianaleahy</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blogs.law.harvard.edu/lianaleahy/?p=327</guid>
		<description><![CDATA[This post is more a placeholder for some SQL that I often need.  It&#8217;s common to want to copy the contents of one table into another.  While there are some guis out there that will do this for you, they often don&#8217;t allow you to select partial contents or a variety of extras that [...]]]></description>
			<content:encoded><![CDATA[<p>This post is more a placeholder for some SQL that I often need.  It&#8217;s common to want to copy the contents of one table into another.  While there are some guis out there that will do this for you, they often don&#8217;t allow you to select partial contents or a variety of extras that you may need.</p>
<p>What annoys me about having worked with numerous flavors of SQL and databases is that the syntax tends to differ slightly.  On some dbs, this works just fine:</p>
<p><code>select *<br />
into table1<br />
from table2<br />
where id = 1<br />
</code></p>
<p>But some dbs expect that table2 is some sort of variable rather than another table containing the same columns.  So on others (like MySQL), you need to do it this way:<br />
<code><br />
insert into table1<br />
select *<br />
from table2<br />
where id = 1</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.law.harvard.edu/lianaleahy/2009/11/12/select-into/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>How to convert your MySQL table to accept UTF8 charactersets</title>
		<link>http://blogs.law.harvard.edu/lianaleahy/2009/10/19/how-to-convert-your-mysql-table-to-accept-utf8-charactersets/</link>
		<comments>http://blogs.law.harvard.edu/lianaleahy/2009/10/19/how-to-convert-your-mysql-table-to-accept-utf8-charactersets/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 18:40:09 +0000</pubDate>
		<dc:creator>lianaleahy</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blogs.law.harvard.edu/lianaleahy/?p=274</guid>
		<description><![CDATA[Getting &#8220;????&#8221; in your database rather than your Arabic or Chinese character sets?  Try this:
 ALTER TABLE contents CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; 
]]></description>
			<content:encoded><![CDATA[<p>Getting &#8220;????&#8221; in your database rather than your Arabic or Chinese character sets?  Try this:</p>
<p><code> ALTER TABLE contents CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; </code></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.law.harvard.edu/lianaleahy/2009/10/19/how-to-convert-your-mysql-table-to-accept-utf8-charactersets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Remove Duplicate Rows</title>
		<link>http://blogs.law.harvard.edu/lianaleahy/2008/06/12/remove-duplicate-rows/</link>
		<comments>http://blogs.law.harvard.edu/lianaleahy/2008/06/12/remove-duplicate-rows/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 14:43:05 +0000</pubDate>
		<dc:creator>lianaleahy</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blogs.law.harvard.edu/lianaleahy/?p=19</guid>
		<description><![CDATA[I often find the need to check for duplicates in the database.  This is not an intuitive SQL command to create off the top of your head as it involves Group By and the rarely used Having clause.  Since I&#8217;m always looking it up, I thought I&#8217;d post it here.
The code below will [...]]]></description>
			<content:encoded><![CDATA[<p>I often find the need to check for duplicates in the database.  This is not an intuitive SQL command to create off the top of your head as it involves <strong>Group By</strong> and the rarely used <strong>Having</strong> clause.  Since I&#8217;m always looking it up, I thought I&#8217;d post it here.</p>
<p>The code below will identify which rows have duplicate values based upon two primary key columns:</p>
<p><code>SELECT col1, col2, count(*)<br />
FROM t1<br />
GROUP BY col1, col2<br />
HAVING count(*) &gt; 1<br />
</code></p>
<p>If you need to go a step further and remove duplicate rows, there&#8217;s a great Microsoft blog article that will walk you through the process:</p>
<p><a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;139444">How to remove duplicate rows from a table in SQL Server</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.law.harvard.edu/lianaleahy/2008/06/12/remove-duplicate-rows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>
