<?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>tomiryu.com &#187; Database</title>
	<atom:link href="http://www-en.tomiryu.com/topics/database/feed/" rel="self" type="application/rss+xml" />
	<link>https://www-en.tomiryu.com</link>
	<description>If you always do what you have always done.</description>
	<lastBuildDate>Thu, 05 Jun 2014 12:45:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Sample SQL &#8211; Columns Information</title>
		<link>https://www-en.tomiryu.com/database/sample-sql-columns-information/</link>
		<comments>https://www-en.tomiryu.com/database/sample-sql-columns-information/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 07:45:39 +0000</pubDate>
		<dc:creator>tomiryu</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">https://www-en.tomiryu.com/?p=87</guid>
		<description><![CDATA[Here is a sample of SQL that queries table column&#8217;s information. Please change the part of &#60;table_name&#62; into the actual table name. In the case of MY_SQL select c.table_name,c.column_name , c.is_nullable, column_type from information_schema.columns c where table_name='&#60;table_name&#62;' order by ordinal_position &#8230; <a href="https://www-en.tomiryu.com/database/sample-sql-columns-information/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a sample of SQL that queries table column&#8217;s information.<br />
Please change the part of &lt;table_name&gt; into the actual table name.<span id="more-87"></span></p>
<p><strong>In the case of MY_SQL</strong></p>
<pre>select c.table_name,c.column_name , c.is_nullable, column_type
from information_schema.columns c
where table_name='&lt;table_name&gt;' order by ordinal_position
</pre>
<p><strong>In the case of Postgresql</strong></p>
<pre>SELECT  relname,attname,typname,case typname
                when 'timestamp' then 14
                when 'numeric' then (atttypmod - 4) / 65536
                else atttypmod-4
                end as len
                ,case attnotnull
                when 't' then 'not null'
                else '' end as attnotnull
          FROM    pg_class,pg_attribute,pg_type
          WHERE   relkind     ='r'
          AND relname     ='&lt;table_name&gt;'
          AND pg_class.oid = pg_attribute.attrelid
          AND attnum      &gt; 0
          AND pg_type.oid = atttypid
          order by attnum
</pre>
]]></content:encoded>
			<wfw:commentRss>https://www-en.tomiryu.com/database/sample-sql-columns-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
