<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-6615009983904348068</atom:id><lastBuildDate>Mon, 15 Dec 2025 15:29:49 +0000</lastBuildDate><category>select</category><category>oracle</category><category>descending</category><category>insert</category><category>insert into</category><category>where</category><category>Commit</category><category>Rollback</category><category>auto commit</category><category>get tables modifying time</category><category>having</category><category>null</category><category>order by</category><category>ARCn</category><category>AUTONOMOUS_TRANSACTION</category><category>CJQn</category><category>CKPT</category><category>Check constraint</category><category>DBWn</category><category>DDL</category><category>DDL with auto commit</category><category>Dnnn</category><category>LGWR</category><category>MMAN</category><category>PMON</category><category>PRAGMA</category><category>PRAGMA AUTONOMOUS_TRANSACTION</category><category>Partially commit</category><category>Processes</category><category>QMNn</category><category>RECO</category><category>SMON</category><category>Snnn</category><category>aggregate function</category><category>all_tab_columns</category><category>avg</category><category>count</category><category>data</category><category>data dictionary</category><category>delete</category><category>delete all</category><category>dict_coulmns</category><category>dictionary</category><category>drop</category><category>drop index</category><category>drop table</category><category>drop view</category><category>dual</category><category>grades</category><category>group by</category><category>index</category><category>insert all</category><category>insert all into</category><category>insert more than 1 row</category><category>insert more than 1 table</category><category>insert with check constraint</category><category>instant check</category><category>is null</category><category>learn</category><category>lower</category><category>max</category><category>max salary</category><category>min</category><category>multiple rows</category><category>ocp</category><category>pl.sql</category><category>range</category><category>rownum in select</category><category>scn_to_timestamp</category><category>self documenting</category><category>synonyms</category><category>table altering time</category><category>table modifying time</category><category>trim</category><category>truncate</category><category>views</category><category>what about DDL statements after DML statement.</category><title>Atchaya&#39;s Check Your Oracle Knowledge</title><description>Objective type Questions with Answers and Explanations&#xa;for Oracle PL/SQL and Database.</description><link>http://atchayasoracle.blogspot.com/</link><managingEditor>noreply@blogger.com (atchaya)</managingEditor><generator>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-4006811544277168724</guid><pubDate>Tue, 22 Dec 2009 07:16:00 +0000</pubDate><atom:updated>2012-09-25T05:50:14.689+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">all_tab_columns</category><category domain="http://www.blogger.com/atom/ns#">data dictionary</category><category domain="http://www.blogger.com/atom/ns#">dict_coulmns</category><category domain="http://www.blogger.com/atom/ns#">dictionary</category><category domain="http://www.blogger.com/atom/ns#">learn</category><category domain="http://www.blogger.com/atom/ns#">ocp</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">self documenting</category><title>21.Oracle - The self documenting dictionary</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Oracle - The self documenting dictionary&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Oracle&#39;s Data dictionary is itself self documenting. we can query DICTIONARY AND DICT_COLUMNS views for descriptions of the data dictionary views and their columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following query gives the descriptions of all of the data dictionary views.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;SELECT table_name, comments&lt;br /&gt;FROM dictionary&lt;br /&gt;ORDER BY table_name;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It gives the large amount of output. By using where class we can focus a smaller set of views as like the following query.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;SELECT table_name, comments&lt;br /&gt;FROM dictionary&lt;br /&gt;WHERE table_name LIKE &#39;%TABLE%&#39;&lt;br /&gt;ORDER BY table_name&lt;/span&gt;&lt;br /&gt;
It returns all views containing the word &#39;TABLE&#39;&lt;br /&gt;
&lt;br /&gt;
Like wise We can query the DICT_COLUMNS view also. It gives the descriptions for the columns for all views. Following query retrieves descriptions for the columns in ALL_TAB_COLUMNS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;SELECT column_name, comments&lt;br /&gt;FROM dict_columns&lt;br /&gt;WHERE table_name = &#39;ALL_TAB_COLUMNS&#39;;&lt;/span&gt;&lt;br /&gt;
This is a sample one. We can learn lot about oracle through data dictionary views, they are not available at any oracle site.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks..!&lt;br /&gt;
&lt;/div&gt;
</description><link>http://atchayasoracle.blogspot.com/2009/12/oracle-self-documenting-dictionary.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-2976318052909076873</guid><pubDate>Thu, 17 Dec 2009 18:15:00 +0000</pubDate><atom:updated>2009-12-30T22:24:55.318+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">dual</category><category domain="http://www.blogger.com/atom/ns#">lower</category><category domain="http://www.blogger.com/atom/ns#">rownum in select</category><category domain="http://www.blogger.com/atom/ns#">trim</category><title>20. TRIM Function</title><description>&lt;strong&gt;Which SELECT statement will the result &#39;elloworld&#39; from the string &#39;HelloWorld&#39;?&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;color:#3366ff;&quot;&gt;A. SELECT SUBSTR( &#39;HelloWorld&#39;,1) FROM dual;&lt;br /&gt;B. SELECT INITCAP(TRIM (&#39;HelloWorld&#39;, 1,1)) FROM dual;&lt;br /&gt;C. SELECT LOWER(SUBSTR(&#39;HellowWorld&#39;, 1, 1) FROM dual;&lt;br /&gt;D. SELECT LOWER(SUBSTR(&#39;HelloWorld&#39;, 2, 1) FROM dual;&lt;br /&gt;E. SELECT LOWER(TRIM (&#39;H&#39; FROM &#39;HelloWorld&#39;)) FROM dual;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Answer: E&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Explanation:&lt;br /&gt;&lt;/strong&gt;TRIM function accept a string describing the data you would like to trim from a column value. It can trim from both side of column value i.e. left and right. In the following statement this functionwill trim as&lt;br /&gt;SELECT LOWER(TRIM (&#39;+&#39; FROM &#39;HelloWorld&#39;)) FROM dual;&lt;br /&gt;&lt;br /&gt;From the above statement trim function will remove the character &#39;H&#39; from &#39;HelloWorld&#39; and LOWER function will convert the remaining character to lower case.</description><link>http://atchayasoracle.blogspot.com/2009/12/trim-function.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-1993408693632455664</guid><pubDate>Wed, 16 Dec 2009 18:13:00 +0000</pubDate><atom:updated>2009-12-30T22:24:21.074+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ARCn</category><category domain="http://www.blogger.com/atom/ns#">CJQn</category><category domain="http://www.blogger.com/atom/ns#">CKPT</category><category domain="http://www.blogger.com/atom/ns#">DBWn</category><category domain="http://www.blogger.com/atom/ns#">Dnnn</category><category domain="http://www.blogger.com/atom/ns#">LGWR</category><category domain="http://www.blogger.com/atom/ns#">MMAN</category><category domain="http://www.blogger.com/atom/ns#">PMON</category><category domain="http://www.blogger.com/atom/ns#">Processes</category><category domain="http://www.blogger.com/atom/ns#">QMNn</category><category domain="http://www.blogger.com/atom/ns#">RECO</category><category domain="http://www.blogger.com/atom/ns#">SMON</category><category domain="http://www.blogger.com/atom/ns#">Snnn</category><title>19. Oracle Processes</title><description>&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;Processes &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Oracle uses many small (focused) processes to manage and control the Oracle instance. This allows for optimum execution on multi-processor systems using multi-core and multi-threaded technology. &lt;/p&gt;&lt;p&gt;Some of these processes include:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;PMON - Process Monitor &lt;/p&gt;&lt;p&gt;SMON - System Monitor &lt;/p&gt;&lt;p&gt;ARCn - Redo Log Archiver &lt;/p&gt;&lt;p&gt;LGWR - Redo Log Writer &lt;/p&gt;&lt;p&gt;DBWn - Database Writer &lt;/p&gt;&lt;p&gt;CKPT - Checkpoint process &lt;/p&gt;&lt;p&gt;RECO - Recoverer &lt;/p&gt;&lt;p&gt;CJQn - Job Queue Coordinator &lt;/p&gt;&lt;p&gt;QMNn - Queue-monitor processes &lt;/p&gt;&lt;p&gt;Dnnn - Dispatcher Processes (multiplex server-processes on behalf of users) &lt;/p&gt;&lt;p&gt;Snnn - Shared server processes (serve client-requests) &lt;/p&gt;&lt;p&gt;MMAN - Internal process (used for internal database tasks) &lt;/p&gt;&lt;p&gt;LSP0 - Logical standby coordinator process (controls Data Guard log-application) &lt;/p&gt;&lt;p&gt;MRP - Media-recovery process (detached recovery-server process) &lt;/p&gt;&lt;p&gt;MMON - Memory-monitor process &lt;/p&gt;&lt;p&gt;MMNL - Memory monitor light (gathers and stores AWR statistics) &lt;/p&gt;&lt;p&gt;PSP0 - Process-spawner (spawns Oracle processes) &lt;/p&gt;&lt;p&gt;RFS - Remote file server process (archive to a remote site) &lt;/p&gt;&lt;p&gt;DBRM - DB resource manager (new in 11g) &lt;/p&gt;&lt;p&gt;DIAGn - Diagnosability process (new in 11g) &lt;/p&gt;&lt;p&gt;FBDA - Flashback data archiver process (new in 11g) &lt;/p&gt;&lt;p&gt;VKTM - Virtual Timekeeper (new in 11g) &lt;/p&gt;&lt;p&gt;Wnnn - Space Management Co-ordination process (new in 11g) &lt;/p&gt;&lt;p&gt;SMCn - Space Manager process (new in 11g) &lt;/p&gt;&lt;p&gt;An instance can mount and open one and only one database.&lt;br /&gt;A database can normally only be mounted and opened by one instance. However, when using Real Application Clusters (RAC) a database can be mounted and opened by many instances.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><link>http://atchayasoracle.blogspot.com/2009/12/oracle-processes.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-2804955001803965016</guid><pubDate>Sun, 22 Nov 2009 10:23:00 +0000</pubDate><atom:updated>2009-12-30T22:23:48.800+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Check constraint</category><category domain="http://www.blogger.com/atom/ns#">insert</category><category domain="http://www.blogger.com/atom/ns#">insert with check constraint</category><category domain="http://www.blogger.com/atom/ns#">instant check</category><title>18. ADDING CHECK CONSTRAINT WHILE INSERTING.</title><description>Examine the structure of the EMPLOYEES table:&lt;br /&gt;&lt;br /&gt;EMPLOYEE_ID NUMBER NOT NULL&lt;br /&gt;EMP_NAME VARCHAR2(30)&lt;br /&gt;JOB_ID VARCHAR2(20)&lt;br /&gt;SAL NUMBER&lt;br /&gt;MGR_ID NUMBER&lt;br /&gt;DEPARTMENT_ID NUMBER&lt;br /&gt;&lt;br /&gt;You want to create a SQL script file that contains an INSERT statement.&lt;br /&gt;When the script is run, the INSERT statement should insert a row with the specified values into the EMPLOYEES table.&lt;br /&gt;The INSERT statement should pass values to the table columns as specified below:&lt;br /&gt;&lt;br /&gt;EMPLOYEE_ID: Next value from the sequence&lt;br /&gt;&lt;br /&gt;EMP_ID_SEQEMP_NAME and JOB_ID: As specified by the user during run time, through substitution variables&lt;br /&gt;&lt;br /&gt;SAL: 2000&lt;br /&gt;&lt;br /&gt;MGR_ID: No value&lt;br /&gt;&lt;br /&gt;DEPARTMENT_ID: Supplied by the user during run time throughsubstitutionvariable.&lt;br /&gt;&lt;br /&gt;The INSERT statement should fail if the user supplies a value other than20 or 50.&lt;br /&gt;&lt;br /&gt;Which INSERT statement meets the above requirements?&lt;br /&gt;&lt;br /&gt;A. INSERT INTO employees VALUES (emp_id_seq.NEXTVAL, &#39;&amp;amp;ename&#39;, &#39;&amp;amp;jobid&#39;, 2000, NULL,&amp;amp;did);&lt;br /&gt;&lt;br /&gt;B. INSERT INTO employees VALUES (emp_id_seq.NEXTVAL, &#39;&amp;amp;ename&#39;, &#39;&amp;amp;jobid&#39;, 2000, NULL,&amp;amp;did IN (20,50));&lt;br /&gt;&lt;br /&gt;C. INSERT INTO (SELECT * FROM employees WHERE department_id IN (20,50)) VALUES(emp_id_seq.NEXTVAL, &#39;&amp;amp;ename&#39;, &#39;&amp;amp;jobid&#39;, 2000, NULL, &amp;amp;did);&lt;br /&gt;&lt;br /&gt;D. INSERT INTO (SELECT * FROM employees WHERE department_id IN (20,50) WITH CHECKOPTION) VALUES (emp_id_seq.NEXTVAL, &#39;&amp;amp;ename&#39;, &#39;&amp;amp;jobid&#39;, 2000, NULL, &amp;amp;did);&lt;br /&gt;&lt;br /&gt;E. INSERT INTO (SELECT * FROM employees WHERE (department_id = 20 AND department_id = 50) WITH CHECK OPTION ) VALUES (emp_id_seq.NEXTVAL, &#39;&amp;amp;ename&#39;,&#39;&amp;amp;jobid&#39;, 2000, NULL, &amp;amp;did);&lt;br /&gt;&lt;br /&gt;Answer: D</description><link>http://atchayasoracle.blogspot.com/2009/11/check-constraint-check-while-inserting.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-4374288892367556203</guid><pubDate>Sun, 27 Sep 2009 18:50:00 +0000</pubDate><atom:updated>2009-11-08T01:51:07.602+05:30</atom:updated><title>Question 17:How to get the &#39;n&#39; th maximum value of a column?</title><description>We can get the nth maximum value through query by using the combination of order by clause and rownum pseudo column.&lt;br /&gt;&lt;br /&gt;The Query following.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;SELECT MIN(columnname) &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;FROM ( SELECT coumnname FROM tablename ORDER BY columnname DESC)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;WHERE rownum &lt;= n&lt;/span&gt;</description><link>http://atchayasoracle.blogspot.com/2009/09/how-to-get-n-th-maximum-value-of-column.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-1549731689089125319</guid><pubDate>Mon, 31 Aug 2009 12:38:00 +0000</pubDate><atom:updated>2009-10-10T20:12:31.126+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">insert</category><category domain="http://www.blogger.com/atom/ns#">insert all</category><category domain="http://www.blogger.com/atom/ns#">insert all into</category><category domain="http://www.blogger.com/atom/ns#">insert into</category><category domain="http://www.blogger.com/atom/ns#">insert more than 1 row</category><category domain="http://www.blogger.com/atom/ns#">insert more than 1 table</category><title>Question 16.Inserting more than 1 row/table with single query.</title><description>&lt;strong&gt;Can we insert more than 1 row with 1 qyery in same table/diff tables?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Yes, we insert more than 1 row with 1 qyery by using the following method?&lt;/strong&gt;&lt;/p&gt;&lt;em&gt;&lt;strong&gt;syntax&lt;/strong&gt;&lt;br /&gt;&lt;/em&gt;INSERT ALL&lt;br /&gt;INTO tablename1 (fieldlist) VALUES (valuelist)&lt;br /&gt;INTO tablename2 (fieldlist) VALUES (valuelist)&lt;br /&gt;INTO tablename3 (fieldlist) VALUES (valuelist)&lt;br /&gt;SELECT * FROM DUAL;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;insert all into student (sno, name) values (1, &#39;Raja&#39;)&lt;br /&gt;into student (sno, name) values (2 &#39;Ravi&#39;)&lt;br /&gt;into student (sno, name) values (3, &#39;Balu&#39;)&lt;br /&gt;select * from dual;&lt;br /&gt;&lt;br /&gt;We can use more than 1 table also.&lt;br /&gt;insert all into student (sno, name) values (1, &#39;Raja&#39;)&lt;br /&gt;into student (sno, name) values (2 &#39;Ravi&#39;)&lt;br /&gt;into emp (eno, name) values (1, &#39;Mani&#39;)&lt;br /&gt;select * from dual;&lt;br /&gt;&lt;br /&gt;Interview quesitions and answers, objective type questions with answers :  &lt;a href=&quot;http://atchaya.com/ora/orahome.html&quot;&gt;http://atchaya.com/ora/orahome.html&lt;/a&gt;&lt;br /&gt;Oracle forum : &lt;a href=&quot;http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle&quot;&gt;http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle&lt;/a&gt;</description><enclosure type='' url='http://atchaya.x10hosting.com' length='0'/><link>http://atchayasoracle.blogspot.com/2009/08/question-16inserting-more-than-1.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-2089710009425047321</guid><pubDate>Mon, 10 Aug 2009 08:35:00 +0000</pubDate><atom:updated>2009-08-10T14:07:53.160+05:30</atom:updated><title>Question 15</title><description>Write a PL/SQL Program for the following output&lt;br /&gt;   --*--&lt;br /&gt;  -***-  &lt;br /&gt;  *****&lt;br /&gt;   -***- &lt;br /&gt;   --*--&lt;br /&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;The output based on the value of &#39;n&#39;&lt;/em&gt;&lt;br /&gt;declare n number(2) default 20;&lt;br /&gt;i number(2);&lt;br /&gt;j number(2);&lt;br /&gt;h number(2);&lt;br /&gt;s number(2);&lt;br /&gt;b varchar2(1) default &#39;I&#39;;&lt;br /&gt;begin&lt;br /&gt;   s := 1;&lt;br /&gt;   if n mod 2 = 0 then&lt;br /&gt;      n := n+1;&lt;br /&gt;   end if;&lt;br /&gt;   h := n/2 -1;&lt;br /&gt;   for i in 1..n loop&lt;br /&gt;       for j in 1..h loop&lt;br /&gt;          dbms_output.put(&#39;-&#39;);&lt;br /&gt;       end loop;&lt;br /&gt;       for j in 1..s loop&lt;br /&gt;           dbms_output.put(&#39;*&#39;);&lt;br /&gt;       end loop;&lt;br /&gt;       for j in 1..h loop&lt;br /&gt;          dbms_output.put(&#39;-&#39;);&lt;br /&gt;       end loop;&lt;br /&gt;       dbms_output.put_line(&#39; &#39;);&lt;br /&gt;       if n = s then&lt;br /&gt;           b := &#39;D&#39;;&lt;br /&gt;       end if;&lt;br /&gt;          IF b=&#39;I&#39; then&lt;br /&gt;         s := s+2;&lt;br /&gt;         h := h-1;&lt;br /&gt;       else&lt;br /&gt;         s := s-2;&lt;br /&gt;         h := h+1;&lt;br /&gt;       end if;&lt;br /&gt;   end loop;&lt;br /&gt;end;</description><link>http://atchayasoracle.blogspot.com/2009/08/question-15.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-4745408792540929478</guid><pubDate>Mon, 10 Aug 2009 01:03:00 +0000</pubDate><atom:updated>2009-10-10T19:41:18.666+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">auto commit</category><category domain="http://www.blogger.com/atom/ns#">data</category><category domain="http://www.blogger.com/atom/ns#">delete</category><category domain="http://www.blogger.com/atom/ns#">delete all</category><category domain="http://www.blogger.com/atom/ns#">drop</category><category domain="http://www.blogger.com/atom/ns#">drop index</category><category domain="http://www.blogger.com/atom/ns#">drop table</category><category domain="http://www.blogger.com/atom/ns#">drop view</category><category domain="http://www.blogger.com/atom/ns#">get tables modifying time</category><category domain="http://www.blogger.com/atom/ns#">index</category><category domain="http://www.blogger.com/atom/ns#">Rollback</category><category domain="http://www.blogger.com/atom/ns#">synonyms</category><category domain="http://www.blogger.com/atom/ns#">truncate</category><category domain="http://www.blogger.com/atom/ns#">views</category><title>Question: 14: Drop Table - Dependency</title><description>&lt;span style=&quot;font-size:130%;&quot;&gt;Evaluate the SQL statement&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;strong&gt;DROP TABLE DEPT&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;Which four statements are true of the SQL statement? &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;A. You cannot roll back this statement.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;B. All pending transactions are committed.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;C. Al views based on the DEPT table are deleted.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;D. All indexes based on the DEPT table are dropped.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;E. All data in the table is deleted, and the table structure is also deleted. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;F.All data in the table is deleted, but the structure of the table is retained. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;G.All synonyms based on the DEPT table are deleted.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;A, B, D and E&lt;br /&gt;&lt;br /&gt;Explanation:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;A. You cannot roll back DROP TABLE statement. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;B. All pending transactions related on this table arecommitted. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;D. If the table is dropped, Oracle automatically drops any index, trigger and constraintassociated with the table as well. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;E. All data in the table is deleted, and the table structure is also deleted.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;strong&gt;Incorrect Answers&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;C: All views based on the DEPT table become invalid, but they are not deleted.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;F: All data in the table is deleted, and the table structure is also deleted. Command &lt;strong&gt;TRUNCATE&lt;/strong&gt; deletes all data in the table, but does not delete the structure of the table.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;G: All synonyms based on the DEPT table are not deleted after dropping the table.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;Note: Go to lot of interview quesitions and answers, objective type questions with answers click &lt;a href=&quot;http://atchaya.com/ora/orahome.html&quot;&gt;http://atchaya.com/ora/orahome.html&lt;/a&gt;  Goto Oracle forum click &lt;a href=&quot;http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle&quot;&gt;http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><link>http://atchayasoracle.blogspot.com/2009/08/question-14-drop-table-dependency.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-9052184248421396992</guid><pubDate>Sat, 08 Aug 2009 20:04:00 +0000</pubDate><atom:updated>2009-08-09T01:48:15.903+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">auto commit</category><category domain="http://www.blogger.com/atom/ns#">Commit</category><category domain="http://www.blogger.com/atom/ns#">DDL</category><category domain="http://www.blogger.com/atom/ns#">DDL with auto commit</category><category domain="http://www.blogger.com/atom/ns#">insert into</category><category domain="http://www.blogger.com/atom/ns#">what about DDL statements after DML statement.</category><title>Question 13: DDL and Commit</title><description>I have updated some tables and before commit if I will give one DDL command means what will happen?&lt;br /&gt;&lt;br /&gt;For example&lt;br /&gt;&lt;strong&gt;CREATE TABLE  test(fldname number(10));&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;insert into test (fldname) values (10);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;insert into test (fldname) values (20);&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;After that without giving &lt;strong&gt;Commit&lt;/strong&gt; statement, I issued one DDL command&lt;br /&gt;&lt;strong&gt;CREATE  TABLE    test1( sno number(10))&lt;/strong&gt;&lt;br /&gt;What aobut the previous inserts? Is it committed or not? explain.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;I checked this and found the following 3 points.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Point No. 1:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;If we give a DDL command with syntax error  means it will not commit and gives the error. For example the following statement&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;CREATE TABLE  test(fldname number(10), ); &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;note that the comma, gives &quot;invalid identifier.. &quot; error and without committing the INSERT statements.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Point No. 2:&lt;br /&gt;If the  given DDL command executes without any error  means it will auto commit the INSERT statements.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Point No. 3:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;If we give a DDL command without any syntax error  and that statement not execute also auto commit the INSERT statements and gives the exception of thee DDL statement.   For example the following statement&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;CREATE TABLE  test(fldname number(10) ); &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;gives  &quot;name is already used by an existing object&quot;  exception after auto commiting the insert statements.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;</description><link>http://atchayasoracle.blogspot.com/2009/08/question-13-ddl-and-commit.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-5099680864022985962</guid><pubDate>Thu, 06 Aug 2009 11:20:00 +0000</pubDate><atom:updated>2009-10-10T19:32:28.301+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">AUTONOMOUS_TRANSACTION</category><category domain="http://www.blogger.com/atom/ns#">Commit</category><category domain="http://www.blogger.com/atom/ns#">Partially commit</category><category domain="http://www.blogger.com/atom/ns#">PRAGMA</category><category domain="http://www.blogger.com/atom/ns#">PRAGMA AUTONOMOUS_TRANSACTION</category><category domain="http://www.blogger.com/atom/ns#">Rollback</category><title>Question 12: What is PRAGMA AUTONOMOUS_TRANSACTION?</title><description>You are running a pl/sql block or procedure called parent&lt;br /&gt;&lt;br /&gt;In that procedure you called another one procedure namely child and that procedure contains commit statement.&lt;br /&gt;&lt;br /&gt;After calling the child procedure the transactions done in parent procedure are also committed due to the child procedure commit statement.&lt;br /&gt;&lt;br /&gt;But you want to rollback or commit the parent procedure whole transactions based on your requirement after the calling procedure child.&lt;br /&gt;&lt;br /&gt;In this situation, you should add the &quot;pragma autonomus transaction&quot; in child procedure.&lt;br /&gt;If you add this statement then it acts as a separate. If you use commit in child procedure it will not affect the parent procedure.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example :&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;CREATE OR REPLACE PROCEDURE parent()&lt;/em&gt;&lt;br /&gt;&lt;em&gt;AS&lt;br /&gt;BEGIN &lt;/em&gt;&lt;br /&gt;&lt;em&gt;UPDATE tab1 SET fieldname = value WHERE condition; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;UPDATE tab2 SET fieldname = value WHERE condition;&lt;br /&gt;child();&lt;br /&gt;UPDATE tab4 SET fieldname = value WHERE condition;&lt;br /&gt;IF parentcondition &lt;/em&gt;&lt;br /&gt;&lt;em&gt;COMMIT; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;ELSE &lt;/em&gt;&lt;br /&gt;&lt;em&gt;ROLLBACK; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;END IF; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;END.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;CREATE OR REPLACE PROCEDURE child()&lt;br /&gt;AS &lt;/em&gt;&lt;br /&gt;&lt;em&gt;PRAGMA AUTONOMOUS_TRANSACTION;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;BEGIN &lt;/em&gt;&lt;br /&gt;&lt;em&gt;UPDATE tab3 SET fieldname = value WHERE condition;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;COMMIT; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;END.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;In above case tab1, tab2 and tab4 tables transactions will commit or rollback based on the parentcondition. but tab3 updation will always commits, that is not consider the parent procedure.&lt;br /&gt;&lt;p&gt;lot of interview quesitions and answers, objective type questions with answers also available. To see click &lt;a href=&quot;http://atchaya.com/ora/orahome.html&quot;&gt;http://atchaya.com/ora/orahome.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;</description><link>http://atchayasoracle.blogspot.com/2009/08/question-12-what-is-pragma.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-2499204995135854746</guid><pubDate>Sat, 01 Aug 2009 19:21:00 +0000</pubDate><atom:updated>2009-08-02T00:58:17.393+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">get tables modifying time</category><category domain="http://www.blogger.com/atom/ns#">scn_to_timestamp</category><category domain="http://www.blogger.com/atom/ns#">select</category><category domain="http://www.blogger.com/atom/ns#">table altering time</category><category domain="http://www.blogger.com/atom/ns#">table modifying time</category><title>Question 11: Oracle Tables Last Modifying Time</title><description>&lt;strong&gt;Suppose Database D1 contains 100 tables.. &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;How 2 select the tables which are modified at 10am today?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. SELECT table_name, table_owner FROM all_tab_modifications&lt;br /&gt;WHERE to_char(timestamp,&#39;YYYYMMDDHH24MM&#39;) = to_char(sysdate,&#39;YYYYMMDD&#39;)&#39;1000&#39;&lt;br /&gt;This will gives the table names which are modified (insert, update, delete, truncated) at 10 AM.&lt;br /&gt;&lt;br /&gt;2. SELECT scn_to_timestamp(max(ora_rowscn))&lt;br /&gt;FROM &lt;table_name&gt;;</description><link>http://atchayasoracle.blogspot.com/2009/08/oracle-tables-last-modifying-time.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-9053966758985980306</guid><pubDate>Thu, 30 Jul 2009 00:21:00 +0000</pubDate><atom:updated>2009-07-30T06:03:41.347+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">insert</category><category domain="http://www.blogger.com/atom/ns#">insert into</category><category domain="http://www.blogger.com/atom/ns#">multiple rows</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">pl.sql</category><category domain="http://www.blogger.com/atom/ns#">select</category><title>Question 10. Inserting Rows</title><description>&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;How many number of rows, I can insert into a table simultaenously?&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;Answer : &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;Method 1:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;If you want to insert multiple rows with a single INSERT statement, you can use a subquery instead of the VALUES clause. Rows returned from the subquery will be inserted the target table.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;Example: &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;INSERT INTO &lt;em&gt;tablename1&lt;tablename&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;SELECT &lt;em&gt;fieldnamelist&lt;/em&gt; &lt;fieldname&gt;FROM &lt;em&gt;tablename&lt;/em&gt; &lt;tablename2&gt;WHERE &lt;em&gt;condition&lt;/em&gt;&lt;where&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;</description><link>http://atchayasoracle.blogspot.com/2009/07/question-10-inserting-rows.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-5896225514308520207</guid><pubDate>Wed, 10 Jun 2009 21:07:00 +0000</pubDate><atom:updated>2009-06-11T02:56:05.924+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">descending</category><category domain="http://www.blogger.com/atom/ns#">is null</category><category domain="http://www.blogger.com/atom/ns#">null</category><category domain="http://www.blogger.com/atom/ns#">where</category><title>Question 9: null in where clause</title><description>The EMP table contains these columns:&lt;br /&gt;&lt;br /&gt;LAST NAME VARCHAR2(25)&lt;br /&gt;SALARY  NUMBER(6,2)&lt;br /&gt;DEPARTMENT_ID NUMBER(6)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You need to display the employees who have not been assigned to any department.&lt;br /&gt;You write the SELECT statement:&lt;br /&gt;&lt;br /&gt;SELECT LAST_NAME, SALARY, DEPARTMENT_ID&lt;br /&gt;FROM EMP WHERE DEPARTMENT_ID = NULL;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What is true about this SQL statement?&lt;br /&gt;&lt;br /&gt;A. The SQL statement displays the desired results.&lt;br /&gt;&lt;br /&gt;B. The column in the WHERE clause should be changed to display the desired results.&lt;br /&gt;&lt;br /&gt;C. The operator in the WHERE clause should be changed to display the desired results.&lt;br /&gt;&lt;br /&gt;D. The WHERE clause should be changed to use an outer join to display the desired results.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer:  C&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;Explanation:&lt;br /&gt;The operator in the WHERE clause should be changed to display the desired results. There are times when you want to substitute a value in place of NULL.&lt;br /&gt;Oracle provides this functionality with a special function, called NVL().&lt;br /&gt;You can use operation equal with the keywords IS NULL, or you can achieve desired results using NVL() function after the WHERE clause.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Incorrect Answers&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A: The SQL statement will generate an error because you cannot use operation equal with NULL.&lt;br /&gt;&lt;br /&gt;B: The column in the WHERE clause should not be changed to display the desired results.&lt;br /&gt;&lt;br /&gt;D: Since there is only one table used in this query you don&#39;t need to use outer join to display the desired results.</description><link>http://atchayasoracle.blogspot.com/2009/06/null-in-where-clause.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-3464321523097083902</guid><pubDate>Tue, 09 Jun 2009 18:19:00 +0000</pubDate><atom:updated>2009-06-09T23:58:37.280+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#">max</category><category domain="http://www.blogger.com/atom/ns#">min</category><title>Question 8: Aggregate Functions</title><description>Examine the description of the STUDENTS table:&lt;br /&gt;STD_ID NUMBER(4)&lt;br /&gt;COURSE_ID VARCHARD2(10)&lt;br /&gt;START_DATE DATE&lt;br /&gt;END_DATE DATE&lt;br /&gt;&lt;br /&gt;Which two aggregate functions are valid on the START_DATE column? (Choose two)&lt;br /&gt;&lt;br /&gt;A. SUM(start_date)&lt;br /&gt;&lt;br /&gt;B. AVG(start_date)&lt;br /&gt;&lt;br /&gt;C. COUNT(start_date)&lt;br /&gt;&lt;br /&gt;D. AVG(start_date, end_date)&lt;br /&gt;&lt;br /&gt;E. MIN(start_date)&lt;br /&gt;&lt;br /&gt;F. MAXIMUM(start_date)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: C &amp;amp; E&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br /&gt;It is possible to apply COUNT() and MIN() functions on the column with DATE data type.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Incorrect Answers&lt;/strong&gt;&lt;br /&gt;A: Function SUM() cannot be used with DATE data type column.&lt;br /&gt;&lt;br /&gt;B: Function AVG() cannot be used with DATE data type column.&lt;br /&gt;&lt;br /&gt;D: Function AVG() cannot be used with DATE data type column, and function AVG() just has one parameter X, not two. It averages all X column values returned by the SELECT statement.&lt;br /&gt;&lt;br /&gt;F: There is no MAXIMUM() function in Oracle, only MAX() function exists.</description><link>http://atchayasoracle.blogspot.com/2009/06/question-8-aggregate-functions.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-2766414370024777243</guid><pubDate>Tue, 09 Jun 2009 18:12:00 +0000</pubDate><atom:updated>2009-06-09T23:55:16.681+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">group by</category><category domain="http://www.blogger.com/atom/ns#">max salary</category><category domain="http://www.blogger.com/atom/ns#">select</category><title>Question 7: Group By</title><description>Examine the description of the EMPLOYEES table:&lt;br /&gt;&lt;br /&gt;EMP_ID NUMBER(4) NOT NULL&lt;br /&gt;LAST_NAME VARCHAR2(30) NOT NULL&lt;br /&gt;FIRST_NAME VARCHAR2(30)&lt;br /&gt;DEPT_ID NUMBER(2)&lt;br /&gt;JOB_CAT VARCHARD2(30)&lt;br /&gt;SALARY NUMBER(8,2)&lt;br /&gt;&lt;br /&gt;Which statement shows the maximum salary paid in each job category of each department?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A.SELECT dept_id, job_cat, MAX(salary) FROM employees&lt;br /&gt;WHERE salary &gt; MAX(salary);&lt;br /&gt;&lt;br /&gt;B.SELECT dept_id, job_cat, MAX(salary) FROM employees&lt;br /&gt;GROUP BY dept_id, job_cat;&lt;br /&gt;&lt;br /&gt;C. SELECT dept_id, job_cat, MAX(salary) FROM employees;&lt;br /&gt;&lt;br /&gt;D. SELECT dept_id, job_cat, MAX(salary) FROM employees&lt;br /&gt;GROUP BY dept_id;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Answer: B&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;This answer provides correct syntax and semantics to show the maximum salary paid in each job category of each department.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Incorrect Answers&lt;br /&gt;&lt;br /&gt;A: This query will not return any row because condition SALARY &gt; MAX(SALARY) is FALSE.&lt;br /&gt;&lt;br /&gt;C: This query will return error because you cannot show maximum salary with DEPT_ID and JOB_CAT without grouping by these columns.&lt;br /&gt;&lt;br /&gt;D: The GROUP BY clause is missing JOB_ID column.&lt;br /&gt;&lt;br /&gt;E: You don&#39;t need to group results of query by SALARY in the GROUP BY column.</description><link>http://atchayasoracle.blogspot.com/2009/06/question-7-group-by.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-393271781561477133</guid><pubDate>Mon, 08 Jun 2009 18:31:00 +0000</pubDate><atom:updated>2009-06-09T00:04:58.707+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">descending</category><category domain="http://www.blogger.com/atom/ns#">null</category><category domain="http://www.blogger.com/atom/ns#">order by</category><title>Question 6: ORDER BY with NULL</title><description>You are sorting data in a table in you SELECT statement in descending order.&lt;br /&gt;The column you are sorting on contains NULL records, where will the NULL record appears?&lt;br /&gt;&lt;br /&gt;A.At the beginning of the list.&lt;br /&gt;&lt;br /&gt;B.At the end of the list.&lt;br /&gt;&lt;br /&gt;C.In the middle of the list.&lt;br /&gt;&lt;br /&gt;D.At the same location they are listed in the unordered table.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Answer:  A&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;When sorting a column with null values in ascending order then the oracle places the Null values&lt;br /&gt;at the end of the list if the sorting is in descending order the oracle places the null values at the&lt;br /&gt;start of the list.</description><link>http://atchayasoracle.blogspot.com/2009/06/question-6-order-by-with-null.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-8371947644935782839</guid><pubDate>Mon, 08 Jun 2009 18:25:00 +0000</pubDate><atom:updated>2009-06-09T23:57:34.979+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">having</category><category domain="http://www.blogger.com/atom/ns#">select</category><category domain="http://www.blogger.com/atom/ns#">where</category><title>Question 5: Where and having clauses</title><description>&lt;p&gt;Which two statements are true about WHERE and HAVING clauses? (Choose two)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;A. A WHERE clause can be used to restrict both rows and groups.&lt;/p&gt;&lt;p&gt;B. A WHERE clause can be used to restrict rows only.&lt;/p&gt;&lt;p&gt;C. A HAVING clause can be used to restrict both rows and groups.&lt;/p&gt;&lt;p&gt;D. A HAVING clause can be used to restrict groups only.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Answer: B, C&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Explanation :&lt;/p&gt;&lt;p&gt;HAVING clause to specify which groups are to be displayed and thus further restrict the groups on the basis of aggregate information.&lt;/p&gt;&lt;p&gt;The Oracle server performs the following steps when youuse the Having clause&lt;/p&gt;&lt;p&gt;1. rows are grouped&lt;/p&gt;&lt;p&gt;2. the group function is applied to the group&lt;/p&gt;&lt;p&gt;3. the group that match the criteria in the Having clause are displayed.&lt;/p&gt;&lt;p&gt;WHERE clause cannot be use to restrict groups&lt;/p&gt;&lt;p&gt;HAVING clause use to restrict groups&lt;/p&gt;&lt;p&gt;WHERE clause cannot be use when there is group functions.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Incorrect Answers :&lt;/p&gt;&lt;p&gt;A. Where clause cannot be use to restrict groups&lt;/p&gt;&lt;p&gt;D. When HAVING clause is use rows are grouped as well.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><link>http://atchayasoracle.blogspot.com/2009/06/question-5-where-and-having-clauses.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-6123880505549241493</guid><pubDate>Sat, 06 Jun 2009 14:10:00 +0000</pubDate><atom:updated>2009-06-06T20:04:46.998+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">having</category><category domain="http://www.blogger.com/atom/ns#">range</category><category domain="http://www.blogger.com/atom/ns#">select</category><category domain="http://www.blogger.com/atom/ns#">where</category><title>Question: 4  -  WHERE clause</title><description>The ORDERS table has these columns:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ORDER_ID NUMBER(4) NOT NULL&lt;br /&gt;CUSTOMER_ID NUMBER(12) NOT NULL&lt;br /&gt;ORDER_TOTAL NUMBER(10,2)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The ORDERS table tracks the Order number, the order total, and the customer to whom the Order belongs.&lt;br /&gt;&lt;br /&gt;Which two statements retrieve orders with an inclusive total that ranges between 100.00 and 2000.00 dollars?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A.SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;RANGE ON order_total (100 AND 2000) INCLUSIVE;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;B.SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;HAVING order_total BETWEEN 100 and 2000;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C. SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;WHERE order_total BETWEEN 100 and 2000;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;D. SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;WHERE order_total &gt;= 100 and &lt;= 2000;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Answer:C&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Answers C provides correct results to show. You can use BETWEEN or comparison operations to retrieve data.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Incorrect Answers&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A: There is no RANGE ON or INCLUSIVE keyword in Oracle.&lt;br /&gt;B: HAVING clause can be use only in conjunction with the GROUP BY clause.&lt;br /&gt;D: Syntax &#39;order_total &gt;= 100 and &lt;= 2000&#39; is incorrect.</description><link>http://atchayasoracle.blogspot.com/2009/06/question-4-where-clause.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-6327029618404429283</guid><pubDate>Sat, 06 Jun 2009 14:10:00 +0000</pubDate><atom:updated>2009-06-09T23:59:43.375+05:30</atom:updated><title></title><description>The ORDERS table has these columns:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ORDER_ID      NUMBER(4)     NOT NULL&lt;br /&gt;CUSTOMER_ID   NUMBER(12)    NOT NULL&lt;br /&gt;ORDER_TOTAL   NUMBER(10,2)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The ORDERS table tracks the Order number, the order total, and the customer to whom the Order belongs. Which two statements retrieve orders with an inclusive total that ranges between&lt;br /&gt;100.00 and 2000.00 dollars?&lt;br /&gt;&lt;br /&gt;A.SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;RANGE ON order_total (100 AND 2000) INCLUSIVE;&lt;br /&gt;&lt;br /&gt;B.SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;HAVING order_total BETWEEN 100 and 2000;&lt;br /&gt;&lt;br /&gt;C.  SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;WHERE order_total BETWEEN 100 and 2000;&lt;br /&gt;&lt;br /&gt;D.  SELECT customer_id, order_id, order_total&lt;br /&gt;FROM orders&lt;br /&gt;WHERE order_total &gt;= 100 and &lt;= 2000;&lt;br /&gt;&lt;br /&gt;Answer:C&lt;br /&gt;Explanation:&lt;br /&gt;Answers C provides correct results to show. You can use BETWEEN or comparison&lt;br /&gt;operations to retrieve data.&lt;br /&gt;&lt;br /&gt;Incorrect Answers&lt;br /&gt;A: There is no RANGE ON or INCLUSIVE keyword in Oracle.&lt;br /&gt;B: HAVING clause can be use only in conjunction with the GROUP BY clause.&lt;br /&gt;D: Syntax &#39;order_total &gt;= 100 and &lt;= 2000&#39; is incorrect.&lt;br /&gt;</description><link>http://atchayasoracle.blogspot.com/2009/06/orders-table-has-these-columns-orderid.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-4301463447470989324</guid><pubDate>Fri, 05 Jun 2009 17:10:00 +0000</pubDate><atom:updated>2009-06-05T22:43:29.919+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">descending</category><category domain="http://www.blogger.com/atom/ns#">grades</category><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">order by</category><title>Order By clause</title><description>The STUDENT_GRADES table has these columns:&lt;br /&gt;&lt;br /&gt;STUDENT_ID   NUMBER(12)&lt;br /&gt;SEMESTER_END      DATE&lt;br /&gt;GPA    NUMBER(4,3)&lt;br /&gt;&lt;br /&gt;The registrar has requested a report listing the students grade point averages (GPA), sorted from highest grade point average to lowest within each semester, starting from the earliest date. &lt;br /&gt;&lt;br /&gt;Which statement accomplishes this?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A.SELECT student_id, semester_end, gpa&lt;br /&gt;FROM student_grades&lt;br /&gt;ORDER BY semester_end DESC, gpa DESC;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;B.SELECT student_id, semester_end, gpa&lt;br /&gt;FROM student_grades&lt;br /&gt;ORDER BY semester_end ASC, gpa ASC;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C.  SELECT student_id, semester_end, gpa&lt;br /&gt;FROM student_grades&lt;br /&gt;ORDER BY semester_end, gpa DESC;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;D.  SELECT student_id, semester_end, gpa&lt;br /&gt;FROM student_grades&lt;br /&gt;ORDER BY gpa DESC, semester_end DESC;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer&lt;/strong&gt;:C&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;This answer shows correct syntax and semantics to receive desired result.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Incorrect Answers&lt;/strong&gt;&lt;br /&gt;A: Semesters will be sorted started from the oldest date, not the earliest.&lt;br /&gt;B: GPA data will be sorted in ascending order, what is opposite to our task.&lt;br /&gt;D: Semesters will be sorted started from the oldest date, not the earliest. Only difference with answer A is order of columns in the ORDER BY clause.</description><link>http://atchayasoracle.blogspot.com/2009/06/order-by-clause.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-8029134043819458417</guid><pubDate>Thu, 04 Jun 2009 17:54:00 +0000</pubDate><atom:updated>2009-06-04T23:29:22.535+05:30</atom:updated><title></title><description>&lt;p&gt;&lt;strong&gt;Question: 2.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;You want to display the titles of books that meet these criteria:&lt;/p&gt;&lt;p&gt;1. Purchased before January 21, 20012. &lt;/p&gt;&lt;p&gt;Price is less then $500 or greater than $900&lt;/p&gt;&lt;p&gt;You want to sort the results by their data of purchase, starting with the most recently boughtbook.&lt;/p&gt;&lt;p&gt;Which statement should you use?&lt;br /&gt;&lt;/p&gt;&lt;p&gt;A. SELECT book_title FROM books &lt;/p&gt;&lt;p&gt;WHERE price between 500 and 900&lt;/p&gt;&lt;p&gt;AND purchase_date &lt; &#39;21-JAN-2001&#39;&lt;/p&gt;&lt;p&gt;ORDER BY purchase_date;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;B. SELECT book_titleFROM books&lt;/p&gt;&lt;p&gt;WHERE price IN (500,900)&lt;/p&gt;&lt;p&gt;AND purchase_date &lt; &#39;21-JAN-2001&#39;&lt;/p&gt;&lt;p&gt;ORDER BY purchase date ASC;&lt;br /&gt;C. SELECT book_titleFROM books &lt;/p&gt;&lt;p&gt;WHERE price &lt;&gt; 900&lt;/p&gt;&lt;p&gt;AND purchase_date &lt; &#39;21-JAN-2001&#39;&lt;/p&gt;&lt;p&gt;ORDER BY purchase date DESC;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;D. SELECT book_titleFROM books&lt;/p&gt;&lt;p&gt;WHERE (price &lt;&gt; 900)&lt;/p&gt;&lt;p&gt;AND purchase_date  &lt;  &#39;21-JAN-2001&#39;&lt;/p&gt;&lt;p&gt;ORDER BY purchase date DESC;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;br /&gt;Explanation:&lt;/p&gt;&lt;p&gt;This statement provides required results.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Incorrect Answers:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;A: This query will show books with price in range $500 and $900, not less then $500 or greater than $900.&lt;/p&gt;&lt;p&gt;B: This query will show books with prices exactly $500 or $900, not less then $500 or greaterthan $900.&lt;/p&gt;&lt;p&gt;C: This order will not show correct rows because of incorrect syntax in the WHERE clause.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;</description><link>http://atchayasoracle.blogspot.com/2009/06/question-2.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6615009983904348068.post-6200829598800124438</guid><pubDate>Thu, 04 Jun 2009 17:40:00 +0000</pubDate><atom:updated>2009-06-04T23:21:31.296+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">oracle</category><category domain="http://www.blogger.com/atom/ns#">select</category><title></title><description>&lt;strong&gt;Question 1.&lt;/strong&gt;&lt;br /&gt;You need to display the last names of those employees who have the letter &quot;A&quot; as the second character in their names.&lt;br /&gt;Which SQL statement displays the required results?&lt;br /&gt;&lt;br /&gt;A. SELECT last_nameFROM EMPWHERE last_name LIKE &#39;_A%&#39;;&lt;br /&gt;B. SELECT last_nameFROM EMPWHERE last name =&#39;*A%&#39;&lt;br /&gt;C.  SELECT last_nameFROM EMPWHERE last name =&#39;_A%&#39;;&lt;br /&gt;D.  SELECT last_nameFROM EMPWHERE last name LIKE &#39;*A%&#39;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;br /&gt;Explanation:&lt;br /&gt;Statement in this answer will show correct results because usage of operator LIKE and format mask  &#39;_A%&#39; extract the last names of those employees who have the letter  &#39;A&#39; as the second character in their names. Symbol &#39;_&#39; in format mask substitute exactly one symbol and cannot be NULL.&lt;br /&gt;Incorrect Answers&lt;br /&gt;B:  This statement will return only names starting from symbol &#39;*&#39;. It cannot be used as substitution symbol.&lt;br /&gt;C: Usage of equity operator here is not appropriate in this case: query will look exact for first symbol &#39;_&#39;, it will not be considered as substitution symbol.&lt;br /&gt;D: This statement will return only names starting from symbol &#39; *&#39;. It cannot be used as substitution symbol.</description><link>http://atchayasoracle.blogspot.com/2009/06/question-1.html</link><author>noreply@blogger.com (atchaya)</author><thr:total>0</thr:total></item></channel></rss>