<?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>JSP, Tomcat, JDBC, Projects, Example, Program &#187; SQL</title>
	<atom:link href="http://www.easywayserver.com/blog/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.easywayserver.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 04 Jun 2011 05:32:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Store Procedure in Oracle</title>
		<link>http://www.easywayserver.com/blog/store-procedure-in-oracle/</link>
		<comments>http://www.easywayserver.com/blog/store-procedure-in-oracle/#comments</comments>
		<pubDate>Sun, 15 May 2011 07:26:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=735</guid>
		<description><![CDATA[Store Procedure in Oracle
By: Pankaj Yadav
 Store procedures are the sub programs used to perform some actions. Mainly a procedure has two parts Specification and body .The Procedure is created with Create and ends with  end procedure. The body of the store procedure stats after the IS or AS. 
The Uses of procedures
 1. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fstore-procedure-in-oracle%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fstore-procedure-in-oracle%2F" height="61" width="51" /></a></div><p><strong>Store Procedure in Oracle</strong></p>
<p>By: Pankaj Yadav</p>
<p> Store procedures are the sub programs used to perform some actions. Mainly a procedure has two parts Specification and body .The Procedure is created with Create and ends with  end procedure. The body of the store procedure stats after the IS or AS. </p>
<p>The Uses of procedures</p>
<p> 1. They help us to make program in small manageable parts.</p>
<p> 2. They make the code reusable</p>
<p> 3. They help us to meet our need</p>
<p><strong>syntax:</strong></p>
<pre  class="brush: sql">
Create or replace Procedure [procedure name](Parameter1 [mode] <data type>,..)
As
{Local variable declaration}
Begin
{Procedure statements}
end {procedure name}
</pre>
<p><i> Note: Replace is used if the procedure exists previously, replace it with the new one</i></p>
<p><strong>Modes of Parameters :</strong></p>
<p> There are 3 modes of parameters in store procedure. They are as follows</p>
<p><strong>IN </strong>mode parameter is used to pass the value to the called procedure and in program it acts like constant</p>
<p><strong>OUT</strong> mode parameter allows us to return the values from store procedure. In a store procedure the OUT parameter s are act like uninitialized parameters. So we cannot assign value to these</p>
<p><strong>INOUT</strong> mode parameters allow both to return the value from subprogram</P></p>
<p><P>We Can execute a store procedure with the keyword ‘exec’</p>
<p>syntax for executing store procedure :</p>
<pre  class="brush: sql">
exec  {Procedure name}(Parameters)
</pre>
<p><strong>Example:</strong></p>
<pre  class="brush: sql">
create procedure minno(firstno in Number, secondno in Number)
returning integer;
 if (firstno < secondno) then
  return firstno;
 else
  return secondno;
 end if;
end minno
</pre>
<p> if we execute this procedure </p>
<pre  class="brush: sql">
exec  minno(20,10)
</pre>
<p>Output will be</p>
<p><i>10</i></p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/data-types-in-java/" rel="bookmark" class="crp_title">Data Types in Java</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-class-examples/" rel="bookmark" class="crp_title">Java Class Examples</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-control-statements/" rel="bookmark" class="crp_title">Java Control Statements</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-methods-example/" rel="bookmark" class="crp_title">JAVA Methods Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/properties-in-java/" rel="bookmark" class="crp_title">Properties in JAVA</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-oop-concept/" rel="bookmark" class="crp_title">Java OOP Concept</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/store-procedure-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Joins in Oracle</title>
		<link>http://www.easywayserver.com/blog/sql-joins-in-oracle/</link>
		<comments>http://www.easywayserver.com/blog/sql-joins-in-oracle/#comments</comments>
		<pubDate>Sun, 01 May 2011 06:49:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=701</guid>
		<description><![CDATA[By: Pankaj Yadav
Oracle Join is basically used when we want to see the data from two or more tables at a same time. The data of the table got merged with the other table having a same column.
Joining Tables using Oracle Syntax
&#160;

SELECT table1.column, table2.column
FROM table1, table2
WHERE table1.column1 = table2.column2;

Use a join to query data from [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-joins-in-oracle%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-joins-in-oracle%2F" height="61" width="51" /></a></div><p>By: Pankaj Yadav</p>
<p>Oracle Join is basically used when we want to see the data from two or more tables at a same time. The data of the table got merged with the other table having a same column.</p>
<p><strong>Joining Tables using Oracle Syntax</strong></p>
<p>&nbsp;</p>
<pre class="brush: sql">
SELECT table1.column, table2.column
FROM table1, table2
WHERE table1.column1 = table2.column2;
</pre>
<p><strong>Use a join to query data from more than one table.</strong></p>
<ul>
<li>Write the join condition in the WHERE clause.</li>
<li>Prefix the column name with the table name when the same column name appears in more than one table</li>
</ul>
<p>We can declare fields as follows:</p>
<pre class="brush: sql">
table1.column     --denotes the table and column from which data is retrieved
table1.column1 = table2.column2  --condition that joins (or relates) the tables together
</pre>
<p>We have various types of joins which are given below: </p>
<p>
1. <strong>Equi join</strong><br />
2. <strong>Non-Equi join</strong><br />
3. <strong>Outer join</strong><br />
4. <strong>Self join</strong><br />
5. <strong>Cross join</strong><br />
6. <strong>Natural join</strong>
</p>
<p>
<h3>1. Equi join</h3>
</p>
<p>It is the simplest join or inner. This type of join involves primary and foreign key complements.</p>
<p>
<h3>2. Non Equi join</h3>
</p>
<p>It is a join condition containing something other than equality operator.</p>
<p>
<h3>3. Outer Join</h3>
</p>
<p>We use outer join to also see rows that do not meet join condition. The outer join operator is plus sign (+).</p>
<pre class="brush: sql">
SELECT table1.column, table2.column
FROM table1, table2
WHERE table1.column (+) = table2.column;
SELECT table1.column, table2.column
FROM table1, table2
WHERE table1.column = table2 .column(+);
</pre>
<p>The missing rows can be returned if an outer join operator is used in the join condition. The operator is a plus sign enclosed in parentheses (+), and it is placed on the “side” of the join that is deficient in Information. This operator has the effect of creating one or more null rows, to which one or more rows from the no deficient table can be joined.
<p><strong>table1.column =</strong> is the condition that joins (or relates) the tables together.<br />
<strong>table2.column (+)</strong> is the outer join symbol, which can be placed on either side of the<br />
<strong>WHERE clause condition</strong>, but not on both sides. (Place the outer<br />
Join symbol following the name of the column in the table without</p>
<p><h3>4. Self Join</h3>
</p>
<p>This join can be performed when we have to join the single table to itself.</p>
<p>
<h3>5. Cross join</h3>
</p>
<p>This join returns the cross product of the records.</p>
<p>
<h3>6. Natural join</h3>
</p>
<p>The NATURAL JOIN clause is based on all columns in the two tables that have the same name. It selects rows from the two tables that have equal values in all matched columns. If the columns having the same names have different data types, an error is returned.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/" rel="bookmark" class="crp_title">SQL &#8211; Select distinct Example, distinct statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/" rel="bookmark" class="crp_title">SQL &#8211; isnull() Example, isnull() function</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-joins-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; ifnull() Example, ifnull() function</title>
		<link>http://www.easywayserver.com/blog/sql-ifnull-example-ifnull-function/</link>
		<comments>http://www.easywayserver.com/blog/sql-ifnull-example-ifnull-function/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 09:27:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/sql-ifnull-example-ifnull-function/</guid>
		<description><![CDATA[SQL ifnull() function is used find null value in rows and returns value on our condition if null value found in column from database table name, otherwise if column value is not null it will return column value.
SQL ifnull() query example explains how to use ifnull() query in SQL.
Table class_name with all records without desired [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-ifnull-example-ifnull-function%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-ifnull-example-ifnull-function%2F" height="61" width="51" /></a></div><p>SQL ifnull() function is used find null value in rows and returns value on our condition if null value found in column from database table name, otherwise if column value is not null it will return column value.</p>
<p>SQL ifnull() query example explains how to use ifnull() query in SQL.</p>
<p>Table class_name with all records without desired column name sorting</p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
|       7 | Gagan Deep  | B.Tech     |       NULL |
|       8 | Mohit Garg  | M.Tech     |       NULL |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p><strong>ifnull() examples</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span>  Name<span style='color:#800080; '>,</span> Year_Start<span style='color:#800080; '>,</span> <span style='color:#400000; '>IFNULL</span><span style='color:#808030; '>(</span>Year_Start<span style='color:#800080; '>,</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+-------------+------------+----------------------+
| Name        | Year_Start | IFNULL(Year_Start,0) |
+-------------+------------+----------------------+
| Amit Mishra |       2005 |                 2005 |
| Robot       |       2005 |                 2005 |
| Rohan       |       2005 |                 2005 |
| Vivek       |       2009 |                 2009 |
| Chander     |       2009 |                 2009 |
| Deepak      |       2009 |                 2009 |
| <strong>Gagan Deep  |       NULL |                    0</strong> |
| <strong>Mohit Garg  |       NULL |                    0</strong> |
+-------------+------------+----------------------+
</pre>
</p>
</div>
<p></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span>  Name<span style='color:#800080; '>,</span> Year_Start<span style='color:#800080; '>,</span> <span style='color:#400000; '>IFNULL</span><span style='color:#808030; '>(</span>Year_Start<span style='color:#800080; '>,</span><span style='color:#008c00; '>2000</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+-------------+------------+-------------------------+
| Name        | Year_Start | IFNULL(Year_Start,2000) |
+-------------+------------+-------------------------+
| Amit Mishra |       2005 |                    2005 |
| Robot       |       2005 |                    2005 |
| Rohan       |       2005 |                    2005 |
| Vivek       |       2009 |                    2009 |
| Chander     |       2009 |                    2009 |
| Deepak      |       2009 |                    2009 |
| <strong>Gagan Deep  |       NULL |                    2000</strong> |
| <strong>Mohit Garg  |       NULL |                    2000</strong> |
+-------------+------------+-------------------------+
</pre>
</p>
</div>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/" rel="bookmark" class="crp_title">SQL &#8211; isnull() Example, isnull() function</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/" rel="bookmark" class="crp_title">SQL &#8211; Select distinct Example, distinct statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-ifnull-example-ifnull-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; isnull() Example, isnull() function</title>
		<link>http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/</link>
		<comments>http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 09:08:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/sql-select-isnull-example-isnull-function/</guid>
		<description><![CDATA[SQL isnull() function is used find null value in rows and returns 0 (zero) on if null value found in column from database table name, otherwise if column value is not null it will return 1 value. null value will replace automatically with zero value.
SQL isnull() query example explains how to use isnull() query in [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-isnull-example-isnull-function%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-isnull-example-isnull-function%2F" height="61" width="51" /></a></div><p>SQL isnull() function is used find null value in rows and returns 0 (zero) on if null value found in column from database table name, otherwise if column value is not null it will return 1 value. null value will replace automatically with zero value.</p>
<p>SQL isnull() query example explains how to use isnull() query in SQL.</p>
<p>Table class_name with all records without desired column name sorting</p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
|       7 | Gagan Deep  | B.Tech     |       NULL |
|       8 | Mohit Garg  | M.Tech     |       NULL |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p><strong>isnull() examples</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span>  Name<span style='color:#800080; '>,</span> Year_Start<span style='color:#800080; '>,</span> <span style='color:#400000; '>ISNULL</span><span style='color:#808030; '>(</span>Year_Start<span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+-------------+------------+--------------------+
| Name        | Year_Start | ISNULL(Year_Start) |
+-------------+------------+--------------------+
| Amit Mishra |       2005 |                  0 |
| Robot       |       2005 |                  0 |
| Rohan       |       2005 |                  0 |
| Vivek       |       2009 |                  0 |
| Chander     |       2009 |                  0 |
| Deepak      |       2009 |                  0 |
| Gagan Deep  |       NULL |                  1 |
| Mohit Garg  |       NULL |                  1 |
+-------------+------------+--------------------+
</pre>
</p>
</div>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-ifnull-example-ifnull-function/" rel="bookmark" class="crp_title">SQL &#8211; ifnull() Example, ifnull() function</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/" rel="bookmark" class="crp_title">SQL &#8211; Select distinct Example, distinct statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Select distinct Example, distinct statement</title>
		<link>http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/</link>
		<comments>http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 08:23:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=445</guid>
		<description><![CDATA[SQL distinct clause is used to remove duplicate rows from database table name. distinct keyword can be used on one column name and more than one column name in SQL query. distinct clause can be implemented in MySQL, oracle, db2, Microsoft SQL server.
SQL distinct query example explains how to use distinct query in SQL.
Table class_name [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-distinct-example-distinct-clause%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-distinct-example-distinct-clause%2F" height="61" width="51" /></a></div><p>SQL distinct clause is used to remove duplicate rows from database table name. distinct keyword can be used on one column name and more than one column name in SQL query. distinct clause can be implemented in MySQL, oracle, db2, Microsoft SQL server.</p>
<p>SQL distinct query example explains how to use distinct query in SQL.</p>
<p>Table class_name with all records without desired column name sorting</p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
|       7 | Gagan Deep  | B.Tech     |       NULL |
|       8 | Mohit Garg  | M.Tech     |       NULL |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p><strong>syntax of SQL distinct </strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800000; font-weight:bold; '>distinct</span> <span style='color:#800000; font-weight:bold; '>columns</span> <span style='color:#800000; font-weight:bold; '>FROM</span> table_name
</pre>
</div>
<p><strong>distinct  examples</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800000; font-weight:bold; '>distinct</span> Roll_No<span style='color:#800080; '>,</span> Name<span style='color:#800080; '>,</span> Class_Name<span style='color:#800080; '>,</span> Year_Start <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
|       7 | Gagan Deep  | B.Tech     |       NULL |
|       8 | Mohit Garg  | M.Tech     |       NULL |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns all rows return because no duplicate row is found. all column name is distinct</p>
<p></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800000; font-weight:bold; '>distinct</span> Class_Name<span style='color:#800080; '>,</span> Year_Start <span style='color:#800000; font-weight:bold; '>FROM</span> class_name<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+------------+------------+
| Class_Name | Year_Start |
+------------+------------+
| B.Science  |       2005 |
| B.Tech     |       2005 |
| M.Tech     |       2005 |
| B.Tech     |       2009 |
| B.Science  |       2009 |
| B.Tech     |       NULL |
| M.Tech     |       NULL |
+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns those row which column name (Class_Name, Year_Start) not duplicate rows value only from table.</p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800000; font-weight:bold; '>distinct</span> Class_Name <span style='color:#800000; font-weight:bold; '>FROM</span> class_name<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+------------+
| Class_Name |
+------------+
| B.Science  |
| B.Tech     |
| M.Tech     |
+------------+
</pre>
</p>
</div>
<p>this SQL query check distinct on only one column name Class_Name and check duplicate rows in  Class_Name column name and remove duplicate rows.</p>
<p>* indicates fetch all columns records from table.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/" rel="bookmark" class="crp_title">SQL &#8211; isnull() Example, isnull() function</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-ifnull-example-ifnull-function/" rel="bookmark" class="crp_title">SQL &#8211; ifnull() Example, ifnull() function</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Select is null Example, is not null Example</title>
		<link>http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/</link>
		<comments>http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 07:52:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/</guid>
		<description><![CDATA[SQL is null clause, is not null clause option can filter records from database table name on null value in rows. This returns only null rows which we put is null clause in query, and returns those rows which not having null in row on is not null clause. null keyword can be used on [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-is-null-example-is-not-null-example%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-is-null-example-is-not-null-example%2F" height="61" width="51" /></a></div><p>SQL is null clause, is not null clause option can filter records from database table name on null value in rows. This returns only null rows which we put is null clause in query, and returns those rows which not having null in row on is not null clause. null keyword can be used on one column name and more than one column name in SQL query. null clause can be implemented in MySQL, oracle, db2, Microsoft SQL server.</p>
<p>SQL null query example explains how to use null query in SQL.</p>
<p>Table class_name with all records without desired column name sorting</p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
|       7 | Gagan Deep  | B.Tech     |       NULL |
|       8 | Mohit Garg  | M.Tech     |       NULL |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p><strong>Where clause</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name  <span style='color:#800000; font-weight:bold; '>where</span> Year_Start <span style='color:#800000; font-weight:bold; '>is</span> <span style='color:#808030; '>null</span><span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+------------+------------+------------+
| Roll_No | Name       | Class_Name | Year_Start |
+---------+------------+------------+------------+
|       7 | Gagan Deep | B.Tech     |       NULL |
|       8 | Mohit Garg | M.Tech     |       NULL |
+---------+------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns those row which column name (Year_Start) having null value only from table.</p>
<p></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name  <span style='color:#800000; font-weight:bold; '>where</span> Year_Start <span style='color:#800000; font-weight:bold; '>is</span> <span style='color:#808030; '>not</span> <span style='color:#808030; '>null</span><span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns those row which column name (Year_Start) not having null value only from table.</p>
<p>* indicates fetch all columns records from table.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/" rel="bookmark" class="crp_title">SQL &#8211; Select distinct Example, distinct statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/" rel="bookmark" class="crp_title">SQL &#8211; isnull() Example, isnull() function</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-ifnull-example-ifnull-function/" rel="bookmark" class="crp_title">SQL &#8211; ifnull() Example, ifnull() function</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Select Where clause Example</title>
		<link>http://www.easywayserver.com/blog/sql-select-where-clause-example/</link>
		<comments>http://www.easywayserver.com/blog/sql-select-where-clause-example/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 07:25:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/sql-select-where-clause-example/</guid>
		<description><![CDATA[SQL where clause option can filter records from database table name. This returns only required rows which we put clause in query. where keyword can be used on one column name and more than one column name in SQL query. where clause can be implemented in MySQL, oracle, db2, Microsoft SQL server.
SQL select where query [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-where-clause-example%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-where-clause-example%2F" height="61" width="51" /></a></div><p>SQL where clause option can filter records from database table name. This returns only required rows which we put clause in query. where keyword can be used on one column name and more than one column name in SQL query. where clause can be implemented in MySQL, oracle, db2, Microsoft SQL server.</p>
<p>SQL select where query example explains how to use select where query in SQL.</p>
<p>Table class_name with all records without desired column name sorting</p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p><strong>Where clause</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c <span style='color:#800000; font-weight:bold; '>where</span> Year_Start <span style='color:#808030; '>=</span> <span style='color:#008c00; '>2005</span><span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns those row which column name (Year_Start) having 2005 value only from table.</p>
<p></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>select</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>from</span> class_name <span style='color:#800000; font-weight:bold; '>where</span> Year_Start <span style='color:#808030; '>></span> <span style='color:#008c00; '>2005</span><span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+---------+------------+------------+
| Roll_No | Name    | Class_Name | Year_Start |
+---------+---------+------------+------------+
|       4 | Vivek   | B.Tech     |       2009 |
|       5 | Chander | B.Science  |       2009 |
|       6 | Deepak  | B.Science  |       2009 |
+---------+---------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns only those row in column Year_Start greater than 2005 value only.</p>
<p><strong>group by on more than one column name</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c
   <span style='color:#800000; font-weight:bold; '>where</span> Year_Start<span style='color:#808030; '>=</span> <span style='color:#008c00; '>2005</span> <span style='color:#808030; '>and</span> Class_Name <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>'B.Tech'</span><span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------+------------+------------+
| Roll_No | Name  | Class_Name | Year_Start |
+---------+-------+------------+------------+
|       2 | Robot | B.Tech     |       2005 |
+---------+-------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns only those row in column Year_Start having 2005 value only and also class_name column value having B.Tech.</p>
<p>* indicates fetch all columns records from table.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/" rel="bookmark" class="crp_title">SQL &#8211; Select distinct Example, distinct statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-query-with-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Query with Clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-isnull-example-isnull-function/" rel="bookmark" class="crp_title">SQL &#8211; isnull() Example, isnull() function</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-select-where-clause-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Select Group By Example, Group by statement</title>
		<link>http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/</link>
		<comments>http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 06:56:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=441</guid>
		<description><![CDATA[SQL Group by column name clause is used to give aggregate records in database table. Group by keyword is used to give records in same column rows in grouped manner. Group by can be used on one column name and more than one column name in SQL query. group by can be implemented in MySQL, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-group-by-example-group-by-statement%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-group-by-example-group-by-statement%2F" height="61" width="51" /></a></div><p>SQL Group by column name clause is used to give aggregate records in database table. Group by keyword is used to give records in same column rows in grouped manner. Group by can be used on one column name and more than one column name in SQL query. group by can be implemented in MySQL, oracle, db2, Microsoft SQL server.</p>
<p>SQL select Group by query example explains how to use select Group by query in SQL.</p>
<p>Table class_name with all records without desired column name sorting</p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p><strong>Group by</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c <span style='color:#800000; font-weight:bold; '>group</span> <span style='color:#800000; font-weight:bold; '>by</span> Class_Name<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns unique column name (class_name) rows only from table.</p>
<p></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> Roll_No<span style='color:#800080; '>,</span> Name<span style='color:#800080; '>,</span> Class_Name<span style='color:#800080; '>,</span> <span style='color:#400000; '>count</span><span style='color:#808030; '>(</span>Class_Name<span style='color:#808030; '>)</span>
           <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c <span style='color:#800000; font-weight:bold; '>group</span> <span style='color:#800000; font-weight:bold; '>by</span> Class_Name<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+-------------------+
| Roll_No | Name        | Class_Name | count(Class_Name) |
+---------+-------------+------------+-------------------+
|       1 | Amit Mishra | B.Science  |                 3 |
|       2 | Robot       | B.Tech     |                 2 |
|       3 | Rohan       | M.Tech     |                 1 |
+---------+-------------+------------+-------------------+
</pre>
</p>
</div>
<p>this SQL query returns unique column name (class_name) rows only from table and it shows count of unique column name.</p>
<p><strong>group by on more than one column name</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c <span style='color:#800000; font-weight:bold; '>group</span> <span style='color:#800000; font-weight:bold; '>by</span> Class_Name<span style='color:#800080; '>,</span>Year_Start<span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B.Science  |       2005 |
|       5 | Chander     | B.Science  |       2009 |
|       2 | Robot       | B.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       3 | Rohan       | M.Tech     |       2005 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query returns, unique column name rows only with two columns</p>
<p>* indicates fetch all columns records from table.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/" rel="bookmark" class="crp_title">SQL &#8211; Select distinct Example, distinct statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-query-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Query Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-query-with-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Query with Clause Example</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Select Order by clause keyword</title>
		<link>http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/</link>
		<comments>http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 15:16:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/</guid>
		<description><![CDATA[SQL select query is used to fetch records from database. order by column name clause is used to sorting records in database table. Order by keyword is having options for sorting data records, one is ascending sorting order, Second is descending order, it will return records in higher to lower order. In ascending sorting order, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-order-by-clause-keyword%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-order-by-clause-keyword%2F" height="61" width="51" /></a></div><p>SQL select query is used to fetch records from database. order by column name clause is used to sorting records in database table. Order by keyword is having options for sorting data records, one is ascending sorting order, Second is descending order, it will return records in higher to lower order. In ascending sorting order, it returns records in lower to higher order. order by clause can be implemented on all database Oracle, MS Sql (Microsoft SQL), MySQL.</p>
<p>SQL select order by query example explains how to use select order by query in SQL.</p>
<p>Table class_name with all records without desired column name sorting</p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B Science  |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p><strong>Descending Order by Sorting</strong></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c <span style='color:#800000; font-weight:bold; '>order</span> <span style='color:#800000; font-weight:bold; '>by</span> name <span style='color:#800000; font-weight:bold; '>desc</span><span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       4 | Vivek       | B.Tech     |       2009 |
|       3 | Rohan       | M.Tech     |       2005 |
|       2 | Robot       | B.Tech     |       2005 |
|       6 | Deepak      | B.Science  |       2009 |
|       5 | Chander     | B.Science  |       2009 |
|       1 | Amit Mishra | B Science  |       2005 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query in sql return rows from higher to lower sorting order from table.</p>
<p></p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>SELECT</span> <span style='color:#800080; '>*</span> <span style='color:#800000; font-weight:bold; '>FROM</span> class_name c <span style='color:#800000; font-weight:bold; '>order</span> <span style='color:#800000; font-weight:bold; '>by</span> name <span style='color:#800000; font-weight:bold; '>asc</span><span style='color:#800080; '>;</span>
</pre>
</div>
<p><strong>Output</strong></p>
<div class="cde">
<p class="op">
<pre>
+---------+-------------+------------+------------+
| Roll_No | Name        | Class_Name | Year_Start |
+---------+-------------+------------+------------+
|       1 | Amit Mishra | B Science  |       2005 |
|       5 | Chander     | B.Science  |       2009 |
|       6 | Deepak      | B.Science  |       2009 |
|       2 | Robot       | B.Tech     |       2005 |
|       3 | Rohan       | M.Tech     |       2005 |
|       4 | Vivek       | B.Tech     |       2009 |
+---------+-------------+------------+------------+
</pre>
</p>
</div>
<p>this SQL query in sql return rows from lower to higher sorting order from table.</p>
<p>* indicates fetch all columns records from table.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-distinct-example-distinct-clause/" rel="bookmark" class="crp_title">SQL &#8211; Select distinct Example, distinct statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-query-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Query Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-with-limit-rows-and-records-clause-example-oracle-ms-sql-mysql/" rel="bookmark" class="crp_title">SQL &#8211; Select with limit rows and records Clause Example, Oracle MS SQL MySQL</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Select with Temporary Dual table</title>
		<link>http://www.easywayserver.com/blog/sql-select-with-temporary-dual-table/</link>
		<comments>http://www.easywayserver.com/blog/sql-select-with-temporary-dual-table/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 11:11:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=429</guid>
		<description><![CDATA[SQL select query is used to fetch records from database. Dual table is Temporary table which is created for temporary work. Dual table allow people to use from keyword in query.
SQL select dual example explains how to use select dual query in SQL.

select 3+1 from dual;


Table dual with records



+-----+
&#124; 3+1 &#124;
+-----+
&#124;   4 &#124;
+-----+



Related [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-with-temporary-dual-table%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fsql-select-with-temporary-dual-table%2F" height="61" width="51" /></a></div><p>SQL select query is used to fetch records from database. Dual table is Temporary table which is created for temporary work. Dual table allow people to use from keyword in query.</p>
<p>SQL select dual example explains how to use select dual query in SQL.</p>
<div class="cde">
<pre><span style='color:#800000; font-weight:bold; '>select</span> <span style='color:#008c00; '>3</span><span style='color:#808030; '>+</span><span style='color:#008c00; '>1</span> <span style='color:#800000; font-weight:bold; '>from</span> dual<span style='color:#800080; '>;</span>
</pre>
</div>
<p>Table dual with records</p>
<div class="cde">
<p class="op">
<pre>
+-----+
| 3+1 |
+-----+
|   4 |
+-----+
</pre>
</p>
</div>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-with-limit-rows-and-records-clause-example-oracle-ms-sql-mysql/" rel="bookmark" class="crp_title">SQL &#8211; Select with limit rows and records Clause Example, Oracle MS SQL MySQL</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-query-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Query Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-order-by-clause-keyword/" rel="bookmark" class="crp_title">SQL &#8211; Select Order by clause keyword</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-where-clause-example/" rel="bookmark" class="crp_title">SQL &#8211; Select Where clause Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-group-by-example-group-by-statement/" rel="bookmark" class="crp_title">SQL &#8211; Select Group By Example, Group by statement</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-select-is-null-example-is-not-null-example/" rel="bookmark" class="crp_title">SQL &#8211; Select is null Example, is not null Example</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/sql-select-with-temporary-dual-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

