<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://sqlzoo.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://sqlzoo.net/w/index.php?title=Finding_a_substring_in_a_string&amp;feed=atom&amp;action=history</id>
		<title>Finding a substring in a string - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://sqlzoo.net/w/index.php?title=Finding_a_substring_in_a_string&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Finding_a_substring_in_a_string&amp;action=history"/>
		<updated>2013-05-20T08:21:08Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.4</generator>

	<entry>
		<id>http://sqlzoo.net/w/index.php?title=Finding_a_substring_in_a_string&amp;diff=1530&amp;oldid=prev</id>
		<title>Connor: Created page with &quot;Finding a substring in a string &lt;div class='ht'&gt; &lt;div class=params&gt;schema:gisq&lt;/div&gt; &lt;div&gt; Here we extract the first word of a country name.  INSTR gives this position of one ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Finding_a_substring_in_a_string&amp;diff=1530&amp;oldid=prev"/>
				<updated>2012-07-17T14:42:51Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Finding a substring in a string &amp;lt;div class=&amp;#039;ht&amp;#039;&amp;gt; &amp;lt;div class=params&amp;gt;schema:gisq&amp;lt;/div&amp;gt; &amp;lt;div&amp;gt; Here we extract the first word of a country name.  INSTR gives this position of one ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Finding a substring in a string&lt;br /&gt;
&amp;lt;div class='ht'&amp;gt;&lt;br /&gt;
&amp;lt;div class=params&amp;gt;schema:gisq&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
Here we extract the first word of a country name. &lt;br /&gt;
INSTR gives this position of one string within another, we use this and substring to pick out the first few characters.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='tidy'&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='setup'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sqlite'&amp;gt;SELECT name,&lt;br /&gt;
       POSITION(' ' IN name),&lt;br /&gt;
       SUBSTRING(name FROM 1 FOR POSITION(' ' IN name))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-db2'&amp;gt;SELECT name,&lt;br /&gt;
       POSITION(' ' IN name),&lt;br /&gt;
       SUBSTRING(name FROM 1 FOR POSITION(' ' IN name))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-ingres'&amp;gt;SELECT name,&lt;br /&gt;
       POSITION(' ' IN name),&lt;br /&gt;
       SUBSTRING(name FROM 1 FOR POSITION(' ' IN name))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-access'&amp;gt;SELECT name,&lt;br /&gt;
       INSTR(name, ' '),&lt;br /&gt;
       SUBSTRING(name,1,INSTR(name,' '))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-postgres'&amp;gt;SELECT name,&lt;br /&gt;
       POSITION(' ' IN name),&lt;br /&gt;
       SUBSTRING(name FROM 1 FOR POSITION(' ' IN name))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-oracle'&amp;gt;SELECT name,&lt;br /&gt;
       INSTR(name, ' '),&lt;br /&gt;
       SUBSTR(name,1,INSTR(name,' '))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;SELECT name,&lt;br /&gt;
     CHARINDEX(' ',name),&lt;br /&gt;
     SUBSTRING(name,1,CHARINDEX(' ',name)-1)&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-mysql'&amp;gt;SELECT name,&lt;br /&gt;
       POSITION(' ' IN name),&lt;br /&gt;
       SUBSTRING(name FROM 1 FOR POSITION(' ' IN name))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-mimer'&amp;gt;SELECT name,&lt;br /&gt;
       POSITION(' ' IN name),&lt;br /&gt;
       SUBSTRING(name FROM 1 FOR POSITION(' ' IN name))&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sybase'&amp;gt;SELECT name,&lt;br /&gt;
     CHARINDEX(' ',name),&lt;br /&gt;
     SUBSTRING(name,1,CHARINDEX(' ',name)-1)&lt;br /&gt;
  FROM bbc&lt;br /&gt;
  WHERE name LIKE '% %'&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-sqlserver&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;CHARINDEX gives the position, see also PATINDEX&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-oracle&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{Functions ref}}&lt;/div&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	</feed>