<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-2679973108175390996</atom:id><lastBuildDate>Wed, 25 Mar 2026 10:54:12 +0000</lastBuildDate><category>Oracle Tutorial Point</category><category>sql</category><category>oracle</category><category>Oracle Database</category><category>functions in sql</category><category>functions</category><category>date</category><category>function</category><category>dbms</category><category>truncate function in sql</category><category>DATETIME Data Type</category><category>avg</category><category>count</category><category>distinct in sql</category><category>max</category><category>min</category><category>order by</category><category>stddev</category><category>sum</category><category>truncate</category><category>variance</category><category>BLOB Data Type</category><category>CHAR Data Type</category><category>Data types in SQL</category><category>ER Model</category><category>Entity Relationship Model</category><category>INSERT Statement</category><category>NUMBER Data Type</category><category>Oracle database management system</category><category>PAD</category><category>Programmatic Structures</category><category>ROWID Data Type</category><category>SELECT Statement</category><category>TIMESTAMP Data Type</category><category>Tablespaces</category><category>Types of Editions in oracle</category><category>VARCHAR2 Data Type</category><category>aggregate function</category><category>aggregate functions</category><category>am</category><category>arithmetic operations in sql</category><category>between and operator in sql</category><category>concat</category><category>conversion functions</category><category>day</category><category>floor</category><category>format models in sql</category><category>greatest</category><category>group by</category><category>group function</category><category>group functions</category><category>having</category><category>hh</category><category>hh24</category><category>initcap</category><category>length</category><category>like operator in sql</category><category>literals in sql</category><category>logical operators in sql</category><category>lower</category><category>miscellaneous functions</category><category>mm</category><category>month</category><category>not like operator in sql</category><category>not null operator in sql</category><category>null</category><category>null operator in sql</category><category>number format</category><category>nvl function</category><category>oracletutorialpoint</category><category>order by clause in sql</category><category>pm</category><category>replace</category><category>replace all</category><category>round</category><category>soundex</category><category>sql dump</category><category>sql plus operator</category><category>sqrt function in sql</category><category>ss</category><category>string</category><category>substring</category><category>sysdate</category><category>to_date</category><category>to_number</category><category>trim</category><category>trim functions in sql</category><category>uid</category><category>upper</category><category>userenv</category><category>vsize</category><category>where clause in sql</category><category>year</category><category>yyyy</category><title>Oracle Tutorial Point</title><description>A Blog for Oracle DBMS(SQL &amp;amp; PL/SQL)</description><link>https://oracletutorialpoint.blogspot.com/</link><managingEditor>noreply@blogger.com (Subbareddy Nallamachu)</managingEditor><generator>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:keywords>aggregate,function,am,arithmetic,operations,in,sql,avg,between,and,operator,in,sql,BLOB,Data,Type,CHAR,Data,Type,concat,count,Data,types,in,SQL,date,DATETIME,Data,Type,day,dbms,distinct,in,sql,Entity,Relationship,Model,ER,Model,format,mod</itunes:keywords><itunes:summary>Oracle SQL and PL/SQL how to articales</itunes:summary><itunes:subtitle>oracletutorialpoint</itunes:subtitle><itunes:category text="Technology"><itunes:category text="Software How-To"/></itunes:category><itunes:owner><itunes:email>subbareddynallamachu@gmail.com</itunes:email></itunes:owner><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-5340289706707902392</guid><pubDate>Sun, 05 Nov 2017 07:09:00 +0000</pubDate><atom:updated>2022-11-28T22:26:55.390+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">function</category><category domain="http://www.blogger.com/atom/ns#">greatest</category><category domain="http://www.blogger.com/atom/ns#">group by</category><category domain="http://www.blogger.com/atom/ns#">having</category><category domain="http://www.blogger.com/atom/ns#">miscellaneous functions</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">order by</category><category domain="http://www.blogger.com/atom/ns#">soundex</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">uid</category><category domain="http://www.blogger.com/atom/ns#">userenv</category><category domain="http://www.blogger.com/atom/ns#">vsize</category><title>GROUP BY, ORDER BY, HAVING and Miscellaneous Functions in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point post to know when to use GROUP BY, ORDER BY, HAVING keywords and Miscellaneous functions in Oracle SQL. If you have any queries about this post, please comment on comments section.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creating Groups of Data:&lt;/b&gt;
&lt;br /&gt;
&lt;b&gt;GROUP BY Clause:&lt;/b&gt;
&lt;br /&gt;
The GROUP BY clause is used to decide the rows in a table into groups.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COLUMN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;,&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GRP_FUN&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;COLUMN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt;
 &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;TABLE&lt;/span&gt;
 &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;CONDITION&lt;/span&gt;
 &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GRP_BY_EXPR&lt;/span&gt;
 &lt;span style="color: #66d9ef;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COLUMN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Conditions to use GROUP BY Clause:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;If the GROUP function is included in a SELECT clause, we should not use individual results columns.&lt;/li&gt;
&lt;li&gt;Those non GROUP functional columns should declare in GROUP BY clause.&lt;/li&gt;
&lt;li&gt;Rows can be pre excluded before dividing them into GROUP by using WHERE clause.&lt;/li&gt;
&lt;li&gt;Column aliases cannot be used in GROUP BY clause.&lt;/li&gt;
&lt;li&gt;By default, rows are sorted by ascending order of the columns included in the GROUP BY list.&lt;/li&gt;
&lt;li&gt;The column applied upon GROUP BY clause need not be part of SELECT list.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GROUPD&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GROUPD&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL);&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GROUPD&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GROUPD&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,JOB;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The above specification falls under the principle of GROUP within GROUP’S.
&lt;br /&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB&lt;/span&gt;&lt;span style="color: #f92672;"&gt;=&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'CLERK'&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB&lt;/span&gt;&lt;span style="color: #f92672;"&gt;=&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'CLERK'&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Excluding Groups of Results:&lt;/b&gt;
&lt;br /&gt;
&lt;b&gt;HAVING Clause:&lt;/b&gt;
&lt;br /&gt;
It is used to specify which groups are to be displayed.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COLUMN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;,&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GROUP_FUNCTION&lt;/span&gt;
 &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;TABLE&lt;/span&gt;
 &lt;span style="color: #f8f8f2;"&gt;[&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;Condition]&lt;/span&gt;
 &lt;span style="color: #f8f8f2;"&gt;[&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;Group_By_expr]&lt;/span&gt;
 &lt;span style="color: #f8f8f2;"&gt;[&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;HAVING&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;Group_Condition]&lt;/span&gt;
 &lt;span style="color: #f8f8f2;"&gt;[&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;Column_Name&lt;/span&gt;&lt;span style="color: #f92672;"&gt;/&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;Alias&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;];&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;What will do HAVING Clause?&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Rows are Grouped&lt;/li&gt;
&lt;li&gt;The Group function is applied to the group&lt;/li&gt;
&lt;li&gt;The Groups that match the criteria in the HAVING Clause are displayed.&lt;/li&gt;
&lt;li&gt;The HAVING clause can be precede GROUP BY clause. But, it is more logical to declare it before GROUP BY.&lt;/li&gt;
&lt;li&gt;HAVING clause can be used without a GROUP function in the SELECT list.&lt;/li&gt;
&lt;li&gt;If rows are restricted based on the result of a group function, we must have a GROUP BY clause as well as the HAVING Clause.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;HAVING&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #ae81ff;"&gt;2000&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;PAYROLL&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;NOT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;LIKE&lt;/span&gt; &lt;span style="color: #e6db74;"&gt;'SALES%'&lt;/span&gt; 
     &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;HAVING&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #ae81ff;"&gt;5000&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL);&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB&lt;/span&gt;&lt;span style="color: #f92672;"&gt;=&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'CLERK'&lt;/span&gt; 
     &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;HAVING&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #ae81ff;"&gt;1000&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;HAVING&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COUNT&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(DNO)&lt;/span&gt; &lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #ae81ff;"&gt;3&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO,&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; 
     &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;HAVING&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COUNT&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #f92672;"&gt;*&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #ae81ff;"&gt;3&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Nesting of Group Functions:&lt;/b&gt;
&lt;br /&gt;
Group functions can be nested to a depth of two.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL))&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL))&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DNO;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL)),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL))&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;BY&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Miscellaneous Functions:&lt;/b&gt;
&lt;br /&gt;
&lt;b&gt;GREATEST Function:&lt;/b&gt;
&lt;br /&gt;
It returns the GREATEST of the list of exprs. All exprs after the first are implicitly converted to the data type of the first expr before the comparison. Oracle compares the exprs using non-padded comparison semantics. Character comparison is used on the value of the character in the data base character list.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; LEAST (expr1, expr2….)
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;LEAST(&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'SUBBAIAH'&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;,&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'SUBBAREDDY'&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DUAL;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GREATEST(&lt;/span&gt;&lt;span style="color: #ae81ff;"&gt;1000&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;,&lt;/span&gt;&lt;span style="color: #ae81ff;"&gt;2000&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;,&lt;/span&gt;&lt;span style="color: #ae81ff;"&gt;300&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DUAL;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;GREATEST(&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'20-JUN-16'&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;,&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'01-OCT-16'&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DUAL;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;USER Function:&lt;/b&gt;
&lt;br /&gt;
It returns the current Oracle USERS within the VARCHAR2 data type. The function cannot be used in the condition of the CHECK constraint.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; USER
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.1em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;USER&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DUAL;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;UID Function:&lt;/b&gt;
&lt;br /&gt;
It returns an integer that uniquely identifies the current user.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; UID
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.1em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;UID&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DUAL;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;USER&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;,UID&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DUAL;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;USERENV Function:&lt;/b&gt;
&lt;br /&gt;
Returns information of VARCHAR2 data type above the current session.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; USERENV(Option)
&lt;br /&gt;
&lt;br /&gt;
The values in Options are,&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;ISDBA ==&amp;gt; Returns TRUE if DBA role is enabled.&lt;/li&gt;
&lt;li&gt;LANGUAGE ==&amp;gt; Returns the LANGUAGE and territory used in the current session.&lt;/li&gt;
&lt;li&gt;TERMINAL ==&amp;gt; Returns the OS identifier for the current session’s terminal.&lt;/li&gt;
&lt;li&gt;SESSIONID ==&amp;gt; Returns the Auditing session identifier.&lt;/li&gt;
&lt;li&gt;ENTRYID ==&amp;gt; Returns the available auditing entry identifier.&lt;/li&gt;
&lt;li&gt;LANG ==&amp;gt; Returns the ISD abbreviation for the language name.&lt;/li&gt;
&lt;li&gt;INSTANCE ==&amp;gt; Returns the instance identification number of the current instance.&lt;/li&gt;
&lt;li&gt;CLIENT_INFO ==&amp;gt; Returns up to 64 bytes of User session information.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.1em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;USERENV(&lt;/span&gt;&lt;span style="background-color: #1e0010; color: #960050;"&gt;‘&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;LANGUAGE&lt;/span&gt;&lt;span style="background-color: #1e0010; color: #960050;"&gt;’&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;DUAL;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;VSIZE Function:&lt;/b&gt;
&lt;br /&gt;
As per the below syntax if Expr is not NULL, this function returns the No of bytes in the internal representation of Expr. VSIZE function returns NULL when Expr is NULL.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; VSIZE(Expr)
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.1em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;ENAME,VSIZE(ENAME)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;SOUNDEX Function:&lt;/b&gt;
&lt;br /&gt;
It returns a character string containing the phonetic representation of char. It allows comparison of words that are spelled differently. But, sounds like in English.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; SOUNDEX(CHAR)
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style="background: rgb(39, 40, 34); border-width: 0.1em 0.1em 0.1em 0.1em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;ENAME&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SOUNDEX(ENAME)&lt;/span&gt;&lt;span style="color: #f92672;"&gt;=&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;SOUNDEX(&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'SUBBAREDDY'&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;);&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;ENAME,JOB&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SOUNDEX(JOB)&lt;/span&gt;&lt;span style="color: #f92672;"&gt;=&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;SOUNDEX(&lt;/span&gt;&lt;span style="color: #e6db74;"&gt;'SUBBAIAH'&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;);&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;</description><link>https://oracletutorialpoint.blogspot.com/2017/11/group-by-order-by-having-and.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-2253384227424546199</guid><pubDate>Sat, 04 Nov 2017 05:55:00 +0000</pubDate><atom:updated>2022-11-28T22:27:07.564+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">aggregate functions</category><category domain="http://www.blogger.com/atom/ns#">avg</category><category domain="http://www.blogger.com/atom/ns#">count</category><category domain="http://www.blogger.com/atom/ns#">functions</category><category domain="http://www.blogger.com/atom/ns#">group functions</category><category domain="http://www.blogger.com/atom/ns#">max</category><category domain="http://www.blogger.com/atom/ns#">min</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">stddev</category><category domain="http://www.blogger.com/atom/ns#">sum</category><category domain="http://www.blogger.com/atom/ns#">variance</category><title>Aggregate or Group functions in Oracle SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
This Oracle tutorial point contains the information about the Aggregate functions or Grouping functions. The below is the list of functions discussed in the current post.&lt;br /&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Average / AVG function&lt;/li&gt;
&lt;li&gt;Summation / SUM function&lt;/li&gt;
&lt;li&gt;Maximum / MAX function&lt;/li&gt;
&lt;li&gt;Minimum / MIN function&lt;/li&gt;
&lt;li&gt;Standard Deviation / STDDEV function&lt;/li&gt;
&lt;li&gt;Variance function&lt;/li&gt;
&lt;li&gt;Count function&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
These functions return a single row based on group of rows. These can appear in SELECT list and HAVING clauses. These functions operate on sets of rows to give one result per group. The sets may be the whole table or the table split into groups.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Guidelines to use Group Functions:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The DISTINCT keyword indicates not to consider duplicate values.&lt;/li&gt;
&lt;li&gt;ALL indicates to consider each and every value including duplicates.&lt;/li&gt;
&lt;b&gt;Syntax:&lt;/b&gt; GROUP_FUNCTION_NAME(ALL /DISTINCT / n)
&lt;li&gt;The data type for arguments may NUMBER, DATE, CHAR or VARCHAR.&lt;/li&gt;
&lt;li&gt;All other group functions except COUNT(*) ignore NULL values. NVL function is used to substitute a NULL value.&lt;/li&gt;
&lt;li&gt;When a group function is declared in a SELECT list, no single row columns should be declared.&lt;/li&gt;
&lt;li&gt;Once a group function is declared in a SELECT list, other columns can be declared. But, they should be grouped columns and all non-functional columns should be declared into GROUP BY clause.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Average / AVG function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the average value of n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; AVG(DISTINCT / ALL / n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #272822; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(COMM),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Summation / SUM function:&lt;/b&gt;
&lt;br /&gt;
As per the below syntax, it returns the SUM of the values of n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; SUM(DISTINCT / ALL / n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt; &lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="background: #272822; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(COMM),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;SUM&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;AVG&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Maximum / MAX function:&lt;/b&gt;
&lt;br /&gt;
As per the below syntax, it returns the maximum value of n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; MAX(DISTINCT / ALL / n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #272822; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(COMM),&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MAX&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;COMM)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Minimum / MIN function:&lt;/b&gt;
&lt;br /&gt;
As per the below syntax, it returns the minimum value of the n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; MIN(DISTINCT / ALL /n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #272822; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(COMM),&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;MIN&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;COMM)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Standard Deviation / STDDEV function:&lt;/b&gt;
&lt;br /&gt;
As per the below syntax, it returns the standard deviation value of n and it ignores the NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; STDDEV(DISTINCT / ALL / n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #272822; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;STDDEV(SAL),&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;STDDEV(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;STDDEV(COMM),&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;STDDEV(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;COMM)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Variance function:&lt;/b&gt;
&lt;br /&gt;
As per the below syntax, it returns the variance of n and it ignores the NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; VARIANCE(DISTINCT / ALL / n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt; &lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="background: #272822; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;VARIANCE(SAL),&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;VARIANCE(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;SAL)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;VARIANCE(COMM),&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;VARIANCE(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;COMM)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Count function:&lt;/b&gt;
&lt;br /&gt;
As per the below syntax, it returns the number of rows in the query. N evaluates to something other than NULL. It is used returns all rows, including duplicated and NULLs. It can be used to specify the count of all rows or only distinct values of n.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; COUNT(* / DISTINCT / ALL / n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #272822; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COUNT&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #f92672;"&gt;*&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COUNT&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(JOB),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;COUNT&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;JOB)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;span style="color: #66d9ef;"&gt;SQL&lt;/span&gt;&lt;span style="color: #f92672;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;COUNT&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(SAL),&lt;/span&gt;&lt;span style="color: #66d9ef;"&gt;COUNT&lt;/span&gt;&lt;span style="color: #f8f8f2;"&gt;(COMM)&lt;/span&gt; &lt;span style="color: #66d9ef;"&gt;FROM&lt;/span&gt; &lt;span style="color: #f8f8f2;"&gt;EMP;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
If any queries or concerns about this post, please mention it in the comments section.</description><link>https://oracletutorialpoint.blogspot.com/2017/11/aggregate-or-group-functions-in-oracle.html</link><thr:total>1</thr:total><georss:featurename>Bengaluru, Karnataka, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-5369228652081187692</guid><pubDate>Wed, 26 Jul 2017 06:53:00 +0000</pubDate><atom:updated>2022-11-28T22:27:21.392+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">am</category><category domain="http://www.blogger.com/atom/ns#">date</category><category domain="http://www.blogger.com/atom/ns#">day</category><category domain="http://www.blogger.com/atom/ns#">hh</category><category domain="http://www.blogger.com/atom/ns#">hh24</category><category domain="http://www.blogger.com/atom/ns#">mm</category><category domain="http://www.blogger.com/atom/ns#">month</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">pm</category><category domain="http://www.blogger.com/atom/ns#">ss</category><category domain="http://www.blogger.com/atom/ns#">to_date</category><category domain="http://www.blogger.com/atom/ns#">to_number</category><category domain="http://www.blogger.com/atom/ns#">year</category><category domain="http://www.blogger.com/atom/ns#">yyyy</category><title>DATE format models in Oracle SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this oracle tutorila point article to know more about different DATE format models in SQL. The Date format models can be used in the TO_CHAR function to translate a DATE value from original format to user format. The total length of a date format model cannot exceed 22 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Date Format Elements:&lt;/b&gt;&lt;br /&gt;
A date format model is composed of one or more date format elements.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;For input format models, format items cannot seem
double and format items that represent similar information cannot be combined.&lt;/li&gt;
&lt;/ul&gt;
Capitalization in a spelled out word, abbreviation or Roman numeral follows capitalization in the corresponding format elements. Punctuations such are hyphens, slashes, commas, periods and colons.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;AD or A.D / BC or B.C:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Indicates AD/BC with or without periods.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:
&lt;/b&gt;&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SYSDATE,'AD') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SYSDATE,'B.C'), TO_CHAR(SYSDATE,'A.D') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, HIREDATE, TO_CHAR(HIREDATE,'A.D') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;b&gt;AM or A.M. / PM or P.M.:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;It indicates meridian indicator with or without periods.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SYSDATE,'A.M.'),TO_CHAR(SYSDATE,'PM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, HIREDATE, TO_CHAR(HIREDATE,'AM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;CC / SCC:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Indicates the century, S prefixes BC date with,&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SYSDATE,'SCC-AD') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, HIREDATE, TO_CHAR(HIREDATE,'SCC-AD') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;D&lt;/b&gt; ==&amp;gt; Day of the Week (1-7)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SYSDATE,'D') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HIREDATE, TO_CHAR(HIREDATE,'D') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Day&lt;/b&gt; ==&amp;gt; Indicates spelled name of the Week Day&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Pads to a length of 9 characters.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SYSDATE,'DAY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, HIREDATE,TO_CHAR(HIREDATE,'DAY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; TO_CHAR(HIREDATE,'DAY')&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'WEDNESDAY';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;DD&lt;/b&gt; ==&amp;gt; It indicates the Day of the Month(1-31)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SYSDATE,'DD-DAY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HIREDATE, TO_CHAR(HIREDATE,'DD-DAY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HIREDATE, TO_CHAR(HIREDATE,'DD-DAY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; TO_CHAR(HIREDATE,'DD-DAY')&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'03-WEDNESDAY';&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;DAY ==&amp;gt; Specifies in Upper Case&lt;/li&gt;
&lt;li&gt;DAY ==&amp;gt; Specifies in Initcap Case&lt;/li&gt;
&lt;li&gt;DAY ==&amp;gt; Specifies in Lower Case&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;DDD&lt;/b&gt; ==&amp;gt; It indicates the Day of the Year (1-366);&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR(SYSDATE,'DDD') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE,TO_CHAR(HIREDATE,'DDD') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; TO_CHAR(HIREDATE,'DAY')&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'WEDNESDAY';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;DY&lt;/b&gt; ==&amp;gt; It indicates the abbreviated name of the day.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR(SYSDATE,'D-DY-DAY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'D-DY-DAY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt;(&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;IW&lt;/b&gt; ==&amp;gt; Specifies the week of the year (1-52 or 1-53) based on the ISO standard.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR(SYSDATE,'IW') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HIREDATE, TO_CHAR(HIREDATE, 'IW') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;IYYY&lt;/b&gt; ==&amp;gt; Specifies 4 digits year based on the ISO standard. Similarly IYY, IY.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'IYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'IYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;YYYY / SYYYY&lt;/b&gt; ==&amp;gt; Returns 4 digit year, S prefixes BC dates with ‘-’. Similarly YYY / YY / Y.&lt;br /&gt;
&lt;b&gt;Y, YYY&lt;/b&gt; ==&amp;gt; Returns year with comma in this position.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR(SYSDATE,'YYYY') FOUR, TO_CHAR(SYSDATE,'YYY') THREE, TO_CHAR(SYSDATE,'Y,YYY') COMMA &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;YEAR / SYEAR&lt;/b&gt; ==&amp;gt; Returns the spelled out year.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'YEAR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'YEAR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;W&lt;/b&gt; ==&amp;gt; Specified the week of the Month(1-5). Weeks starts on the first day of the month and ends with the seventh.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR(SYSDATE,'W') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE, TO_CHAR(HIREDATE,'W') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;WW&lt;/b&gt; ==&amp;gt; Specifies the week of the year(1-54). Week starts on the first day of the Month and ends on the seventh.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'WW') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'WW') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Q&lt;/b&gt; ==&amp;gt; Returns the quarter of the Year.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'Q') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'Q') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;J&lt;/b&gt; ==&amp;gt; Returns the JULIAN DAY.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;It is the number of the day since January 1,4712 BC.&lt;/li&gt;
&lt;li&gt;Numbers specified with ‘J’ must be integers.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'J') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TP_CHAR(HIREDATE,'J') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TP_CHAR(HIREDATE,'J-DDD-DD-DD') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;MM&lt;/b&gt; ==&amp;gt; Returns the digit numeric abbreviation of the Month.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'MM-YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'MM-YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;MON&lt;/b&gt; ==&amp;gt; Returns the abbreviated name of the Month.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'MM-MON') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HIREDATE,TO_CHAR(HIREDATE,'MM-MON') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;MONTH&lt;/b&gt; ==&amp;gt; spells the name of the month, padded to a length of 9 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR(SYSDATE,'MM&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;MONTH'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HIREDATE, TO_CHAR(HIREDATE,'MM&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;MONTH'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;HH / HH12&lt;/b&gt; ==&amp;gt; Returns the Hour of the day in twelve hour clock mode.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'HH'),TO_CHAR(SYSDATE,'HH12,AM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'HH12:AM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;HH24&lt;/b&gt; ==&amp;gt; Returns the Hour of the day in twenty four hour clock mode. (0-23)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR(SYSDATE,'HH24') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE,TO_CHAR(HIREDATE,'HH24') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;MI&lt;/b&gt; ==&amp;gt; Returns the Minutes from the given date (0-59)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'MI'),TO_CHAR(SYSDATE,'HH:MI') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'MI'),TO_CHAR(HIREDATE,'HH:MI') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;RM&lt;/b&gt; ==&amp;gt; Returns the Roman numeral Month (I - XII)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'RM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'DD-RM-YY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;SS&lt;/b&gt; ==&amp;gt; Returns seconds from the given date (0-59)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'SS'),TO_CHAR(SYSDATE,'HH:MI:SS') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE,TO_CHAR(HIREDATE,'HH:MI:SS') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;SSSS&lt;/b&gt; ==&amp;gt; Display seconds past midnight (0-86399)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'SSSS') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE,'DD-MM-YY, HH:MI:SS, SSSS') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;The punctuation marks that can be used in Date formats are (- ; / ; !; .; ; ; : ; ‘text’)&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;RR Date Format Elements:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The RR date format element is similar to the YY date format element.&lt;/li&gt;
&lt;li&gt;The RR format element provides additional flexibility for storing date values in other Centuries.&lt;/li&gt;
&lt;li&gt;The RR date format element allows to store the date to the previous as well as the text Centuries.&lt;/li&gt;
&lt;li&gt;If the last 2 digits of the Century Year are:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;                    0-49     50-99
0-49 Returns date is in the Current Century. the returns date is in the Preceding Century. 
50-59 Returns date in the next century. Returns date in the current century.
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Date Format Element Suffixes:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;TH&lt;/b&gt; ==&amp;gt; Specifies the Ordinal number.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt; DDTH 20th&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'DDTH, MONTH, YYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,TO_CHAR(HIREDATE, 'DDTH, MONTH, YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;SP&lt;/b&gt; ==&amp;gt; Spells Numbers&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt; DDSP ==&amp;gt; TWENTY&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'DDSP, MONTH, YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,TO_CHAR(HIREDATE,'DDSP, MONTH, YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Spelled Ordinal number&lt;/b&gt; ==&amp;gt; Spells Numbers&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt; DDSPTH ==&amp;gt; TWENTIETH&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'DDSPTH, MONTH, YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,TO_CHAR(HIREDATE,'DDSPTH,MONTH,YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,TO_CHAR(SYSDATE,'DDSPTH MONTH YYYYSP') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Date Format Elements Restrictions:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
The suffixes when added to date return value always in English. Date suffixes are valid only on output, hence cannot be used to insert a date into the database.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;
Format Model Modifiers:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;FM (Fill Mode) ==&amp;gt; it suppresses blank padding in the return value of the TO_CHAR function.&lt;/li&gt;
&lt;li&gt;FX (Format Exact) ==&amp;gt; it specifies exact matching for the character argument and date format model.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, TO_CHAR (SYSDATE,'DDSPTH MONTH YYYYSP'), TO_CHAR (SYSDATE,'FMDDSPTH MONTH YYYYSP') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;TO_NUMBER Function:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
In the below syntax it converts a char. Value of CHAR or VARCHAR2 data type containing a Number in the format specified by the optional format model fmt, to a value of NUMBER data type.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; TO_NUMBER(Char,fmt,’nlsparam’)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_NUMBER('$10,000.00','L99,999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_NUMBER('$1,000.00','L9,999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;TO_DATE Function:&lt;/b&gt;&lt;br /&gt;
In the below syntax, converts char of CHAR or VARCHAR2 datatype to a value of DATE data type. The fmt is a date format specifying format of char.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:/b&amp;gt;  TO_DATE(Char,fmt,'nlsparam');&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;b&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE, ADD_MONTHS(TO_CHAR('17-DEC-1980','DD-MON-YY'),&lt;span style="color: #0000dd; font-weight: bold;"&gt;3&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;
&lt;b&gt;Specification Examples:&lt;/b&gt;&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;b&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(ADD_MONTHS(HIREDATE,&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;),'DD-MON-YYYY') "NEXT_MONTH" EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; ENAME&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'SMITH';
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; CONCAT(CONCAT(ENAME,' IS A '),JOB) DESIGNATION &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; ENO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;7900&lt;/span&gt;;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TRUNC(TO_DATE('01-OCT-90','DD-MON-YY'),&lt;span style="color: #008800; font-weight: bold;"&gt;YEAR&lt;/span&gt;) "&lt;span bold="" color:="" font-weight:="" style="color: red;"&gt;NEW&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;YEAR"&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt; &lt;/span&gt;&lt;span bold="" color:="" font-weight:="" style="color: red;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(ADD_MONTHS(LAST_DAY(HIREDATE),&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;),'DD-MON-YYYY') &lt;span color:="" style="color: red;"&gt;"FIVE_MONTHS"&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;EMP&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; ENAME&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'MARTIN';
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; MONTHS_BETWEEN(TO_DATE('06-06-2016','MM-DD-YYYY'),TO_DATE('01-01-2016','MM-DD-YYYY')) MONTHS &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NEXT_DAY('15-JUN-2016','Wednesday') "&lt;span bold="" color:="" font-weight:="" style="color: red;"&gt;NEXT&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;DAY"&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt; &lt;/span&gt;&lt;span bold="" color:="" font-weight:="" style="color: red;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,NVL(TO_CHAR(COMM),'NOT APPLICABLE') "COMMISSION&lt;span color:="" style="color: red;"&gt;”&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(TO_DATE('14-06-2016','YEAR')) "&lt;span bold="" color:="" font-weight:="" style="color: red;"&gt;NEW&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;YEAR"&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt; &lt;/span&gt;&lt;span bold="" color:="" font-weight:="" style="color: red;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(TO_DATE('14-JUN-16','DD-MON-RR'),'YYYY') &lt;span style="color: #008800; font-weight: bold;"&gt;YEAR&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;b&gt;
&lt;/b&gt;</description><link>https://oracletutorialpoint.blogspot.com/2017/07/date-format-models-in-oracle-sql.html</link><thr:total>1</thr:total><georss:featurename>Bengaluru, Karnataka, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-4697690270696747459</guid><pubDate>Wed, 26 Jul 2017 06:52:00 +0000</pubDate><atom:updated>2022-11-28T22:31:29.982+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">aggregate function</category><category domain="http://www.blogger.com/atom/ns#">avg</category><category domain="http://www.blogger.com/atom/ns#">count</category><category domain="http://www.blogger.com/atom/ns#">distinct in sql</category><category domain="http://www.blogger.com/atom/ns#">group function</category><category domain="http://www.blogger.com/atom/ns#">max</category><category domain="http://www.blogger.com/atom/ns#">min</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">stddev</category><category domain="http://www.blogger.com/atom/ns#">sum</category><category domain="http://www.blogger.com/atom/ns#">variance</category><title>Aggregate or Group Functions in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
These functions return a single row based on group of rows. These can appear in SELECT list and HAVING clauses. These functions operate on sets of rows to give one result per group. The sets may be the whole table or the table split into groups.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Guidelines to use Group Functions:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;DISTINCT keyword makes the function consider only non-duplicate values.&lt;/li&gt;
&lt;li&gt;ALL keyword makes the function to consider every value including duplicates.&lt;/li&gt;
&lt;b&gt;Syntax:&lt;/b&gt; GROUP_FUNCTION_NAME(DISTINCT / ALL / n)
&lt;li&gt;The data type for arguments may CHAR, VARCHAR, NUMBER or DATE.&lt;/li&gt;
&lt;li&gt;All group functions except COUNT (*) ignore NULL values.  The NVL function is used to substitute a value for NULL values.&lt;/li&gt;
&lt;li&gt;If a GROUP function declared in a SELECT statement, no single row columns should be declared.&lt;/li&gt;
&lt;li&gt;When a group function is declared in a SELECT list, other columns can be declared. But, they should be grouped columns and all the non-functional columns.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Average Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the average value of n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; AVG(DISTINCT / ALL / n)&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AVG&lt;/span&gt;(SAL),&lt;span style="color: #008800; font-weight: bold;"&gt;AVG&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; SAL) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AVG&lt;/span&gt;(COMM),&lt;span style="color: #008800; font-weight: bold;"&gt;AVG&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AVG&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;SUM Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the SUM of the values of n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; SUM(DISTINCT / ALL / n)&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SUM&lt;/span&gt;(SAL),&lt;span style="color: #008800; font-weight: bold;"&gt;SUM&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; SAL) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SUM&lt;/span&gt;(COMM),&lt;span style="color: #008800; font-weight: bold;"&gt;SUM&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AVG&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;MAX (Maximum) Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the maximum value of n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; MAX(DISTINCT / ALL / n)&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;MAX&lt;/span&gt;(SAL), &lt;span style="color: #008800; font-weight: bold;"&gt;MAX&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; SAL) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;MAX&lt;/span&gt;(COMM), &lt;span style="color: #008800; font-weight: bold;"&gt;MAX&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; COMM) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;MIN (Minimum) Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the minimum value of the n and it ignores NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; MIN(DISTINCT / ALL /n)&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;MIN&lt;/span&gt;(SAL), &lt;span style="color: #008800; font-weight: bold;"&gt;MIN&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; SAL) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;MIN&lt;/span&gt;(COMM), &lt;span style="color: #008800; font-weight: bold;"&gt;MIN&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; COMM) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Standard Deviation Function (STDDEV):&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the standard deviation value of n and it ignores the NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; STDDEV(DISTINCT / ALL / n)&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; STDDEV(SAL), STDDEV(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; SAL) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; STDDEV(COMM), STDDEV(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; COMM) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Variance Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the variance of n and it ignores the NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; VARIANCE(DISTINCT / ALL / n)&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; VARIANCE(SAL), VARIANCE(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; SAL) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; VARIANCE(COMM), VARIANCE(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; COMM) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;COUNT Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns the number of rows in the query. N evaluates to something other than NULL. It is used to return all rows, including duplicates and NULL values. This function can be used to specify the count of all rows or only distinct values of n.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; COUNT(* / DISTINCT / ALL / n)&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.1em; border: solid white; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;COUNT&lt;/span&gt;(&lt;span style="color: #333333;"&gt;*&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;COUNT&lt;/span&gt;(JOB),&lt;span style="color: #008800; font-weight: bold;"&gt;COUNT&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; JOB) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;COUNT&lt;/span&gt;(SAL),&lt;span style="color: #008800; font-weight: bold;"&gt;COUNT&lt;/span&gt;(COMM) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2017/07/aggregate-or-group-functions-in-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-8954761771208603242</guid><pubDate>Mon, 31 Oct 2016 04:10:00 +0000</pubDate><atom:updated>2022-11-28T22:31:43.893+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">date</category><category domain="http://www.blogger.com/atom/ns#">format models in sql</category><category domain="http://www.blogger.com/atom/ns#">number format</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>Number format models in Oracle SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know more about Number formatting in Oracle SQL.&amp;nbsp;A formatting model is a character literal that describes the format of Number data stored in a character string.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;D&amp;nbsp;&lt;/b&gt;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;;"&gt;à&lt;/span&gt;&lt;b&gt;&amp;nbsp;99D99:&lt;/b&gt;&amp;nbsp;It returns the specified position of the decimal character. Period(.) is the default decimal delimiter. Only one decimal character can be specified in a number format model.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1234&lt;/span&gt;,'&lt;span style="color: #0000dd; font-weight: bold;"&gt;99999D99&lt;/span&gt;') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1234&lt;/span&gt;,'&lt;span style="color: #0000dd; font-weight: bold;"&gt;999D99&lt;/span&gt;') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;EEE&amp;nbsp;&lt;/b&gt;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;;"&gt;à&lt;/span&gt;&lt;b&gt;&amp;nbsp;9.9EEEE:&lt;/b&gt; Returns a value using scientific notation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1234&lt;/span&gt;,'9.9EEEE'), TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1234&lt;/span&gt;,'9.99EEEE') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;G&amp;nbsp;&lt;/b&gt;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;;"&gt;à&lt;/span&gt;&lt;b&gt;&amp;nbsp;9G999:&lt;/b&gt;&amp;nbsp;Returns the specified position of the group separator. Multiple group separators can be specified.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;12345678&lt;/span&gt;,'99G99G999') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, TO_CHAR(SAL,'&lt;span style="color: #0000dd; font-weight: bold;"&gt;99&lt;/span&gt;G999G99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;L&amp;nbsp;&lt;/b&gt;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;;"&gt;à&lt;/span&gt;&lt;b&gt;&amp;nbsp;L999:&lt;/b&gt; Returns the specified position of the local currency symbol.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(123456,'L99999') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,TO_CHAR(1234,'L9999999') CURRENCY &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO=10;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,TO_CHAR(SAL,'L99G999D99','NLS_CURRENCY=IndRupees') SALARY &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;MI&amp;nbsp;&lt;/b&gt;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;;"&gt;à&lt;/span&gt;&lt;b&gt;&amp;nbsp;9999MI:&lt;/b&gt; Returns negative value with a trailing minus sign (-). Return positive value with trailing blank. The MI format should be declared as trailing argument only.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;, 'L99G999D99MI') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,COMM_SAL,COMM,TO_CHAR(COMM&lt;span style="color: #333333;"&gt;-&lt;/span&gt;SAL,'L99999MI') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;30&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;PR&amp;nbsp;&lt;/b&gt;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;;"&gt;à&lt;/span&gt;&lt;b&gt;&amp;nbsp;999PR:&lt;/b&gt;&amp;nbsp;Returns negative value in &amp;lt;angle Brackets&amp;gt;. This can appear only as trailing declaration.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;, 'L99G999D99PR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,COMM_SAL,COMM,TO_CHAR(COMM&lt;span style="color: #333333;"&gt;-&lt;/span&gt;SAL,'L99999PR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;30&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;RN &lt;/b&gt;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt; Returns a value as Roman Number in Upper case.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;rn&lt;/b&gt; &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt; Returns a value as Roman Number in Lower case.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
The value can be an integer between 1 and 9999.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Examples: &lt;/b&gt;&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;, 'RN'), TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'rn') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SAL, 'RN'), TO_CHAR(SAL,'rn') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;S&amp;nbsp;&lt;span style="font-family: &amp;quot;wingdings&amp;quot;;"&gt;à&lt;/span&gt;&amp;nbsp;S9999:&lt;/b&gt;&amp;nbsp;Returns negative value with a leading minus sign and return positive value with a leading plus sign.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;9999S :&lt;/b&gt; Returns negative value with minus sign at trailing. Return positive value with a trailing plus sign. S can appear as first or last value.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'S9999'), TO_CHAR(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'S9999') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,TO_CHAR(SAL,'9999S'), TO_CHAR(SAL,'S9999') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;&lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;pre style="line-height: 16.25px;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'9999S'),TO_CHAR(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'9999S') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;X &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt; XXXX:&lt;/b&gt; Returns the hexadecimal value of the specified number of digits. If the number is not an integer, Oracle rounds it to an integer. Accept only positive values or 0.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,’XXXX’) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,TO_CHAR(SAL,’XXXX’) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Comma(,) &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; font-size: 11.0pt; line-height: 115%;"&gt;à&lt;/span&gt; 9,999:&lt;/b&gt; Returns a comma in the specified position. Multiple commas can be specified.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;10000&lt;/span&gt;,'99,999D99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,TO_CHAR(SAL,'99,999D99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Period(.) &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt;99.99:&lt;/b&gt; returns a decimal point, at the specified position. Only one period can be specified in a number format model.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;10000&lt;/span&gt;,'L99,999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(SAL,'L99,999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;$ &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt; $9999:&lt;/b&gt;&amp;nbsp;Return value with a leading Dollar sign.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;10000&lt;/span&gt;,'$99,999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,TO_CHAR(SAL,'$9,99,999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;0 (ZERO) &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt; 0999:&lt;/b&gt;&amp;nbsp;Returns leading zeros. 9990: returns trailing zero.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'0999999'), TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'09999990') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, TO_CHAR(SAL,'$099,999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;9 &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt; 9999:&lt;/b&gt; Return value with a specified number of digits with a leading space when positive or leading minus when negative.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;600&lt;/span&gt;,'99999'), TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;600&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'99999') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;25&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;,'99999') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;C &lt;span style="font-family: &amp;quot;wingdings&amp;quot;; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"&gt;à&lt;/span&gt; C9999:&lt;/b&gt; returns specified position of the ISO Currency symbol.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TO_CHAR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt;,'C9999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, TO_CHAR(SAL,'C99999.99') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/10/date-or-number-format-models-in-oracle.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-8722400102702158478</guid><pubDate>Fri, 30 Sep 2016 17:02:00 +0000</pubDate><atom:updated>2022-11-28T22:32:00.150+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">conversion functions</category><category domain="http://www.blogger.com/atom/ns#">function</category><category domain="http://www.blogger.com/atom/ns#">functions</category><category domain="http://www.blogger.com/atom/ns#">functions in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>What are different Conversion functions in SQL?</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know what are different DATE Conversion functions in SQL. The conversion functions convert a specific value from one data type
to another data type. There are two different types of Data Type conversion in Oracle. That are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Implicit Datatype Conversion&lt;/li&gt;
&lt;li&gt;Explicit Datatype Conversion&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Implicit Datatype Conversion:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Implicit Datatype conversion work according to the conversion specified by Oracle. The
assignment succeeds if the oracle servers can convert the datatype of the
value. CHAR to NUMBER conversion succeed only if the character strings
represents a valid NUMBER. If the character strings represents the default format DD-MON-YY then only CHAR to DATE conversions succeed.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IN ASSIGNMENT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IN EXPRESSION&lt;br /&gt;
=====================================================================&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Char /&amp;nbsp;Varchar2&amp;nbsp;==&amp;gt; Number &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Char /&amp;nbsp;Varchar2&amp;nbsp;==&amp;gt; Number&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Char /&amp;nbsp;Varchar2&amp;nbsp;==&amp;gt; Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Char /&amp;nbsp;Varchar2&amp;nbsp;==&amp;gt; Date&lt;/li&gt;
&lt;li&gt;Number ==&amp;gt; Varchar2&lt;/li&gt;
&lt;li&gt;Date ==&amp;gt; Varchar2&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Explicit Datatype Conversion:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
SQL provides 3 different functions to convert a specific value from one datatype to another datatype. The functions are,&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;To_Char &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ==&amp;gt; &amp;nbsp; &amp;nbsp;To Convert into Characters&lt;/li&gt;
&lt;li&gt;To_Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ==&amp;gt; &amp;nbsp; &amp;nbsp;To Convert into Date&lt;/li&gt;
&lt;li&gt;To_Number &amp;nbsp; ==&amp;gt; &amp;nbsp; &amp;nbsp;To Convert into Number&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;To_Char Conversion Function:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
This To_Char conversion function can be used in 2 different flavours.&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;To_Char(Number Conversion)&lt;/li&gt;
&lt;li&gt;To_Char(Date Conversion)&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b&gt;1. To_Char(Number Conversion):&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
The To_Char(Number Conversion) function can be used to convert number of number datatype to a value of Varchar2 datatype. In the below syntax 'FMT' is the option number format that can be used and the 'nlsparams' specifies the character returned by the number format element.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; To_Char(Number,FMT,'nlsparams')&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;2. To_Char(Date Conversion):&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
The To_Char(Date Conversion) function can be used to converts Date of DATE datatype to a value of VARCHAR2 datatype in the format specified. In the below syntax, 'FMT' is the optional DATE format that can be used and the 'nlsparams' specifies the language in which and day names and abbreviations are returned.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; To_Char(DATE,FMT,'nlsparams')&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/09/what-are-different-conversion-functions.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-1859860048228778771</guid><pubDate>Thu, 29 Sep 2016 16:39:00 +0000</pubDate><atom:updated>2022-11-28T22:32:15.651+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">date</category><category domain="http://www.blogger.com/atom/ns#">DATETIME Data Type</category><category domain="http://www.blogger.com/atom/ns#">functions in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">truncate function in sql</category><title>What are different DATE functions in SQL?</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to &amp;nbsp;know what all different DATE functions are there in SQL.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;ADD_MONTHS Function:&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
As per the below syntax, ADD_MONTHS function will return DATE d plus n Months. The argument n can be any integer.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;ADD_MONTHS(d,n)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, ADD_MONTHS(SYSDATE,&lt;span style="color: #0000dd; font-weight: bold;"&gt;3&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL, HIREDATE, ADD_MONTHS(HIREDATE,&lt;span style="color: #0000dd; font-weight: bold;"&gt;3&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;MONTHS_BETWEEN Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, MONTHS_BETWEEN function returns no.of Months between Date d1 and Date d2. If d1 is later than d2, the results is positive else negative. If d1 and d2 are either both last days of the Months or the same days of the months, the results is always an integer.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp;MONTHS_BETWEEN(D1,D2)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,HIREDATE,MONTHS_BETWEEN(SYSDATE,HIREDATE) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; MONTHS_BETWEEN(SYSDATE,HIREDATE)&lt;span style="color: #333333;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;222&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,MONTHS_BETWEEN(SYSDATE, HIREDATE) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;NEXT_DAY Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, NEXT_DAY function returns the DATE of the WEEK DAY named by Char, that is later than the DATE d.&amp;nbsp;The CHAR must be a day of the week in the sessions date language. DAY of the
week can be full name or the abbreviation&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; NEXT_DAY(d,CHAR)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE,NEXT_DAY(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'FRI'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,HIREDATE,NEXT_DAY(HIREDATE,&lt;span style="background-color: #fff0f0;"&gt;'MONDAY'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;LAST_DAY Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, LAST_DAY function returns the date of the last day of the month that
contains d. Most commonly used to determine how many days are left in the current
month.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; LAST_DAY(d)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE &lt;span style="color: #008800; font-weight: bold;"&gt;TODAY&lt;/span&gt;, LAST_DAY(SYSDATE) &lt;span style="color: #008800; font-weight: bold;"&gt;LAST&lt;/span&gt;, LAST_DAY(SYSDATE) &lt;span style="background-color: #ffaaaa; color: red;"&gt;–&lt;/span&gt; SYSDATE DAYSLEFT &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;ROUND Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, ROUND function returns Date rounded to the Unit specified by the format. If
format is omitted, date is rounded to the nearest day.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; ROUND(DATE,FORMAT)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'YEAR'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'MONTH'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; SELECTT ROUND(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'DAY'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;TRUNC / Truncating Function:&lt;/b&gt;&lt;br /&gt;
As per the below syntax, it returns Date with the time portion of the day
truncated to the specified unit. If format is omitted, date is truncated to the
nearest day.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; TRUNC(DATE,'FORMAT')&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'DAY'&lt;/span&gt;),TRUNC(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'DAY'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'MONTH'&lt;/span&gt;),TRUNC(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'MONTH'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'YEAR'&lt;/span&gt;),TRUNC(SYSDATE,&lt;span style="background-color: #fff0f0;"&gt;'YEAR'&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/09/what-are-different-date-functions-in-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-4281323534461122346</guid><pubDate>Wed, 28 Sep 2016 15:52:00 +0000</pubDate><atom:updated>2025-01-29T21:37:48.634+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">date</category><category domain="http://www.blogger.com/atom/ns#">functions in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">oracletutorialpoint</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">sysdate</category><title>SYSDATE function in SQL</title><description>&lt;script async="" crossorigin="anonymous" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know about &lt;b&gt;SYSDATE&lt;/b&gt; and &lt;b&gt;DATE arithmetic&lt;/b&gt; functions in SQL. The SYSDATE function in SQL is used to retrieve the current date and time, which Oracle stores in an internal numeric format with a wide range from &lt;b&gt;January 1, 4712 BC&lt;/b&gt; to &lt;b&gt;December 31, 9999 AD&lt;/b&gt;. SQL allows for date arithmetic, enabling users to add or subtract days and hours to/from dates, facilitating various date manipulations through simple arithmetic operations. Examples demonstrate how to implement SYSDATE and date arithmetic using SQL queries effectively.&amp;nbsp;The default display and input
format for any date is &lt;b&gt;DD-MON-YY&lt;/b&gt;.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Century&lt;/li&gt;
&lt;li&gt;Year&lt;/li&gt;
&lt;li&gt;Month&lt;/li&gt;
&lt;li&gt;Day&lt;/li&gt;
&lt;li&gt;Hour&lt;/li&gt;
&lt;li&gt;Minute&lt;/li&gt;
&lt;li&gt;Second&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;SYSDATE:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
SYSDATE is a data function that returns the current date and time. SYSDATE is generally
selected upon a DUMMY table.&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Key Points:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;SYSDATE is a key SQL function that returns the current date and time.&lt;/li&gt;&lt;li&gt;Oracle dates range from January 1, 4712 BC to December 31, 9999 AD and are stored in a numeric format.&lt;/li&gt;&lt;li&gt;The default input and display format for dates in Oracle is DD-MON-YY.&lt;/li&gt;&lt;li&gt;Date arithmetic allows users to add or subtract specific numbers of days or hours to/from dates.&lt;/li&gt;&lt;li&gt;SQL queries can utilize SYSDATE and perform operations such as adding days, subtracting days, or calculating intervals between dates.&lt;/li&gt;&lt;li&gt;Examples of using SYSDATE demonstrate practical applications in retrieving and manipulating hire dates in employee records.&lt;/li&gt;&lt;li&gt;The DUAL table is commonly used in SQL to select values like SYSDATE.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;DATE Arithmetic:&lt;/b&gt;&lt;br /&gt;
As database stores DATE as numbers, Arithmetic operations can be implemented. Number
constants can be added or subtracted upon DATE. The operations those can be
applied are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Date + Number&lt;/b&gt; --&amp;gt; Date: Adds number of days to a date&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Date - Number&lt;/b&gt; --&amp;gt; Date: Number of days subtracted from a date&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Date -  Date &lt;/b&gt;--&amp;gt; Number of days: subtracts one date from another&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Date + Number/24&lt;/b&gt; --&amp;gt; Date: Number of hours adds to a date&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0px;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, SYSDATE &lt;span style="color: #333333;"&gt;+&lt;/span&gt; &lt;b&gt;5&lt;/b&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SYSDATE, SYSDATE &lt;span style="color: red;"&gt;–&lt;/span&gt; &lt;b&gt;5&lt;/b&gt;, SYSDATE &lt;span style="color: #333333;"&gt;+&lt;/span&gt; &lt;b&gt;120&lt;/b&gt;&lt;span style="color: #333333;"&gt;/&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;24&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE, HIREDATE &lt;span style="color: #333333;"&gt;+&lt;/span&gt; &lt;b&gt;5&lt;/b&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE, HIREDATE &lt;span style="color: #333333;"&gt;-&lt;/span&gt; &lt;b&gt;5&lt;/b&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, HIREDATE, HIREDATE &lt;span style="color: red;"&gt;–&lt;/span&gt; SYSDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME, (HIREDATE &lt;span style="color: red;"&gt;–&lt;/span&gt; SYSDATE)&lt;span style="color: #333333;"&gt;/&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;7&lt;/span&gt; WEEKS &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;10&lt;/span&gt;;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/09/sysdate-function-in-sql.html</link><thr:total>8</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-141426262425909555</guid><pubDate>Tue, 27 Sep 2016 16:20:00 +0000</pubDate><atom:updated>2022-11-28T22:32:46.338+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">floor</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">round</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">sqrt function in sql</category><category domain="http://www.blogger.com/atom/ns#">truncate</category><category domain="http://www.blogger.com/atom/ns#">truncate function in sql</category><title>ROUND, TRUNCATE and FLOOR function in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know NUMBER function, ROUND function, TRUNCATE function, CEIL function, FLOOR function, MOD(MODULE) function, POWER function, SQRT(SQUARE ROOT) function, ABS(ABSOLUTE) function and SIGN functions in SQL.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;NUMBER Function:&lt;/b&gt;&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
NUMBER functions accepts number as input and return number as values. Many functions return values that are accurate to 38 decimal digits.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;ROUND Function:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
In the below syntax, it returns ‘n’ rounded to n places
right of the decimal point. If ‘m’ is omitted then n is rounded to 0 places. ‘m’
can be negative and rounds off the digits to the left of the decimal point. ‘m’
must be a integer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Syntax: &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ROUND(n,m)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(&lt;span style="color: #0000dd; font-weight: bold;"&gt;18&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;195&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(&lt;span style="color: #0000dd; font-weight: bold;"&gt;18&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;195&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ROUND(&lt;span style="color: #0000dd; font-weight: bold;"&gt;15648&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;), ROUND(&lt;span style="color: #0000dd; font-weight: bold;"&gt;7854&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;565&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt;), ROUND(&lt;span style="color: #0000dd; font-weight: bold;"&gt;785&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;456&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;b&gt;TRUNCATE Function:&lt;/b&gt;&lt;br /&gt;
In the below syntax, it returns n truncated to m decimal places. If ‘m’ is
omitted, ‘n’ is truncated to 0 places. ‘n’ can be negative to truncate ‘m’
digits left to the decimal point.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;TRUNC(n,m)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TRUNC (&lt;span style="color: #0000dd; font-weight: bold;"&gt;18&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;195&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TRUNC (&lt;span style="color: #0000dd; font-weight: bold;"&gt;18&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;195&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; TRUNC (&lt;span style="color: #0000dd; font-weight: bold;"&gt;15648&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;), TRUNC (&lt;span style="color: #0000dd; font-weight: bold;"&gt;7854&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;565&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt;), TRUNC (&lt;span style="color: #0000dd; font-weight: bold;"&gt;785&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;456&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;CEIL Function:&lt;/b&gt;&lt;br /&gt;
In the below syntax, it returns the smallest integer greater than or equals to
‘n’. the adjustment is done to the highest nearest decimal value.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax: &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CEIL(n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; CEIL(&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;7&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; CEIL(&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;37&lt;/span&gt;), CEIL(&lt;span style="color: #0000dd; font-weight: bold;"&gt;45&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;45&lt;/span&gt;), CEIL(&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;FLOOR Function:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
In the below syntax, it returns the largest integer less
than or equals than n. The adjustment is done to the lowest nearest decimal
values.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FLOOR(n)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; FLOOR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;7&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; FLOOR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;28&lt;/span&gt;), FLOOR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;45&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;3&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;MODULES Function:&lt;/b&gt;&lt;/div&gt;
In the below syntax, MOD function returns remainder m divided by n. It returns m if n is 0.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;MOD(n,m)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;MOD&lt;/span&gt;(&lt;span style="color: #0000dd; font-weight: bold;"&gt;14&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;4&lt;/span&gt;), &lt;span style="color: #008800; font-weight: bold;"&gt;MOD&lt;/span&gt;(&lt;span style="color: #0000dd; font-weight: bold;"&gt;40&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;POWER Function:&lt;/b&gt;&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
In the below syntax, it returns m raised to the n power. The
base m and the exponent n can be any numbers. If m is negative then n must be an
integer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Syntax: &lt;/b&gt;&amp;nbsp; &amp;nbsp;POWER(m,n)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; POWER(&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;), POWER(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; POWER(&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;), POWER(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; POWER(&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;), POWER(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;SQUARE ROOT Function:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
In the below syntax, it returns square root of n. The value
of n cannot be negative. SQRT returns a real result.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; SQRT(n)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SQRT(&lt;span style="color: #0000dd; font-weight: bold;"&gt;36&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;ABSOLUTE Function:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
In the below syntax, it returns the absolute value of n.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; ABS(n)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;ABS&lt;/span&gt;(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SAL,COMM,SAL&lt;span style="color: #333333;"&gt;-&lt;/span&gt;COMM, &lt;span style="color: #008800; font-weight: bold;"&gt;ABS&lt;/span&gt;(SAL&lt;span style="color: #333333;"&gt;-&lt;/span&gt;COMM) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;SIGN Function:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
In the below syntax, it returns the SIGN(signification of a
number).&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;If
n&amp;lt;0, return -1&lt;/li&gt;
&lt;li&gt;If
n=0, return 0&lt;/li&gt;
&lt;li&gt;If
n&amp;gt;0, return 1&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Syntax: &amp;nbsp; &amp;nbsp; SIGN(n)&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SIGN(&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;), SIGN(&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;), SIGN(&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,COMM,SIGN(SAL&lt;span style="color: #333333;"&gt;-&lt;/span&gt;COMM) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SIGN(SAL&lt;span style="color: #333333;"&gt;-&lt;/span&gt;COMM)&lt;span style="color: #333333;"&gt;=-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/09/round-truncate-and-floor-function-in-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-588146462690959479</guid><pubDate>Mon, 26 Sep 2016 16:48:00 +0000</pubDate><atom:updated>2022-11-28T22:33:02.556+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">functions in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">PAD</category><category domain="http://www.blogger.com/atom/ns#">replace</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">trim</category><category domain="http://www.blogger.com/atom/ns#">trim functions in sql</category><category domain="http://www.blogger.com/atom/ns#">truncate</category><category domain="http://www.blogger.com/atom/ns#">truncate function in sql</category><title>PAD, TRIM, REPLACE, TRANSLATE and ASCII Functions in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know about LPAD &amp;amp; RPAD functions,TRIM function, REPLACE function, TRANSLATE function, CHR function and ASCII functions in SQL.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;LPAD Function:&lt;/b&gt;&lt;br /&gt;
Pads
the character value left justified to a total width of n character position. Space is the default padding character.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;LPAD(Char1,n,Char2)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; LPAD('Page 1',&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;,'*.') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; LPAD('Page 1',&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,LPAD(NAME,&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,'-') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL&lt;span style="color: #333333;"&gt;&amp;gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2500&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
RPAD Function:&lt;br /&gt;
Pads the character value right justified to a total size of n character positions. Space is the default padding character.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;RPAD(Char1,n, Char2)
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; RPAD('Page 1',&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;,'*.') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; RPAD('Page 1',&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,RPAD(NAME,&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,'-') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL&lt;span style="color: #333333;"&gt;&amp;gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2500&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;TRIM Function:&lt;/b&gt;&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
TRIM function enables to trim heading or trailing characters or together from a character string. If Leading is defined concentrates on leading
characters. If Trailing is specified focuses on trailing characters. If both or none is specified concentrates both on leading and trailing. Return the
VARCHAR2 type.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Syntax: &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;TRIM(&lt;/b&gt;&lt;b&gt;Trailing /&amp;nbsp;&lt;/b&gt;&lt;b&gt;Leading
/ Both, Trim character From Trim source)&lt;/b&gt;&lt;br /&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TRIM&lt;/span&gt;('R','RAAM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TRIM&lt;/span&gt;('R','RAAMA') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TRIM&lt;/span&gt;('R','RRAAMRR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TRIM&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;Trailing&lt;/span&gt; 'R' &lt;span style="color: #008800; font-weight: bold;"&gt;From&lt;/span&gt; ,'RRAAMRR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TRIM&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;Leading&lt;/span&gt; 'R' &lt;span style="color: #008800; font-weight: bold;"&gt;From&lt;/span&gt;,'RRAAMRR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TRIM&lt;/span&gt;(&lt;span style="color: #008800; font-weight: bold;"&gt;Both&lt;/span&gt; 'R' &lt;span style="color: #008800; font-weight: bold;"&gt;From&lt;/span&gt;,'RRAAMRR') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;b&gt;LTRIM Function:&lt;/b&gt;&lt;br /&gt;
LTRIM function enables trim heading character from a character string. All the left characters that seems within the set are removed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LTRIM(Char,set)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; LTRIM('XYZ LAST WORD','XY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; JOB, LTRIM(JOB) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; 'MANAGER';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;RTRIM Function:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
RTRIM function enables the trimming of trailing characters from a character string. All the
rightmost characters that appear in the set are removed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax: &amp;nbsp; &amp;nbsp; &amp;nbsp; RTRIM(Char,set)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; RTRIM('SWIMMINGxyXxy','xy') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; RTRIM(JOB,'R'),JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; LTRIM(JOB,'MAN') &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; 'GER';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;REPLACE Function:&lt;/b&gt;&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
REPLACE function returns the every incidence of search string replaced by
the replacement string. If the replacement string is omitted or NULL, all
incidences of search string are removed. It substitutes one string for another
as well as to remove character strings.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Syntax:&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;REPLACE(Char,Search_Str,Replace_Str)&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;REPLACE&lt;/span&gt;('Jack and Jue','J','Bl');

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,&lt;span style="color: #008800; font-weight: bold;"&gt;REPLACE&lt;/span&gt;(JOB,'MAN','DAM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; JOB,&lt;span style="color: #008800; font-weight: bold;"&gt;REPLACE&lt;/span&gt;(JOB,'MAN','EXECUTIVE') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'SALESMAN';
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;b&gt;TRANSLATE Function:&lt;/b&gt;&lt;br /&gt;
TRANSLATE function is used to Translate Character by character in a String.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax: &amp;nbsp; TRANSLATE(char,FROM,TO)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
TRANSLATE function returns a char with all incidences of each character in ‘FROM’ replaced by its
corresponding character in ‘TO’. Characters in char that aren't in FROM aren't replaced. The argument FROM can contain more characters than TO. If the
extra characters seems in Char they're removed from the return value.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt;  JOB,&lt;span style="color: #008800; font-weight: bold;"&gt;TRANSLATE&lt;/span&gt;(JOB,'P',' ') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'PRESIDENT';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; JOB,&lt;span style="color: #008800; font-weight: bold;"&gt;TRANSLATE&lt;/span&gt;(JOB,'MN','OM') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; JOB,&lt;span style="color: #008800; font-weight: bold;"&gt;TRANSLATE&lt;/span&gt;(JOB,'A','O') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'SALAESMAN';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;CHR Function:&lt;/b&gt;&lt;br /&gt;
CHR function returns a character having the binary equivalent to ‘n’. CHR function returns the
similar for ‘n’ in database character set or national character set.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax: &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;CHR(n)&amp;nbsp;&amp;nbsp; 
CHR(n using NCHAR_CS)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; CHR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;67&lt;/span&gt;) &lt;span style="color: #333333;"&gt;||&lt;/span&gt; CHR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;65&lt;/span&gt;) &lt;span style="color: #333333;"&gt;||&lt;/span&gt; CHR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;84&lt;/span&gt;) SAMPLE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; CHR(&lt;span style="color: #0000dd; font-weight: bold;"&gt;16705&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;Using&lt;/span&gt; NCHAR_CS) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;ASCII Function:&lt;/b&gt;&lt;br /&gt;
ASCII function represents the decimal representation in the character database set of the
first characters of the Char.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax: &amp;nbsp; &amp;nbsp;&amp;nbsp;ASCII(Char)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ASCII('A'), ASCII('APPLE') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/09/pad-trim-replace-translate-and-ascii.html</link><thr:total>1</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-5696777464378439953</guid><pubDate>Tue, 20 Sep 2016 17:41:00 +0000</pubDate><atom:updated>2022-11-28T22:33:20.284+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">function</category><category domain="http://www.blogger.com/atom/ns#">functions</category><category domain="http://www.blogger.com/atom/ns#">functions in sql</category><category domain="http://www.blogger.com/atom/ns#">length</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">string</category><category domain="http://www.blogger.com/atom/ns#">substring</category><title>String Functions in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;div class="MsoNormal"&gt;
Read this Oracle Tutorial Point article to know &lt;b&gt;SUBSTR&lt;/b&gt;, &lt;b&gt;LENGTH&lt;/b&gt; and &lt;b&gt;INSTR&lt;/b&gt; functions in String functions in SQL in Oracle database.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;SUBSTR&lt;/b&gt;(SUBSTRING) &lt;b&gt;Function:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
SUBSTR function returns described characters from character value, starting
from a specified position ‘m’, to ‘n’ character long.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Important Points:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;If
m is 0, it is treated as 1.&lt;/li&gt;
&lt;li&gt;If
m is Positive(+), Oracle counts from the beginning of char to identify the first
character.&lt;/li&gt;
&lt;li&gt;If
m is Negative(-), Oracle counts backwards from the end of the character.&lt;/li&gt;
&lt;li&gt;If
n is Omitted, Oracle returns all characters to last of Char.&lt;/li&gt;
&lt;li&gt;If
n is less than 1 or 0, a NULL is returned.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Floating point numbers passed as arguments to SUBSTR are automatically converted to
Integers.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;SUBSTR(Col/Expr,m,n)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SUBSTR('ABCDEFGHIJK',&lt;span style="color: #0000dd; font-weight: bold;"&gt;3&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;4&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SUBSTR('ABCDEFGHIJK',&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;4&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SUBSTR('ABCDEFGHIJK',&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;4&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SUBSTR('ABCDEFGHIJK',&lt;span style="color: #0000dd; font-weight: bold;"&gt;4&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; SUBSTR('ABCDEFGHIJK',&lt;span style="color: #0000dd; font-weight: bold;"&gt;4&lt;/span&gt;,&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;LENGTH Function:&lt;/b&gt;&lt;br /&gt;
Return
the number of characters in a value. If the char has data type CHAR, the length
includes all trailing blanks. If the char is NULL, it returns NULL.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;LENGTH(Column/Expression)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LENGTH&lt;/span&gt; ('SUBBAREDDY') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LENGTH&lt;/span&gt;(NAME) &lt;span style="color: #333333;"&gt;||&lt;/span&gt; ' Characters exit in ' &lt;span style="color: #333333;"&gt;||&lt;/span&gt; INITCAP(NAME) &lt;span style="color: #333333;"&gt;||&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;'s Name.' &lt;span style="color: #008800; font-weight: bold;"&gt;AS&lt;/span&gt; ' Names and Lengths ' &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; INITCAP(NAME), JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LENGTH&lt;/span&gt;(JOB)&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;7&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;INSTR&lt;/b&gt;(INSTRING) &lt;b&gt;Function:&lt;/b&gt;&lt;br /&gt;
It
returns the numeric position of a named character.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;INSTR
(Column/Expression, Char, n,m)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Important Points:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Searches
for Column / Expression beginning with its n’th character for the m’th
occurrence of char2 and returns the position of the character of this
occurrence.&lt;/li&gt;
&lt;li&gt;N
can be positive or negative, if negative searches backward from the end of
column expression.&lt;/li&gt;
&lt;li&gt;The
value of ‘m’ should be positive.&lt;/li&gt;
&lt;li&gt;The
default values of both m and n are 1.&lt;/li&gt;
&lt;li&gt;The
return value is relative to the beginning of char1 regardless of the values of
n and is expressed in characters.&lt;/li&gt;
&lt;li&gt;If
the search is unsuccessful, the return value is zero.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; INSTR('String','r') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; INSTR('CORPORATE LOOR','OR',&lt;span style="color: #0000dd; font-weight: bold;"&gt;3&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; INSTR('CORPORATE FLOOR','OR',&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;3&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; JOB,INSTR(JOB,'A',&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; JOB,INSTR(JOB,'A',&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'MANAGER';&lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; JOB,INSTR(JOB,'A',&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'MANAGER';&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/09/string-functions-in-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-1051192859445555686</guid><pubDate>Mon, 19 Sep 2016 17:46:00 +0000</pubDate><atom:updated>2022-11-28T22:33:33.639+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">concat</category><category domain="http://www.blogger.com/atom/ns#">function</category><category domain="http://www.blogger.com/atom/ns#">functions</category><category domain="http://www.blogger.com/atom/ns#">functions in sql</category><category domain="http://www.blogger.com/atom/ns#">initcap</category><category domain="http://www.blogger.com/atom/ns#">lower</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">upper</category><title>Character Manipulation Functions in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;div class="MsoNormal"&gt;
Read this Oracle Tutorial Point article to know behaviour of Character, LOWER,
UPPER, INITCAP and CONCAT functions in SQL with examples.&lt;br /&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;span style="text-indent: -18pt;"&gt;Character Function&lt;/span&gt;&lt;span style="text-indent: -18pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="text-indent: -18pt;"&gt;:&lt;/span&gt;&lt;/b&gt;&lt;span style="text-indent: -18pt;"&gt;&amp;nbsp;It a&lt;/span&gt;&lt;span style="text-indent: -18pt;"&gt;ccept
Character input and can return both Character and Number value.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-indent: -18pt;"&gt;&lt;b&gt;Number Function :&lt;/b&gt; It a&lt;/span&gt;&lt;span style="text-indent: -18pt;"&gt;ccept Number as input and return Number values.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-indent: -18pt;"&gt;&lt;b&gt;Date Function:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;Operate
on values of data type can return both Date and Number.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Conversation Function:&lt;/b&gt;&amp;nbsp;Convert
a value from one data type to another.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;General Function :&lt;/b&gt; NVL,DECODE ----&amp;nbsp;Operates
on any datatype and can return any datatype.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Character Functions:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Character functions returns the character values, unless
stated. They return the datatype VARCHAR2 and it’s limited to a length of 4000
bytes. If the return value go beyond the length, then the return value is truncated,
without an error. The functions are categorised as,&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;CHARACTER
MANIPULATION.&lt;/li&gt;
&lt;li&gt;CASE
CONVERSION.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Character Manipulation Functions:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;LOWER Function :&lt;/b&gt; LOWER function converts Alpha character values to LOWERcase. The return value has the same datatype as argument char type(CHAR or VARCHAR2).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;LOWER
(EXPRESSION&amp;nbsp;/&amp;nbsp;COLUMN)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LOWER&lt;/span&gt;('SUBBAREDDY NALLAMACHU') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME, &lt;span style="color: #008800; font-weight: bold;"&gt;LOWER&lt;/span&gt;('MY INFORMATION') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME, &lt;span style="color: #008800; font-weight: bold;"&gt;LOWER&lt;/span&gt;(NAME) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;=&lt;/span&gt; 'MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; 'The' &lt;span style="color: #333333;"&gt;||&lt;/span&gt; NAME&lt;span style="color: #333333;"&gt;||&lt;/span&gt;'s Designation is ' &lt;span style="color: #333333;"&gt;||&lt;/span&gt; JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; OWER(JOB)&lt;span style="color: #333333;"&gt;=&lt;/span&gt;'MANAGER';
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;UPPER Function:&lt;/b&gt;&lt;br /&gt;
Upper
function converts the Alpha character values to capital letters. The return
value has the same datatype as the argument char.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;UPPER
(Column/Expression)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;UPPER&lt;/span&gt;('Oracle Corporation') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME, &lt;span style="color: #008800; font-weight: bold;"&gt;UPPER&lt;/span&gt;('My Information') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME, &lt;span style="color: #008800; font-weight: bold;"&gt;UPPER&lt;/span&gt;(NAME) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;=&lt;/span&gt; 'MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME, &lt;span style="color: #008800; font-weight: bold;"&gt;LOWER&lt;/span&gt;(NAME), &lt;span style="color: #008800; font-weight: bold;"&gt;UPPER&lt;/span&gt;(NAME) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;=&lt;/span&gt; 'MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;UPPER&lt;/span&gt;('Manager');
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;INITCAP Function:&lt;/b&gt;&lt;br /&gt;
INITCAP function converts the Alpha character values to capital for the first letter of
every word, keeping all other letters in Lowercase. Words are delimited by
white spaces or character those are not alphanumeric.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;INITCAP(Column
/ Expression)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; INITCAP('subbareddy nallamachu') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; 'The Job Title for '&lt;span style="color: #333333;"&gt;||&lt;/span&gt; INITCAP(NAME)&lt;span style="color: #333333;"&gt;||&lt;/span&gt; ' is ' &lt;span style="color: #333333;"&gt;||&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;LOWER&lt;/span&gt;(JOB) Details &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EXP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME, &lt;span style="color: #008800; font-weight: bold;"&gt;LOWER&lt;/span&gt;(NAME),INITCAP(NAME),&lt;span style="color: #008800; font-weight: bold;"&gt;UPPER&lt;/span&gt;(NAME) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;CONCAT Function:&lt;/b&gt;&lt;br /&gt;
CONCAT function concatenates the first character value to the second character value.
Only two parameters accept. It returns the character data type&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;CONCAT(Column1/Expr1,
Column2/Expr2)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; CONCAT('ORACLE','CORPORATION') &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DUAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB,CONCAT(NAME,JOB) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; CONCAT('The Employee Name is ', INITCAP(NAME)) &lt;span style="color: #008800; font-weight: bold;"&gt;AS&lt;/span&gt; 'Employee Names ' &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP&lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt;(&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;30&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Case conversion functions will discuss in coming articles.&lt;/div&gt;
&lt;div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/09/character-manipulation-functions-in-sql.html</link><thr:total>1</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-5066479485277932703</guid><pubDate>Sat, 23 Jul 2016 12:26:00 +0000</pubDate><atom:updated>2022-11-28T22:33:51.195+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">order by</category><category domain="http://www.blogger.com/atom/ns#">order by clause in sql</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>ORDER BY Clause in SQL with examples</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know what is the use of ORDER BY clause in SQL in ORACLE database. The order of rows returned in a query results are undefined. The ORDER BY clause can
be used to sort the rows. The ORDER BY clause should be the last clause in the
order of all clauses declared in the SELECT statement. An expression or an alias can be
prescribed to sort. By default ordering of data is ascending.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Numbers 1 to 999&lt;/li&gt;
&lt;li&gt;Dates Earliest – latest&lt;/li&gt;
&lt;li&gt;String A-Z; NULLS --&amp;gt; Last&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Syntax:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; [*|COLUMN_NAME(separated by comma(,))] &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TABLE_&lt;/span&gt;NAME &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;[&lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; CONDITION(S)] &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;[&lt;span style="color: #008800; font-weight: bold;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BY&lt;/span&gt; {&lt;span style="color: #008800; font-weight: bold;"&gt;COLUMN&lt;/span&gt;,EXPR}[&lt;span style="color: #008800; font-weight: bold;"&gt;ASC&lt;/span&gt;&lt;span style="color: #333333;"&gt;/&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;DESC&lt;/span&gt;]];
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The default ordering on a column is ascending to modify the default ordering DESC should be used after the column name. Sorting is implemented on column aliases and also be implemented upon multiple columns. The controversy of sorting is broken only when there rises a conflict of consistency upon the data in a column.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Query using ORDER BY clause:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB,DNO,HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BY&lt;/span&gt; HIREDATE;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB,DNO,HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BY&lt;/span&gt; HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;DESC&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB,DNO,HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;='&lt;/span&gt;MANAGER' &lt;span style="color: #008800; font-weight: bold;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BY&lt;/span&gt; SAL;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB,DNO,HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2500&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BY&lt;/span&gt; JOB,NAME &lt;span style="color: #008800; font-weight: bold;"&gt;DESC&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB,DNO,HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;ORDER&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BY&lt;/span&gt; DNO,SAL,HIREDATE;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Single and Multiple Row functions:&lt;/b&gt;&lt;br /&gt;
The single row function can appear in&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;SELECT statement&lt;/li&gt;
&lt;li&gt;WHERE clause&lt;/li&gt;
&lt;li&gt;START WITH clause&lt;/li&gt;
&lt;li&gt;CONNECT BY clause&lt;/li&gt;
&lt;/ul&gt;
Types of single row functions are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;NUMBER.&lt;/li&gt;
&lt;li&gt;CHARACTER.&lt;/li&gt;
&lt;li&gt;DATE.&lt;/li&gt;
&lt;li&gt;CONVERSION.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Single Row Function:&lt;/b&gt;&lt;br /&gt;
They are used to manipulate data items. They accept one or more arguments and returns only one value for each row returned by the query. An argument can be,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;User Supplied Constants.&lt;/li&gt;
&lt;li&gt;Variable Values.&lt;/li&gt;
&lt;li&gt;Column Names.&lt;/li&gt;
&lt;li&gt;Expressions.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Syntax:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;Func_name (&lt;span style="color: #008800; font-weight: bold;"&gt;column&lt;/span&gt;&lt;span style="color: #333333;"&gt;/&lt;/span&gt;expr [arg1,arg2,.....])
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Features of Single Row Functions:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Acts on every row returned in the QUERY.&lt;/li&gt;
&lt;li&gt;Return only one result per row.&lt;/li&gt;
&lt;li&gt;May return a different type of value data value than the referenced data type.&lt;/li&gt;
&lt;li&gt;May expert one or more than one argument.&lt;/li&gt;
&lt;li&gt;Can be used in SELECT, WHERE and ORDER BY Clause.&lt;/li&gt;
&lt;li&gt;Can be nested.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Multiple Row Functions:&lt;/b&gt;&lt;br /&gt;
These functions manipulate multiples of rows to give one result per group of rows.</description><link>https://oracletutorialpoint.blogspot.com/2016/07/order-by-clause-in-sql-with-examples.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-1569341556504027075</guid><pubDate>Sat, 23 Jul 2016 07:45:00 +0000</pubDate><atom:updated>2022-11-28T22:34:07.058+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">between and operator in sql</category><category domain="http://www.blogger.com/atom/ns#">like operator in sql</category><category domain="http://www.blogger.com/atom/ns#">not like operator in sql</category><category domain="http://www.blogger.com/atom/ns#">not null operator in sql</category><category domain="http://www.blogger.com/atom/ns#">null operator in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">sql plus operator</category><title>SQL PLUS Operators in Oracle</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know more about the BETWEEN - AND and NOT BETWEEN - AND, IN and NOT IN, IS NULL or IS NOT NULL, LIKE and NOT LIKE operators in SQL in Oracle Database.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;BETWEEN - AND and NOT BETWEEN - AND:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
This order is used to show rows based on a range of
values. The declared range is inclusive. The lower limit should be declared
first.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Query for Between….And:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL &lt;span style="color: #008800; font-weight: bold;"&gt;BETWEEN&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;1500&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #008800; font-weight: bold;"&gt;BETWEEN&lt;/span&gt; 'MANAGER' &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; 'CLERCK';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;BETWEEN&lt;/span&gt; '&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;APR&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; '&lt;span style="color: #0000dd; font-weight: bold;"&gt;01&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;OCT&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Query for Not Between…And:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BETWEEN&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;1000&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;1500&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BETWEEN&lt;/span&gt; 'MANAGER' &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; 'CLERCK';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;BETWEEN&lt;/span&gt; '&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;APR&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; '&lt;span style="color: #0000dd; font-weight: bold;"&gt;01&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;OCT&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;IN &amp;amp; NOT IN Operator:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The operator is used to test for values in a defined list. The operator can be used upon any data type.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Query using IN Operator:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; NAME &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; ('SUBBA','REDDY');

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;);

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; ('&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;APR&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt; , '&lt;span style="color: #0000dd; font-weight: bold;"&gt;01&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;OCT&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Query using NOT IN Operator:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; NAME &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; ('SUBBA','REDDY');

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;,&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;);

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;IN&lt;/span&gt; ('&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;APR&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt; , '&lt;span style="color: #0000dd; font-weight: bold;"&gt;01&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;OCT&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;IS NULL &amp;amp; IS NOT NULL Operator:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The operator tests for NULL values. It is the only operator that is used to test for NULL’s. NULL means the value is unavailable, unassigned, unknown or inapplicable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Query using NULL Operator:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,DNO,COMM,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; COMM &lt;span style="color: #008800; font-weight: bold;"&gt;IS&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NULL&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,DNO,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; MGR &lt;span style="color: #008800; font-weight: bold;"&gt;IS&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NULL&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Query using NOT NULL Operator:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,DNO,COMM &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; COMM &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NULL&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,DNO,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; MGR &lt;span style="color: #008800; font-weight: bold;"&gt;IS&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NULL&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;LIKE &amp;amp; NOT LIKE Operator:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The LIKE Operator is used to search for a matching character. The character pattern matching operator is referred as a wild chad search. The accessible wild cards in Oracle are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;/ represent any one character at that position.&lt;/li&gt;
&lt;li&gt;% used to represent any sequence of ZERO or more characters.&lt;/li&gt;
&lt;/ul&gt;
The wild card symbol can be used in any combination with literal characters. For getting exact match for ‘%’ and ‘-’ the ESCAPE option has to be used, which is ‘/’ symbol with ESCAPE option.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Query using LIKE Operator:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; NAME &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; 'S&lt;span style="color: #333333;"&gt;%;&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; NAME &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; '_A&lt;span style="color: #333333;"&gt;%'&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; NAME&lt;span style="color: #333333;"&gt;='&lt;/span&gt;SM&lt;span style="color: #333333;"&gt;%;&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DEPT &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNAME &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; '&lt;span style="color: #333333;"&gt;%\&lt;/span&gt;_&lt;span style="color: #333333;"&gt;%'&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;ESCAPE&lt;/span&gt; '\';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Query using NOT LIKE Operator:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; NAME &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; 'S&lt;span style="color: #333333;"&gt;%'&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; NAME &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; '_A&lt;span style="color: #333333;"&gt;%'&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; NAME,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; 'SM&lt;span style="color: #333333;"&gt;%'&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DEPT &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNAME &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;LIKE&lt;/span&gt; '&lt;span style="color: #333333;"&gt;%\&lt;/span&gt;_&lt;span style="color: #333333;"&gt;%'&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;ESCAPE&lt;/span&gt; '\';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;</description><link>https://oracletutorialpoint.blogspot.com/2016/07/sql-plus-operators-in-oracle.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-4977460275124770937</guid><pubDate>Sat, 23 Jul 2016 05:54:00 +0000</pubDate><atom:updated>2022-11-28T22:34:21.901+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">logical operators in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>Logical Operators in Oracle SQL</title><description>
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point point article to know about Logical operators in SQL. The Logical operator combines the results of two components
conditions to produce a single result in SQL. The logical operators exists in Oracle
are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;AND&lt;/li&gt;
&lt;li&gt;OR&lt;/li&gt;
&lt;li&gt;NOT&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;u&gt;AND Operator:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
AND Operator returns TRUE if both or all component conditions are TRUE. AND operator returns FALSE if either is FALSE else returns Unknown.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Truth Table of AND:&lt;/b&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184;"&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
AND&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
TRUE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
FALSE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border-top: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
TRUE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
T&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
F&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border-top: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
FALSE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
F&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
F&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
F&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border-top: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
F&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,JOB,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL&lt;span style="color: #333333;"&gt;&amp;gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1100&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;='&lt;/span&gt;CLERK';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,JOB,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;='&lt;/span&gt;MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL&lt;span style="color: #333333;"&gt;&amp;gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1500&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; SAL&lt;span style="color: #333333;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;5000&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;OR Operator:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
OR operator returns TRUE if either component conditions is TRUE. OR operator returns FALSE if both are FALSE else returns unknown.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Truth Table of OR:&lt;/b&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184;"&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
OR&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
TRUE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
FALSE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border-top: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
TRUE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
T&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
T&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
T&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border-top: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
FALSE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
T&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
F&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border-top: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
T&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,JOB,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;&amp;gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1100&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;OR&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;CLERK';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,JOB,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #333333;"&gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;OR&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;MANAGER;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;&amp;gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1200&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;OR&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;&amp;lt; &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;6000&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO &lt;span style="color: #333333;"&gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;OR&lt;/span&gt; DNO &lt;span style="color: #333333;"&gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;&amp;gt;= '&lt;/span&gt;CLERK' &lt;span style="color: #008800; font-weight: bold;"&gt;OR&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;MANAGER';
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;NOT Operator:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
NOT operator returns TRUE is the following condition is FALSE. If the following condition it TRUE, NOT operator return FALSE. If the condition is unknown, NOT operator returns unknown.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Truth Table of NOT:&lt;/b&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184;"&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
TRUE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
FALSE&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="background: #C4BC96; border-left: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style="background: #C4BC96; border-top: none; border: solid windowtext 1.0pt; mso-background-themecolor: background2; mso-background-themeshade: 191; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NOT&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.5pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
F&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
T&lt;/div&gt;
&lt;/td&gt;
  &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 115.55pt;" valign="top" width="154"&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
NULL&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;b&gt;Combination of AND and OR Operator:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,JOB,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; (SAL &lt;span style="color: #333333;"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1400&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;OR&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;CLERK') &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; DNO &lt;span style="color: #333333;"&gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,JOB,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; (DNO &lt;span style="color: #333333;"&gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;MANAGER') &lt;span style="color: #008800; font-weight: bold;"&gt;OR&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;&amp;gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;2000&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;6000&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;&amp;lt; &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;6000&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; HIREDATE &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;MAY&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;16'&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;NOT&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;= '&lt;/span&gt;SALESMAN' &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; DNO &lt;span style="color: #333333;"&gt;= &lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;30&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Precedence Rules:&lt;/b&gt;&lt;br /&gt;
The default precedence order is,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;All comparison operators.&lt;/li&gt;
&lt;li&gt;NOT Operator.&lt;/li&gt;
&lt;li&gt;AND Operator.&lt;/li&gt;
&lt;li&gt;OR Operator.&lt;/li&gt;
&lt;/ul&gt;
The precedence is controlled by using parenthesis.</description><link>https://oracletutorialpoint.blogspot.com/2016/07/logical-operators-in-oracle-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-1800114388553219636</guid><pubDate>Sat, 23 Jul 2016 05:21:00 +0000</pubDate><atom:updated>2022-11-28T22:34:41.415+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">distinct in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">where clause in sql</category><title>DISTINCT and WHERE clause in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know how to use DISTINCT and WHERE clause and what are all conditions to follow while using these clauses in SQL in Oracle Database.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;DISTINCT CLAUSE:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Until it is instructed SQL * Plus displays the results of a query while not eliminating duplicate rows. To eliminate the duplicate rows in the result the DISTINCT keyword is used. Multiple columns are declared next to the DISTINCT qualifier. The DISTINCT qualifier affects all the selected columns and describe a distinct combination of the columns.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt; JOB, DNO &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;WHERE CLAUSE:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The number of rows returned by a query can be limited/filter by using the WHERE clause. A WHERE clause contains a restriction that must be met and should directly follow the FROM clause.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; [&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt;] {&lt;span style="color: #333333;"&gt;*|&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Column1&lt;/span&gt; [&lt;span style="color: #008800; font-weight: bold;"&gt;alias&lt;/span&gt;],&lt;span style="color: #008800; font-weight: bold;"&gt;Column2&lt;/span&gt; [&lt;span style="color: #008800; font-weight: bold;"&gt;alias&lt;/span&gt;],....} &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TABLE&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;       [&lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; condition(s)];&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The WHERE clause can compares, &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Value in columns&lt;/li&gt;
&lt;li&gt;Arithmetic Expressions&lt;/li&gt;
&lt;li&gt;Literal Values&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;/ul&gt;
The components of WHERE clauses are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Column Name&lt;/li&gt;
&lt;li&gt;Comparison Operator&lt;/li&gt;
&lt;li&gt;Column Name, Constants or list of values.&lt;/li&gt;
&lt;/ul&gt;
The character string and date should be enclosed in single quotes marks. Character value is case sensitive and date value is format sensitive {DD-MMM-YY}. The comparison operator is used in conditions that compare one expression to a different expression. The different comparison operators are (=, &amp;lt;&amp;gt;, != ,^=,, &amp;lt;, &amp;lt;=,&amp;gt;, &amp;gt;=). The format of the WHERE clause is WHERE expr operator value.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB&lt;span style="color: #333333;"&gt;='&lt;/span&gt;MANAGER';

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,HIREDATE,DNO,SAL  &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL  &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; SAL&lt;span style="color: #333333;"&gt;&amp;gt;=&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;5000&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME &lt;span style="color: #333333;"&gt;||&lt;/span&gt; 'JOINED &lt;span style="color: #008800; font-weight: bold;"&gt;On'&lt;/span&gt; &lt;span style="color: #333333;"&gt;||&lt;/span&gt; HIREDATE 'EMPLOYEES JOINING DATES' &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; HIREDATE&lt;span style="color: #333333;"&gt;='&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;01&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;OCT&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;90'&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME &lt;span style="color: #333333;"&gt;||&lt;/span&gt; 'Works &lt;span style="color: #008800; font-weight: bold;"&gt;in&lt;/span&gt; Department' &lt;span style="color: #333333;"&gt;||&lt;/span&gt; DNO 'EMPLOYEES  &lt;span style="color: #008800; font-weight: bold;"&gt;AND&lt;/span&gt; DEPARTMENTS' &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; DNO&lt;span style="color: #333333;"&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;20&lt;/span&gt;;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,DNO,JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP &lt;span style="color: #008800; font-weight: bold;"&gt;WHERE&lt;/span&gt; JOB &lt;span style="color: #333333;"&gt;&amp;lt;&amp;gt;&lt;/span&gt; 'CLERK';
&lt;/pre&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/07/distinct-and-where-clause-in-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-1608489526723106896</guid><pubDate>Sat, 23 Jul 2016 04:54:00 +0000</pubDate><atom:updated>2022-11-28T22:34:58.627+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">literals in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>Literals in SQL Statements</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know different types of literals in SQL statement. A Literal and a Constant value are synonyms to atleast one another
and refer to a fixed data value. The types of Literals recognized by Oracle
are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Text Literal&lt;/li&gt;
&lt;li&gt;Integer Literal&lt;/li&gt;
&lt;li&gt;Number Literal&lt;/li&gt;
&lt;li&gt;Interval Literal&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;u&gt;Text Literals:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Text Literal specifies a text or character literal. It used to specify values wherever ‘text’ or CHAR appear in&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Expression&lt;/li&gt;
&lt;li&gt;Condition&lt;/li&gt;
&lt;li&gt;SQL Function&lt;/li&gt;
&lt;li&gt;SQL Statement&lt;/li&gt;
&lt;/ul&gt;
It should be enclosed in singe quotes. They have properties of both CHAR and VARCHAR2 data types. A text literal will have a maximum length of 4000 Bytes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt; &amp;nbsp;‘Employee Information’&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ‘Managers Specification’&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N ‘n char Literal’&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Using Literal Character String:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
A Literal is declared in a SELECT list can be a character, a Number or a Date. A literal isn't a column name or a column alias. A literal is printed for all rows that are retrieved by the SELECT statement. Literal String of Free-Test form is enclosed in the query as per the requirement. Date and character literals must be enclosed within the single quotation marks(' '). Literals improve the readability of the output.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;1. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME &lt;span style="color: #333333;"&gt;|| '.'&lt;/span&gt;&lt;span style="color: #333333;"&gt; &lt;/span&gt;&lt;span style="color: #333333;"&gt;||' &lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Month&lt;/span&gt; Salary&lt;span style="color: #333333;"&gt;='&lt;/span&gt;&lt;span style="color: #333333;"&gt;||&lt;/span&gt; SAL &lt;span style="color: #008800; font-weight: bold;"&gt;as&lt;/span&gt; SALARIES &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;2. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ' The Designation &lt;span style="color: #008800; font-weight: bold;"&gt;of &lt;/span&gt;' ENAME &lt;span style="color: #333333;"&gt;||&lt;/span&gt; ' &lt;span style="color: #008800; font-weight: bold;"&gt;is '&lt;/span&gt; &lt;span style="color: #333333;"&gt;||&lt;/span&gt;JOB &lt;span style="color: #008800; font-weight: bold;"&gt;as&lt;/span&gt; DESIGNATION &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;3. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ' The Annual Salary &lt;span style="color: #008800; font-weight: bold;"&gt;of &lt;/span&gt;' ENAME &lt;span style="color: #333333;"&gt;||&lt;/span&gt; ' &lt;span style="color: #008800; font-weight: bold;"&gt;is '&lt;/span&gt; &lt;span style="color: #333333;"&gt;||&lt;/span&gt;JOB &lt;span style="color: #008800; font-weight: bold;"&gt;as&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;12&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;as&lt;/span&gt; ANNUAL_SALARY &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;4. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; DNAME &lt;span style="color: #333333;"&gt;||' &lt;/span&gt;Department &lt;span style="color: #008800; font-weight: bold;"&gt;is&lt;/span&gt; Located &lt;span style="color: #008800; font-weight: bold;"&gt;at '&lt;/span&gt; &lt;span style="color: #333333;"&gt;||&lt;/span&gt; LOC &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DEPT;

&lt;span style="color: #008800; font-weight: bold;"&gt;5. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; DNAME &lt;span style="color: #333333;"&gt;||' &lt;/span&gt;Joined the Organization &lt;span style="color: #008800; font-weight: bold;"&gt;on '&lt;/span&gt; &lt;span style="color: #333333;"&gt;||&lt;/span&gt; HIREDATE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;6. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME &lt;span style="color: #333333;"&gt;||&lt;/span&gt;' Works &lt;span style="color: #008800; font-weight: bold;"&gt;in&lt;/span&gt; Department &lt;span style="color: #007020;"&gt;Number '&lt;/span&gt; &lt;span style="color: #333333;"&gt;||&lt;/span&gt; DNO &lt;span style="color: #333333;"&gt;||&lt;/span&gt; ' &lt;span style="color: #008800; font-weight: bold;"&gt;as '&lt;/span&gt; &lt;span style="color: #333333;"&gt;||&lt;/span&gt; JOB &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Applying Concatenation Operator:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Concatenation operator link columns to other columns are constant values or arithmetic expressions. Columns on either side of the operator are combined to create a single output column. The resultant column is treated as character expression. The concatenation operator is pictured in Oracle by double pipe symbol (||).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;1. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO &lt;span style="color: #333333;"&gt;||&lt;/span&gt; ENAME &lt;span style="color: #333333;"&gt;||&lt;/span&gt; '. Designation &lt;span style="color: #008800; font-weight: bold;"&gt;is&lt;/span&gt; ' || JOB || ' Employee Details ' &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;2. SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ' The Basic Salary &lt;span style="color: #008800; font-weight: bold;"&gt;of&lt;/span&gt; ' &lt;span style="color: #333333;"&gt;||&lt;/span&gt; ENAME &lt;span style="color: #333333;"&gt;||&lt;/span&gt; ' &lt;span style="color: #008800; font-weight: bold;"&gt;is&lt;/span&gt; RS ' &lt;span style="color: #333333;"&gt;||&lt;/span&gt; SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/07/literals-in-sql-statements.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-3285287001858302648</guid><pubDate>Wed, 20 Jul 2016 17:17:00 +0000</pubDate><atom:updated>2022-11-28T22:35:12.526+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">functions</category><category domain="http://www.blogger.com/atom/ns#">null</category><category domain="http://www.blogger.com/atom/ns#">nvl function</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>NULL and NVL functions in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know how to use the NULL and NVL Function and what are the conditions applicable on those functions in SQL in Oracle database.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;NULL FUNCTION:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
NULL is a value which is Unavailable, Unassigned, Unknown and Inapplicable. A NULL is not same as ZERO or blank space. If a row lacks the data for a particular column that value is said to be NULL or to contain NULL.&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,JOB,SAL,COMM &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
If any column value is an Arithmetic expression is NULL, the overall result is also NULL. In this situation is termed as NULL propagation and has to be handled very carefully.&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,JOB,SAL,COMM,&lt;span style="color: #0000dd; font-weight: bold;"&gt;15&lt;/span&gt;&lt;span style="color: #333333;"&gt;*&lt;/span&gt;SAL&lt;span style="color: #333333;"&gt;+&lt;/span&gt;COMM &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,JOB,SAL,COMM,&lt;span style="color: #0000dd; font-weight: bold;"&gt;5&lt;/span&gt;&lt;span style="color: #333333;"&gt;*&lt;/span&gt;SAL&lt;span style="color: #333333;"&gt;+&lt;/span&gt;COMM &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;NVL FUNCTION:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The NVL function is used to convert a NULL value to an actual value.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;         NVL (Exp1, Exp2)
&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Exp1:&lt;/b&gt; is the source value or expression that may contain NULL.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Exp2:&lt;/b&gt; is the target value for converting NULL.&lt;/li&gt;
&lt;/ul&gt;
NVL function can be convert any data type, the return value is always the same as the data type of Exp1. The data types of the source and destination must match.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;NVL(comm,0)&lt;/li&gt;
&lt;li&gt;NVL(Hiredate,’14-SEP-15’)&lt;/li&gt;
&lt;li&gt;NVL(job,’Not Assigned’)&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,COMM,SAL&lt;span style="color: #333333;"&gt;+&lt;/span&gt;NVL(COMM,&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,COMM,(SAL&lt;span style="color: #333333;"&gt;*&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;12&lt;/span&gt;)&lt;span style="color: #333333;"&gt;+&lt;/span&gt;NVL(COMM,&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,SAL,COMM,(SAL&lt;span style="color: #333333;"&gt;+&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;500&lt;/span&gt;)&lt;span style="color: #333333;"&gt;+&lt;/span&gt;NVL(COMM,&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Working with Aliases:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
An Alias is the alternate name given for any Oracle object. Aliases in Oracle are two types,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Column Alias&lt;/li&gt;
&lt;li&gt;Table Alias&lt;/li&gt;
&lt;/ul&gt;
The column alias renames a column heading. It is specified in the SELECT list by declaring the alias after the column name by using the space separator. Alias heading appear is UPPER casting by default. The alias should be declared in double quotes if it is against the specifications of Naming Convention.&lt;br /&gt;
&lt;br /&gt;
The AS keyword can be used between the column name and alias. An alias effectively renames the SELECT list item for the duration of the query. An alias cannot be used anywhere in the SELECT list for operational purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO NUMBERS,
         ENAME NAME,
         SAL “BASIC SALARY”,
         JOB DESIGNATION 
     &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; DNO &lt;span style="color: #008800; font-weight: bold;"&gt;AS&lt;/span&gt; “DEPARTMENT ID”,
  DNAME &lt;span style="color: #008800; font-weight: bold;"&gt;AS&lt;/span&gt; “DEPARTMENT NAME”
  LOC &lt;span style="color: #008800; font-weight: bold;"&gt;AS&lt;/span&gt; PLACE
     &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DEPT;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HISAL &lt;span style="color: #008800; font-weight: bold;"&gt;AS&lt;/span&gt; “MAXIMUM SALARY”,
   LOSAL &lt;span style="color: #008800; font-weight: bold;"&gt;AS&lt;/span&gt; “MINIMUM SALARY”,
   GRADE
     &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; SALGRADE;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;</description><link>https://oracletutorialpoint.blogspot.com/2016/07/null-and-nvl-functions-in-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-1332145037555594428</guid><pubDate>Wed, 20 Jul 2016 16:42:00 +0000</pubDate><atom:updated>2022-11-28T22:35:28.487+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">arithmetic operations in sql</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>Arithmetic Operations in SQL</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know about arithmetic operations in SQL and how to apply in SELECT statement. The Arithmetic operators will be used to create expressions on NUMBER and DATE data. The Arithmetic Operators supported are,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Addition(+)&lt;/li&gt;
&lt;li&gt;Subtraction(-)&lt;/li&gt;
&lt;li&gt;Multiply(*)&lt;/li&gt;
&lt;li&gt;Divide(/)&lt;/li&gt;
&lt;/ul&gt;
Arithmetic Operators can be used in any of the SQL statement except the FROM clause. SQL * Plus forget Back spaces(&amp;lt;---) before and after the Arithmetic operator.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Applying Arithmetic Operations in SELECT Statement:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
By using SELECT statements, Arithmetic Expressions can be implemented. Arithmetic Expressions can be implemented to,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Perform Calculations.&lt;/li&gt;
&lt;li&gt;Modify the way the data is displayed.&lt;/li&gt;
&lt;li&gt;Implement WHAT-IF Scenario.&lt;/li&gt;
&lt;/ul&gt;
An Arithmetic Expression can contain,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Simple Column names.&lt;/li&gt;
&lt;li&gt;Arithmetic operators.&lt;/li&gt;
&lt;li&gt;Constant numeric values.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;u&gt;Examples:&lt;/u&gt;&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL,SAL&lt;span style="color: #333333;"&gt;+&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;100&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL,SAL&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;500&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Operator Precedence:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Multiplication(*) and Division(/) take preference over addition(+) and subtraction(-). Operators of the same priority are evaluated from left to right. To increase clarity and to prioritize evaluation parentheses can be implemented.&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL,&lt;span style="color: #0000dd; font-weight: bold;"&gt;12&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; SAL &lt;span style="color: #333333;"&gt;+&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;100&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL,(&lt;span style="color: #0000dd; font-weight: bold;"&gt;12&lt;/span&gt;&lt;span style="color: #333333;"&gt;*&lt;/span&gt;SAL)&lt;span style="color: #333333;"&gt;+&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;100&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL,&lt;span style="color: #0000dd; font-weight: bold;"&gt;12&lt;/span&gt;&lt;span style="color: #333333;"&gt;*&lt;/span&gt;(SAL&lt;span style="color: #333333;"&gt;+&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;100&lt;/span&gt;) &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Based on the above SQL queries you try for other Arithmetic operators.
</description><link>https://oracletutorialpoint.blogspot.com/2016/07/arithmetic-operations-in-sql.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-1088873534792752981</guid><pubDate>Wed, 20 Jul 2016 16:40:00 +0000</pubDate><atom:updated>2022-11-28T22:35:57.090+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">replace all</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">sql dump</category><title>How to SAVE SQL prompt content into Text file?</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know how to save SQL prompt content into a file. In SQL prompt we will execute the multiple queries. If once we reopen SQL prompt, we miss the list of queries which we have executed previously. To avoid this problem, it's always better to store the data into the physical file. The SAVE command is used to store the current content of the SQL buffer.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Steps are:&lt;/u&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;At the SQL Prompt type the full name of the path where the file has to be saved.&lt;/li&gt;
&lt;li&gt;Give line name of the file with .sql extension.&lt;/li&gt;
&lt;li&gt;If the file has to be replaced with already existing name then use the REPLACE ALL clause.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;

&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;SQL&amp;gt; SAVE C:\Users\Subba Reddy(Your computer account id)\Documents\Script files\Insert_Prompt.sql

SQL&amp;gt; SAVE C:\Users\Subba Reddy(Your computer account id)&lt;span style="line-height: 125%;"&gt;\Documents\Script files\Insert_Prompt.sql REPLACE ALL&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/07/how-to-save-sql-prompt-content-into.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-4928053971286652400</guid><pubDate>Sun, 17 Jul 2016 12:36:00 +0000</pubDate><atom:updated>2022-11-28T22:36:34.136+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">SELECT Statement</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>SELECT Statement in SQL with examples</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know how to Query / fetch data from the table will use the SELECT Statement in SQL in Oracle Database. To know more about the SELECT Statement, continue reading this article.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;SELECT Statement:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The SELECT statement is used to retrieve data from one or more than one table, object tables, views, object views or management views.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Prerequisites:&lt;/b&gt;&lt;br /&gt;
The user must have the SELECT privileges on the defined object. The SELECT ANY TABLE allows selecting the data from any recognized object.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Efficiency of SQL SELECT Statement:&lt;/b&gt;&lt;br /&gt;
The SELECT statement can be used to select or retrieve data from the object using any of the following criteria.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;SELECTION:&lt;/b&gt; Selection chooses the rows in a table that are expected to return by a query.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;PROJECTION:&lt;/b&gt; Projection chooses the columns in a table that are expected to return by a query.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;JOIN:&lt;/b&gt; Join chooses the data in from one or more than one table by creating a link between them.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Basic SELECT Syntax:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; [&lt;span style="color: #008800; font-weight: bold;"&gt;DISTINCT&lt;/span&gt;] &lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;span style="color: #333333;"&gt;*&lt;/span&gt; , &lt;span style="color: #008800; font-weight: bold;"&gt;Column&lt;/span&gt; [&lt;span style="color: #008800; font-weight: bold;"&gt;Alias&lt;/span&gt;],&lt;span style="color: #333333;"&gt;-&lt;/span&gt; &lt;span style="color: #333333;"&gt;- -&lt;/span&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TABLE&lt;/span&gt;;

&lt;span style="color: #888888;"&gt;SELECT --&amp;gt; Defined Columns FROM --&amp;gt; Declared Tables.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;SELECT &lt;/b&gt;: Specifies a list of Column (one/more)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;DISTINCT &lt;/b&gt;: Suppresses Duplicates&lt;/li&gt;
&lt;li&gt;&lt;b&gt;*&lt;/b&gt;&amp;nbsp;&lt;b&gt;--&amp;nbsp;&lt;/b&gt;Indicates Select all columns&lt;/li&gt;
&lt;li&gt;&lt;b&gt;COLUMN &lt;/b&gt;: Select the named column&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Alias &lt;/b&gt; : Provide selected columns in different columns&lt;/li&gt;
&lt;li&gt;&lt;b&gt;FROM Table&lt;/b&gt;: Specifies the table containing the columns.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Writing SQL Statements to SELECT or RETRIEVE DATA FROM TABLES:&lt;/b&gt; Sample table used,&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Table1 - EMP:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Column Names&lt;/span&gt;          &lt;span style="color: #008800; font-weight: bold;"&gt;Data&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;Types&lt;/span&gt;
&lt;span style="color: #888888;"&gt;------------         ----------&lt;/span&gt;
ENO                     &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
ENAME                   &lt;span style="color: #007020;"&gt;VARCHAR&lt;/span&gt;
DNO                     &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
JOB                     &lt;span style="color: #007020;"&gt;VARCHAR&lt;/span&gt;
SAL                     &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
COMM                    &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
MGR                     &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
HIREDATE                &lt;span style="color: #007020;"&gt;DATE&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Table2 - DEPT:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Column Names&lt;/span&gt;             &lt;span style="color: #008800; font-weight: bold;"&gt;Data&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;Types&lt;/span&gt;
&lt;span style="color: #888888;"&gt;--------------          ---------------&lt;/span&gt;
DNO                     &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
DNAME                   &lt;span style="color: #007020;"&gt;VARCHAR&lt;/span&gt;
LOC                     &lt;span style="color: #007020;"&gt;VARCHAR&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Table3 - SALGRADE:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Column Names&lt;/span&gt;             &lt;span style="color: #008800; font-weight: bold;"&gt;Data&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;Types&lt;/span&gt;
&lt;span style="color: #888888;"&gt;--------------          ---------------&lt;/span&gt;
HISAL                   &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
LOSAL                   &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
GRADE                   &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Retrieving Data from ALL columns in the table:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;       

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DEPT;      

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; SALGRADE;     
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
In the above the * is a projection operator. It shows data from all the columns defined in the table with all records. The data is displayed in a table format.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Retrieving Data from particular columns:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENAME,JOB,SAL,DNO &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; ENO,ENAME,SAL &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; EMP;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; DNO,DNAME,LOC &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; DEPT;

&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;SELECT&lt;/span&gt; HISAL,LOSAL,GRADE &lt;span style="color: #008800; font-weight: bold;"&gt;FROM&lt;/span&gt; SALGRADE;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The column names need not be in the same order as exists in table. The columns should be separated by using comma (,). The column names can be separated into different lines within the SQL Buffer. The casing of column names is not important.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Column Heading Defaults:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The default conclusion of the data after it is retrieved from the table is, &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;LEFT&lt;/b&gt;: Character and Date data&lt;/li&gt;
&lt;li&gt;&lt;b&gt;RIGHT&lt;/b&gt;:Numeric Data&lt;/li&gt;
&lt;/ul&gt;
By default the data will be shown in UPPERcase. The character and date column headings can be truncated. But NUMBER cannot be truncated.</description><link>https://oracletutorialpoint.blogspot.com/2016/07/select-statement-in-sql-with-examples.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-5494134883668600676</guid><pubDate>Sun, 17 Jul 2016 12:34:00 +0000</pubDate><atom:updated>2022-11-28T22:37:00.963+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">INSERT Statement</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>INSERT statement in Oracle Database</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know how to populate data into the SQL table in Oracle Database, we should know how to use the INSERT statement in SQL. To know more about the INSERT statement in Oracle Database, continue reading this article.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;INSERT statement:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The INSERT statement is used to add rows into a&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Table&lt;/li&gt;
&lt;li&gt;View's Base Tables&lt;/li&gt;
&lt;li&gt;A partition of a partition table&lt;/li&gt;
&lt;li&gt;A subpartition of Composite_Partitioned Table&lt;/li&gt;
&lt;li&gt;An object table&lt;/li&gt;
&lt;li&gt;An object view’s base table&lt;/li&gt;
&lt;/ul&gt;
Insertion of data into a table can be executed in 2 different ways.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Conventional INSERT&lt;/li&gt;
&lt;li&gt;Direct-path INSERT&lt;/li&gt;
&lt;/ul&gt;
In Conventional Insert statement, ORACLE reuses free space within the table into that the data in being inserted and maintain referential integrity constraints.&lt;br /&gt;
In Direct-path insert in ORACLE appends the inserted data after executing data in the table. The free space not reused.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; &lt;span style="color: #333333;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;TABLE_NAME&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt;(col&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;,col&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;, &lt;span style="color: #333333;"&gt;-&lt;/span&gt; &lt;span style="color: #333333;"&gt;-&lt;/span&gt; ,col-n)&lt;span style="color: #008800; font-weight: bold;"&gt;VALUES&lt;/span&gt;(value&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;,value&lt;span style="color: #0000dd; font-weight: bold;"&gt;2&lt;/span&gt;, &lt;span style="color: #333333;"&gt;-&lt;/span&gt; &lt;span style="color: #333333;"&gt;-&lt;/span&gt; ,value&lt;span style="color: #333333;"&gt;-&lt;/span&gt;n);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Examples:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;INSERTING DATA INTO ALL COLUMNS OF A TABLE:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENTS &lt;span style="color: #008800; font-weight: bold;"&gt;VALUES&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;111&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;Subba&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;Reddy&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;Oct&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;90&lt;/span&gt;&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;M&lt;span style="color: red;"&gt;’&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
In this case, the values should provide all the columns that exist inside the table. The order in which the values are declared in the values clause should follow the same order as that of the initial table order. The char, varchar and Date type data should be declared in single quotes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;INSERTING DATA INTO THE SPECIFIED COLUMNS:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENTS (SID, FNAME, LNAME, DOJ, GENDER) &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;     VALUES&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;123&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;Nalla&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;Machu&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;19&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;APR&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;89&lt;/span&gt;&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;M&lt;span style="color: red;"&gt;’&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
In this case, the order of the columns declared in the SELECT list need not be the same order as that of the initial table. The data values in the VALUES clause ought to match with that SELECT list. The columns for which the data is not provided are filled with NULL values. The INSERT statement will get rejected, if the columns that weren't provided with data are defined with NOT NULL constraints.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;INSERTING NULL VALUES:&lt;/b&gt;&lt;br /&gt;
NULL values can be inserted into two ways.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;IMPLICIT&lt;/b&gt; – Omit the column from the list.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;EXPLICIT&lt;/b&gt; – Specify the NULL keyword. Specify the Empty String (‘ ‘) only for  character Strings and Dates.&lt;/li&gt;
&lt;/ol&gt;
The targeting column should not be set as NOT NULL constraint.&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENTS (SID, FNAME, LNAME, DOB, DOJ, FEES, GENDER) &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;     VALUES&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;359&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;Subba&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: #008800; font-weight: bold;"&gt;NULL&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;01&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;OCT&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;90&lt;/span&gt;&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: #008800; font-weight: bold;"&gt;NULL&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;M&lt;span style="color: red;"&gt;’&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;INSERTING SPECIAL VALUES:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;SYSDATE FUNCTION:&lt;/b&gt;&lt;br /&gt;
It's a pseudo column provided by the ORACLE. The function returns the current date and time.&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENTS (SID, FNAME, DOJ, FEES, GENDER) &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;     VALUES&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;359&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;Subba&lt;span style="color: red;"&gt;’&lt;/span&gt;, SYSDATE, &lt;span style="color: #0000dd; font-weight: bold;"&gt;25000&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;M&lt;span style="color: red;"&gt;’&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;USER FUNCTION:&lt;/b&gt;&lt;br /&gt;
It's a special function which records the present USER name.&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENTS (SID, FNAME, LNAME, DOJ, DOB, FEES) &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;     VALUES&lt;/span&gt; (&lt;span style="color: #0000dd; font-weight: bold;"&gt;359&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;Subba&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: #008800; font-weight: bold;"&gt;User&lt;/span&gt;, SYSDATE,&lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;01&lt;/span&gt;&lt;span style="color: #333333;"&gt;-&lt;/span&gt;OCT&lt;span style="color: #333333;"&gt;-&lt;/span&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;90&lt;/span&gt;&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: #0000dd; font-weight: bold;"&gt;30000&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;SUBSTITUTION VARIABLES:&lt;/b&gt;&lt;br /&gt;
These variables are used to store values temporarily. The values can store temporarily through,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Single Ampersand (&amp;amp;)&lt;/li&gt;
&lt;li&gt;Double Ampersand (&amp;amp;&amp;amp;)&lt;/li&gt;
&lt;li&gt;DEFINE and ACCEPT Commands&lt;/li&gt;
&lt;/ul&gt;
The single ampersand substitution variable apples for each instance when the SQL statement is create or executed. The double ampersand variables applied for all instances until that SQL statement exists.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;USING SINGLE AMPERSAND SUBSTITUTION VARIABLE:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENT (SID, FNAME, LNAME, DOB, FEES) &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;     VALUES&lt;/span&gt; (&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;SID, &lt;span style="color: red;"&gt;‘&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;FNAME&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;LNAME&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;DOB&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: #0000dd; font-weight: bold;"&gt;25000&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;USING DOUBLE AMPERSAND SUBSTITUTION:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENT (SID, FNAME, LNAME, DOB, DOJ, FEES, GENDER) &lt;/pre&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;     VALUES&lt;/span&gt; (&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;SID, &lt;span style="color: red;"&gt;‘&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;FNAME&lt;span style="color: red;"&gt;’&lt;/span&gt;,&lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;LNAME&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: red;"&gt;’&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;DOB&lt;span style="color: red;"&gt;’&lt;/span&gt;, SYSDATE, &lt;span style="color: #333333;"&gt;&amp;amp;&amp;amp;&lt;/span&gt;FEES, &lt;span style="color: red;"&gt;‘&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;GENDER&lt;span style="color: red;"&gt;’&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;DEFINING CUSTOMIZED PROMPTS:&lt;/b&gt;&lt;br /&gt;
The prompt can be customized by using the ACCEPT command of SQL * Plus. ACCEPT Command stores the values in a variable. PROMPT command displays the custom text. When creating a script using the substitutions variable to a file it can called with ACCEPT and PROMPT with greater meaning.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;ACCEPT SID PROMPT ‘Please Enter the Student Number’.&lt;/li&gt;
&lt;li&gt;ACCEPT FNAME PROMPT ‘Please Enter the First Name’.&lt;/li&gt;
&lt;li&gt;ACCEPT FEES PROMPT ‘Please Enter the Course Fees’.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INSERT&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;INTO&lt;/span&gt; STUDENTS (SID, FNAME, FEES) &lt;span style="color: #008800; font-weight: bold;"&gt;VALUES&lt;/span&gt; (&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;SID, &lt;span style="color: red;"&gt;‘&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;FNAME&lt;span style="color: red;"&gt;’&lt;/span&gt;, &lt;span style="color: #333333;"&gt;&amp;amp;&lt;/span&gt;FEES);
&lt;/pre&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/07/insert-statement-in-oracle-database.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-8985464069874120819</guid><pubDate>Sun, 17 Jul 2016 12:34:00 +0000</pubDate><atom:updated>2022-11-28T22:36:46.842+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">BLOB Data Type</category><category domain="http://www.blogger.com/atom/ns#">CHAR Data Type</category><category domain="http://www.blogger.com/atom/ns#">Data types in SQL</category><category domain="http://www.blogger.com/atom/ns#">DATETIME Data Type</category><category domain="http://www.blogger.com/atom/ns#">NUMBER Data Type</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">ROWID Data Type</category><category domain="http://www.blogger.com/atom/ns#">sql</category><category domain="http://www.blogger.com/atom/ns#">TIMESTAMP Data Type</category><category domain="http://www.blogger.com/atom/ns#">VARCHAR2 Data Type</category><title>Data types in Oracle DBMS </title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know about how to manage data and what are different data types available in SQL / Oracle. Each value in Oracle Database is manipulated by a data type.
The data type value associates fixed set of properties with the value. The
value of one data type is different from another data type. The data type
defines the domain of values that every column can contain. The built-in data
types of Oracle are categorized as,&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;CHARACTER DATA TYPES,&lt;/li&gt;
&lt;li&gt;ROWID DATA TYPES,&lt;/li&gt;
&lt;li&gt;NUMBER DATA TYPES,&lt;/li&gt;
&lt;li&gt;LONG AND RAW DATA TYPES,&lt;/li&gt;
&lt;li&gt;LARGE OBJECT DATA TYPES,&lt;/li&gt;
&lt;li&gt;DATETIME DATA TYPES,&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Character data types:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
They store character data which can be alphanumeric data. The information can be,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Words,&lt;/li&gt;
&lt;li&gt;Free – Form Text,&lt;/li&gt;
&lt;li&gt;National character set,&lt;/li&gt;
&lt;li&gt;Database character set,&lt;/li&gt;
&lt;/ul&gt;
They are minimal restrictive than other data types and have very few properties. The data is stored in strings with byte values. The data will belong to either,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;7 – list ASCII character set&lt;/li&gt;
&lt;li&gt;EBCDIC&lt;/li&gt;
&lt;/ul&gt;
Oracle support both single byte and multibyte character sets. The different character data types are,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CHAR, NCHAR, VARCHAR2, NVARCHAR2&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;CHAR Data type:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It represents fixed length character string. The size should be specified. If the data is less than the original given size, blank pads are applied. The default length is 1 Byte and the maximum is 2000 Bytes. The size of a character will range from one(1) Byte to four(4) Bytes depending on the database character set.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;NCHAR Data type:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It is first time defined in Oracle 9i and contains only Unicode data. The columns maximum length is regulated by the National Character set definition. The largest size allowed is 2000 bytes and size has to be specified. If the data is shorter than the defined size, then the blank pads are applied.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;VARCHAR2 Data type:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It define the variable length character string. The minimum size is one(1) Byte and the maximum size is 4k(4000) Bytes. It occupies only that space for which the data is provided.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;NVARCHAR2 Data type:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It is first time defined in ORACLE 9i. It's defined for Unicode only date. The minimum for the scale is one(1) Byte and maximum is 4k(4000) Bytes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Number&amp;nbsp;Datatype:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It stores zero(0), positive and negative fixed and floating point numbers. The range of magnitude is,&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #0000dd; font-weight: bold;"&gt;                   1&lt;/span&gt;.&lt;span style="color: #0000dd; font-weight: bold;"&gt;0&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;sup&gt;-139&lt;/sup&gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;to&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;9.9&lt;/span&gt; &lt;span style="color: #333333;"&gt;*&lt;/span&gt; &lt;span style="color: #0000dd; font-weight: bold;"&gt;10&lt;sup&gt;125&lt;/sup&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The general declaration is,&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;NUMBER (p,s):&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;P --&amp;gt; It specifies the precision. i.e. the total number of digits (1 to 38)&lt;/li&gt;
&lt;li&gt;S --&amp;gt; It specified the scale. I.e. the number digits to the right of the decimal point. It will vary from -84 to 127.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;u&gt;Float Datatype:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It specifies to have a decimal point anywhere from the first to the last digit or will don't have any decimal point at all. The scale value is not applicable to floating point numbers as the range of digits which will appear after the decimal point is not restricted.&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;
Float --&amp;gt; It specifies a floating point range with binary decimal precision 38 or binary precision of 126.&lt;br /&gt;
Float (B) --&amp;gt; It specified a floating point range with binary precision b.
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The precision can range from 1(one) to 126.&lt;/li&gt;
&lt;li&gt;Convert from binary to decimal precision multiply ‘b’ by 0.30103.&lt;/li&gt;
&lt;li&gt;Convert from decimal to binary precision multiply the decimal precision by 3.32193.&lt;/li&gt;
&lt;/ul&gt;
The maximum of 126 digits of binary preciseness is roughly equivalent to 38 digits of decimal precision.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Long &amp;amp; Raw Data Types:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
This data type stores variable length character string. It's used to store very lengthy text strings. The length of LONG values could also be restricted by the memory available on the computer. LONG column can be referenced in,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;SELECT List.&lt;/li&gt;
&lt;li&gt;SET clause of UPDATE statements.&lt;/li&gt;
&lt;li&gt;VALUES clause of INSERT statements.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Restrictions:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;A single table can contains only one LONG column.&lt;/li&gt;
&lt;li&gt;Object types can't be created on LONG attributes.&lt;/li&gt;
&lt;li&gt;LONG columns cannot appear in WHERE clauses or in Integrity Constraints.&lt;/li&gt;
&lt;li&gt;Indexes can't be created on LONG Columns.&lt;/li&gt;
&lt;li&gt;LONG can be returned through a function, but not through a stored procedure.&lt;/li&gt;
&lt;li&gt;It may be declared in a PL/SQL unit but cannot be referenced in SQL.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;u&gt;DATE &amp;amp; TIME DATA TYPES:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Date Data Type:&lt;/b&gt;&lt;br /&gt;
It's used to store date and time information. The dates can be specified as literals using the Gregorian calendar. The information revealed by date is:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Century&lt;/li&gt;
&lt;li&gt;Year&lt;/li&gt;
&lt;li&gt;Month&lt;/li&gt;
&lt;li&gt;Date&lt;/li&gt;
&lt;li&gt;Hour&lt;/li&gt;
&lt;li&gt;Minute&lt;/li&gt;
&lt;li&gt;Second&lt;/li&gt;
&lt;/ul&gt;
The default date format in ORACLE is DD-MON-YY and it's specified in NLS-DATE_FORMAT. The default time accepted by ORACLE date is 12:00:00 AM. The default date specified in ORACLE data is the first day of the Current Month. The Date range in ORACLE is,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;JANUARY 1, 4712 BC to DECEMBER 31, 9999 AD.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;u&gt;TIMESTAMP DATA TYPE:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It is an extension of the DATE data type. It store,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Day, Month, Year&lt;/li&gt;
&lt;li&gt;Hour, Minute, Second&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Syntax:&lt;/b&gt; TIMESTAMP [{Fractional – Seconds – Precision}]&lt;br /&gt;
Fractional – Seconds – Precision data types are interested for storage of binary data or Byte Strings. RAW and LONG RAW are variable range data types.  They are mostly used to store graphics, sounds documents etc. The ORACLE converts the RAW &amp;amp; LONG RAW data into Hexadecimal type. Every Hexadecimal character represents four bits of RAW data.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Large Object Datatypes (LOB):&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The built in LOB data types are BLOB, CLOB, NCLOB. These data types are stored internally. The Bfile is an LOB that is stored externally. The LOB data types can store large and unstructured data like Text, Image and Video and Spatial data. The maximum size is up to 4 GB. A LOB column contains LOB locators which can refer to out-of-line or in-line LOB values. LOB’s selection basically returns the LOB locator.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;BFILE Datatypes:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It enables access to binary file LOB's those are stored in the file systems outside ORACLE. A BFILE column or the attribute stores the BFILE locator. BFILE locator manages the directory alias and the filename. A Binary file LOB does not participate in transactions and aren't recoverable. The maximum size is 4 GB.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;BLOB Datatype:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It stores unstructured Binary Large Objects. They're Bit streams with no Character set semantics. They're provided with full transactional support.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;CLOB Datatype:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
CLOB stores single byte and multiple byte character data. Both fixed width and variable width character sets are supported. They're provided with full transactional support.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;NCLOB Datatype:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It stores UNICODE data using the National Character set.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;ROWID Datatype:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Each and every row in the database has an address. The rows address can be queried using the pseudo column ROWID. ROWID efficiently support partitioned tables and indexes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example-1:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;Create&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;table&lt;/span&gt; STUDENTS
     (
      SID    &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;(&lt;span style="color: #0000dd; font-weight: bold;"&gt;8&lt;/span&gt;),
      FNAME  VARCHAR2(&lt;span style="color: #0000dd; font-weight: bold;"&gt;50&lt;/span&gt;),
      LNAME  VARCHAR2(&lt;span style="color: #0000dd; font-weight: bold;"&gt;50&lt;/span&gt;),
      DOB    &lt;span style="color: #007020;"&gt;DATE&lt;/span&gt;,
      DOJ    &lt;span style="color: #007020;"&gt;DATE&lt;/span&gt;,
      FEES   &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;(&lt;span style="color: #0000dd; font-weight: bold;"&gt;6&lt;/span&gt;),
      GENDER VARCHAR2(&lt;span style="color: #0000dd; font-weight: bold;"&gt;1&lt;/span&gt;)
     );
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Example-2:&lt;/b&gt;&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TABLE&lt;/span&gt; LABSPECIFICATIONS
     (
      PROD_ID      &lt;span style="color: #007020;"&gt;NUMBER&lt;/span&gt;(&lt;span style="color: #0000dd; font-weight: bold;"&gt;6&lt;/span&gt;),
      PROD_PHOTO   &lt;span style="color: #007020;"&gt;BLOB&lt;/span&gt;,
      PROD_GRAPHIC BFILE,
      PROD_DESC    LONG
     );
&lt;/pre&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/07/data-types-in-oracle-dbms.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-3774585428267909599</guid><pubDate>Sat, 16 Jul 2016 12:05:00 +0000</pubDate><atom:updated>2022-11-28T22:38:41.004+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">dbms</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle database management system</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>DATABASE MANAGEMENT SYSTEM</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know about Oracle Database Management System and what are different models present in oracle and how to communicate with DBMS. Database Management System is a program. This takes care of,
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Storing of Information&lt;/li&gt;
&lt;li&gt;Retrieving of Information&lt;/li&gt;
&lt;li&gt;Modification of Information&lt;/li&gt;
&lt;li&gt;Deletion of Information&lt;/li&gt;
&lt;/ol&gt;
Different types of Databases:
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Hierarchical&lt;/li&gt;
&lt;li&gt;Network&lt;/li&gt;
&lt;li&gt;Relational&lt;/li&gt;
&lt;li&gt;Object Oriented&lt;/li&gt;
&lt;li&gt;Object Relational&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Relational Models:&lt;/u&gt;&lt;/b&gt;
The Model was first outlined by E.F.Codd in 1970. The components of Relational Model are,
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Collection of&amp;nbsp;relations&amp;nbsp;or objects&amp;nbsp;that stores the data.&lt;/li&gt;
&lt;li&gt;A set of operations that can act on the relations to produce the other relations.&lt;/li&gt;
&lt;li&gt;Data integrity for&amp;nbsp;consistency&amp;nbsp;and&amp;nbsp;accuracy.&lt;/li&gt;
&lt;/ol&gt;
A Relational database uses relations or two dimensional tables to store information.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Data Model:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The Data model's helps in exploring ideas and improve the understanding of the database design.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Purpose of Data Model:&lt;/u&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Categorize&lt;/li&gt;
&lt;li&gt;Communicate&lt;/li&gt;
&lt;li&gt;Describe&lt;/li&gt;
&lt;li&gt;Specify&lt;/li&gt;
&lt;li&gt;Investigate&lt;/li&gt;
&lt;li&gt;Evolve&lt;/li&gt;
&lt;li&gt;Analyse&lt;/li&gt;
&lt;li&gt;Imitate&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Objective of Models:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
To produce a model that fits a multitude of uses. It should be understood by an end user. It should contain enough details for a developer to make the database system.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Relational Database Properties:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It can be accessed and modified by executing SQL(Structured Query Language) statements. It contains a collection of tables with no physical pointers. It uses a group of operators. We need not specify the route to the tables. There is no need to identify how the data is organised physically.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Communicating with RDBMS:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The Structured Query Language is used to communicate with RDBMS.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Structured Query Language:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
SQL permits the user to communicate with server. It is efficient and it is easy to learn and use. It's functionally complete, by permitting the user to define, retrieve and manipulate the data.</description><link>https://oracletutorialpoint.blogspot.com/2016/07/database-management-system.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2679973108175390996.post-274950002163385147</guid><pubDate>Sat, 16 Jul 2016 12:05:00 +0000</pubDate><atom:updated>2022-11-28T22:37:58.666+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Entity Relationship Model</category><category domain="http://www.blogger.com/atom/ns#">ER Model</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">Oracle Database</category><category domain="http://www.blogger.com/atom/ns#">Oracle Tutorial Point</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>Entity Relationship Model (ER Model)</title><description>&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579703611901524"
     crossorigin="anonymous"&gt;&lt;/script&gt;
Read this Oracle Tutorial Point article to know benefits and key components of Entity Relationship (ER) Model in oracle database. In an effective system data is divided into describe
categories or entities. An Entity Relationship(ER) Model is an illustration of multiple entities in a business and the relationships between them. It is built
during the analysis phase of the System Development Life Cycle (SDLC). Entity Relationship(ER) Model
separates the information required &amp;amp; the business from the activities
performed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Entity Relationship(ER)-Model Benefits:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;ER-Model documents information for the organization in a clear, precise format.&lt;/li&gt;
&lt;li&gt;ER-Model provides a clear picture of the scope of the information requirement.&lt;/li&gt;
&lt;li&gt;ER-Model provides an easily understandable pictorial map for the database design.&lt;/li&gt;
&lt;li&gt;ER-Model offers an effective framework for integrating several applications.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Key Components in&amp;nbsp;&lt;/u&gt;&lt;/b&gt;&lt;b&gt;&lt;u&gt;Entity Relationship(ER)&lt;/u&gt;&lt;/b&gt;&lt;b&gt;&lt;u&gt;-Model:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;ENTITY:&lt;/b&gt;&lt;br /&gt;
It's a thing of significance about which the information needs to be known.
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ATTRIBUTES:&lt;/b&gt;&lt;br /&gt;
It's something that describe or qualifies an entity. Each attribute might be mandatory or optional.
&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Relational Database Terminology:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Tuple or&amp;nbsp;&lt;/b&gt;&lt;b&gt;Row&lt;/b&gt;&lt;b&gt;:&lt;/b&gt;&lt;br /&gt;
It represents all data required for a specific instance in an entity. Every row is an entity is uniquely identified by declaring it as UNIQUE or PRIMARY KEY. The order of the rows isn't significant, while retrieving the data.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Attribute&lt;/b&gt;&lt;b&gt;&amp;nbsp;or&amp;nbsp;&lt;/b&gt;&lt;b&gt;Column&lt;/b&gt;&lt;b&gt;:&lt;/b&gt;&lt;br /&gt;
It represents one kind of data in a table. The column order isn't significant when storing the data.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Field:&lt;/b&gt;&lt;br /&gt;
It can be found at the intersection of a row and a column. A field will have only one value or may not have a value at all. The absence of value in Oracle is described as NULL.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Relating Multiple Tables:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Each and every table contains data that are describes exactly only one entity per table. Data of multiple entities is stored in multiple tables. RDBMS enables the data in one table is related to another table by using the foreign keys. Foreign Key is a column or a group of columns that refer to a Primary Key in the same table or another table.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Relational Database Properties:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It shouldn't specify the access route to the tables and shouldn't reveal the physical arrange. The database is accessed by using Structured Query Language(SQL). The language is a collection of set of operations.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Structured Query Language(SQL) Statements:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
SQL(Oracle) complies with industry accepted standards. The multiple categories into which the SQL statements falls are,&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Data Retrieval Statements&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;SELECT&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Data Control Language Statements (DCL)&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;GRANT, REVOKE&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Data Manipulation Language Statements (DML)&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;INSERT, UPDATE, DELETE, MERGE&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Data Definition Language Statements (DDL)&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;CREATE, ALTER, DROP, RENAME, TRUNCATE&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Transaction Control Language Statements (TCL)&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;COMMIT, ROLLBACK, SAVEPOINT&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;About the SQL Buffer:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
All commands of SQL are typed at the SQL prompt. Only one(1) SQL statement is managed in the SQL Buffer. The current SQL statement replaces the previous SQL statement within the Buffer. The SQL statement will be divided into different lines within the SQL Buffer. Only one line that is, the current line can be active at a time in the SQL Buffer. At SQL prompt, editing is possible only in the current SQL Buffer line.&lt;br /&gt;
&lt;br /&gt;
Each statement of SQL ought to be terminated using semicolon. One SQL statement can contains only one. To run the previous (old) or current SQL statement in the Buffer type ‘/’ at SQL prompt. To open the SQL Editor type ed at SQL prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Create and Manage Tables:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Database Objects:&lt;/b&gt;&lt;br /&gt;
Oracle database can contain multiple data structures. The different Oracle Database objects are,&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;TABLE:&lt;/b&gt;&amp;nbsp;Table is used to store data, Basic Unit.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;VIEW:&lt;/b&gt;&amp;nbsp;View is logically represents subsets of data from one or more(additional) tables.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;SEQUENCE:&lt;/b&gt;&amp;nbsp;Sequence is used to generate Primary Key values.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;INDEX:&lt;/b&gt; It used to improve the performance of some queries.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;SYNONYM:&lt;/b&gt;&amp;nbsp;Synonym is used to give alternate names to objects.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Tables in Oracle:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Table can be created at any time, even when users are using the database. No need to specify size of the table. The structure of the table can be modified online.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Table Creation Rules to remember:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;The user must have permission or CREATE TABLE command and storage area.&lt;/li&gt;
&lt;li&gt;The table name should starts with a letter within the range of 1 – 30 characters long.&lt;/li&gt;
&lt;li&gt;Names can contain:&amp;nbsp;0-9,&amp;nbsp;A-Z, a-z, &amp;nbsp;_,$, #&lt;/li&gt;
&lt;li&gt;Names can't be duplicated for another object in the same Oracle server.&lt;/li&gt;
&lt;li&gt;Name can't be Oracle server reserved word.&lt;/li&gt;
&lt;li&gt;Names aren't case sensitive&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Create Table Statement:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Syntax:&lt;/b&gt;
&lt;!-- HTML generated using hilite.me --&gt;

&lt;br /&gt;
&lt;div style="border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"&gt;
&lt;pre style="line-height: 125%; margin: 0;"&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;SQL&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;TABLE&lt;/span&gt; &lt;span style="color: #333333;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;TABLE_NAME&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt;
(
Column_Name1 &lt;span style="color: #333333;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Data&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;type&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; (Width),
Column_Name2 &lt;span style="color: #333333;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Data&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;type&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; (Width),
     &lt;span style="color: #888888;"&gt;--&lt;/span&gt;
     &lt;span style="color: #888888;"&gt;--&lt;/span&gt;
Column_Namen &lt;span style="color: #333333;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #008800; font-weight: bold;"&gt;Data&lt;/span&gt; &lt;span style="color: #008800; font-weight: bold;"&gt;type&lt;/span&gt;&lt;span style="color: #333333;"&gt;&amp;gt;&lt;/span&gt; (Width)
);
&lt;/pre&gt;
&lt;/div&gt;
</description><link>https://oracletutorialpoint.blogspot.com/2016/07/entity-relationship-model-er-model.html</link><thr:total>0</thr:total><georss:featurename>Bengaluru, Karnataka 560017, India</georss:featurename><georss:point>12.9715987 77.594562699999983</georss:point><georss:box>12.4764182 76.949115699999979 13.4667792 78.240009699999987</georss:box><author>subbareddynallamachu@gmail.com (Subbareddy Nallamachu)</author></item></channel></rss>