<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6615009983904348068</id><updated>2011-11-27T15:24:05.805-08:00</updated><category term='RECO'/><category term='dict_coulmns'/><category term='CKPT'/><category term='Dnnn'/><category term='dual'/><category term='max salary'/><category term='order by'/><category term='drop table'/><category term='ocp'/><category term='is null'/><category term='insert'/><category term='self documenting'/><category term='Processes'/><category term='truncate'/><category term='drop'/><category term='having'/><category term='ARCn'/><category term='delete'/><category term='descending'/><category term='multiple rows'/><category term='aggregate function'/><category term='range'/><category term='SMON'/><category term='AUTONOMOUS_TRANSACTION'/><category term='Snnn'/><category term='drop view'/><category term='table modifying time'/><category term='pl.sql'/><category term='LGWR'/><category term='count'/><category term='MMAN'/><category term='get tables modifying time'/><category term='drop index'/><category term='Partially commit'/><category term='table altering time'/><category term='insert more than 1 row'/><category term='PMON'/><category term='select'/><category term='Commit'/><category term='group by'/><category term='all_tab_columns'/><category term='Check constraint'/><category term='instant check'/><category term='views'/><category term='delete all'/><category term='PRAGMA'/><category term='where'/><category term='PRAGMA AUTONOMOUS_TRANSACTION'/><category term='data dictionary'/><category term='trim'/><category term='synonyms'/><category term='grades'/><category term='DBWn'/><category term='learn'/><category term='oracle'/><category term='Rollback'/><category term='null'/><category term='insert more than 1 table'/><category term='min'/><category term='DDL'/><category term='max'/><category term='CJQn'/><category term='insert into'/><category term='DDL with auto commit'/><category term='dictionary'/><category term='insert with check constraint'/><category term='index'/><category term='rownum in select'/><category term='what about DDL statements after DML statement.'/><category term='scn_to_timestamp'/><category term='auto commit'/><category term='lower'/><category term='data'/><category term='insert all into'/><category term='insert all'/><category term='QMNn'/><category term='avg'/><title type='text'>Atchaya's Check Your Oracle Knowledge</title><subtitle type='html'>Objective type Questions with Answers and Explanations
for Oracle PL/SQL and Database.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-4006811544277168724</id><published>2009-12-21T23:16:00.000-08:00</published><updated>2009-12-30T08:55:17.156-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dict_coulmns'/><category scheme='http://www.blogger.com/atom/ns#' term='self documenting'/><category scheme='http://www.blogger.com/atom/ns#' term='all_tab_columns'/><category scheme='http://www.blogger.com/atom/ns#' term='learn'/><category scheme='http://www.blogger.com/atom/ns#' term='data dictionary'/><category scheme='http://www.blogger.com/atom/ns#' term='ocp'/><category scheme='http://www.blogger.com/atom/ns#' term='dictionary'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>21.Oracle - The self documenting dictionary</title><content type='html'>&lt;span style="FONT-WEIGHT: bold"&gt;Oracle - The self documenting dictionary&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Oracle'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="font-size:130%;"&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 amout 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="font-size:130%;"&gt;SELECT table_name, comments&lt;br /&gt;FROM dictionary&lt;br /&gt;WHERE table_name LIKE '%TABLE%'&lt;br /&gt;ORDER BY table_name&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;It returns all views containing the word 'TABLE'&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="font-size:130%;"&gt;SELECT column_name, comments&lt;br /&gt;FROM dict_columns&lt;br /&gt;WHERE table_name = 'ALL_TAB_COLUMNS';&lt;br /&gt;&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;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-4006811544277168724?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/4006811544277168724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=4006811544277168724&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4006811544277168724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4006811544277168724'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/12/oracle-self-documenting-dictionary.html' title='21.Oracle - The self documenting dictionary'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-2976318052909076873</id><published>2009-12-17T10:15:00.000-08:00</published><updated>2009-12-30T08:54:55.318-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rownum in select'/><category scheme='http://www.blogger.com/atom/ns#' term='dual'/><category scheme='http://www.blogger.com/atom/ns#' term='trim'/><category scheme='http://www.blogger.com/atom/ns#' term='lower'/><title type='text'>20. TRIM Function</title><content type='html'>&lt;strong&gt;Which SELECT statement will the result 'elloworld' from the string 'HelloWorld'?&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;A. SELECT SUBSTR( 'HelloWorld',1) FROM dual;&lt;br /&gt;B. SELECT INITCAP(TRIM ('HelloWorld', 1,1)) FROM dual;&lt;br /&gt;C. SELECT LOWER(SUBSTR('HellowWorld', 1, 1) FROM dual;&lt;br /&gt;D. SELECT LOWER(SUBSTR('HelloWorld', 2, 1) FROM dual;&lt;br /&gt;E. SELECT LOWER(TRIM ('H' FROM 'HelloWorld')) 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 ('+' FROM 'HelloWorld')) FROM dual;&lt;br /&gt;&lt;br /&gt;From the above statement trim function will remove the character 'H' from 'HelloWorld' and LOWER function will convert the remaining character to lower case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-2976318052909076873?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://atchaya.com' title='20. TRIM Function'/><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/2976318052909076873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=2976318052909076873&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2976318052909076873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2976318052909076873'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/12/trim-function.html' title='20. TRIM Function'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-1993408693632455664</id><published>2009-12-16T10:13:00.000-08:00</published><updated>2009-12-30T08:54:21.074-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Snnn'/><category scheme='http://www.blogger.com/atom/ns#' term='DBWn'/><category scheme='http://www.blogger.com/atom/ns#' term='CKPT'/><category scheme='http://www.blogger.com/atom/ns#' term='LGWR'/><category scheme='http://www.blogger.com/atom/ns#' term='ARCn'/><category scheme='http://www.blogger.com/atom/ns#' term='Dnnn'/><category scheme='http://www.blogger.com/atom/ns#' term='MMAN'/><category scheme='http://www.blogger.com/atom/ns#' term='PMON'/><category scheme='http://www.blogger.com/atom/ns#' term='RECO'/><category scheme='http://www.blogger.com/atom/ns#' term='QMNn'/><category scheme='http://www.blogger.com/atom/ns#' term='SMON'/><category scheme='http://www.blogger.com/atom/ns#' term='Processes'/><category scheme='http://www.blogger.com/atom/ns#' term='CJQn'/><title type='text'>19. Oracle Processes</title><content type='html'>&lt;p&gt;&lt;span style="font-size:130%;"&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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-1993408693632455664?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/1993408693632455664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=1993408693632455664&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/1993408693632455664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/1993408693632455664'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/12/oracle-processes.html' title='19. Oracle Processes'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-2804955001803965016</id><published>2009-11-22T02:23:00.000-08:00</published><updated>2009-12-30T08:53:48.800-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='insert with check constraint'/><category scheme='http://www.blogger.com/atom/ns#' term='Check constraint'/><category scheme='http://www.blogger.com/atom/ns#' term='instant check'/><category scheme='http://www.blogger.com/atom/ns#' term='insert'/><title type='text'>18. ADDING CHECK CONSTRAINT WHILE INSERTING.</title><content type='html'>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, '&amp;amp;ename', '&amp;amp;jobid', 2000, NULL,&amp;amp;did);&lt;br /&gt;&lt;br /&gt;B. INSERT INTO employees VALUES (emp_id_seq.NEXTVAL, '&amp;amp;ename', '&amp;amp;jobid', 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, '&amp;amp;ename', '&amp;amp;jobid', 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, '&amp;amp;ename', '&amp;amp;jobid', 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, '&amp;amp;ename','&amp;amp;jobid', 2000, NULL, &amp;amp;did);&lt;br /&gt;&lt;br /&gt;Answer: D&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-2804955001803965016?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/2804955001803965016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=2804955001803965016&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2804955001803965016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2804955001803965016'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/11/check-constraint-check-while-inserting.html' title='18. ADDING CHECK CONSTRAINT WHILE INSERTING.'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-4374288892367556203</id><published>2009-09-27T11:50:00.000-07:00</published><updated>2009-11-07T12:21:07.602-08:00</updated><title type='text'>Question 17:How to get the 'n' th maximum value of a column?</title><content type='html'>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="font-size:130%;"&gt;SELECT MIN(columnname) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;FROM ( SELECT coumnname FROM tablename ORDER BY columnname DESC)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;WHERE rownum &lt;= n&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-4374288892367556203?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://atchaya.com/ora/faq/ora_faq6.html' title='Question 17:How to get the &apos;n&apos; th maximum value of a column?'/><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/4374288892367556203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=4374288892367556203&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4374288892367556203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4374288892367556203'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/09/how-to-get-n-th-maximum-value-of-column.html' title='Question 17:How to get the &apos;n&apos; th maximum value of a column?'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-1549731689089125319</id><published>2009-08-31T05:38:00.000-07:00</published><updated>2009-10-10T07:42:31.126-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='insert more than 1 row'/><category scheme='http://www.blogger.com/atom/ns#' term='insert more than 1 table'/><category scheme='http://www.blogger.com/atom/ns#' term='insert all into'/><category scheme='http://www.blogger.com/atom/ns#' term='insert all'/><category scheme='http://www.blogger.com/atom/ns#' term='insert into'/><category scheme='http://www.blogger.com/atom/ns#' term='insert'/><title type='text'>Question 16.Inserting more than 1 row/table with single query.</title><content type='html'>&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, 'Raja')&lt;br /&gt;into student (sno, name) values (2 'Ravi')&lt;br /&gt;into student (sno, name) values (3, 'Balu')&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, 'Raja')&lt;br /&gt;into student (sno, name) values (2 'Ravi')&lt;br /&gt;into emp (eno, name) values (1, 'Mani')&lt;br /&gt;select * from dual;&lt;br /&gt;&lt;br /&gt;Interview quesitions and answers, objective type questions with answers :  &lt;a href="http://atchaya.com/ora/orahome.html"&gt;http://atchaya.com/ora/orahome.html&lt;/a&gt;&lt;br /&gt;Oracle forum : &lt;a href="http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle"&gt;http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-1549731689089125319?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='enclosure' type='' href='http://atchaya.x10hosting.com' length='0'/><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/1549731689089125319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=1549731689089125319&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/1549731689089125319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/1549731689089125319'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/08/question-16inserting-more-than-1.html' title='Question 16.Inserting more than 1 row/table with single query.'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-2089710009425047321</id><published>2009-08-10T01:35:00.000-07:00</published><updated>2009-08-10T01:37:53.160-07:00</updated><title type='text'>Question 15</title><content type='html'>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 'n'&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 'I';&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('-');&lt;br /&gt;       end loop;&lt;br /&gt;       for j in 1..s loop&lt;br /&gt;           dbms_output.put('*');&lt;br /&gt;       end loop;&lt;br /&gt;       for j in 1..h loop&lt;br /&gt;          dbms_output.put('-');&lt;br /&gt;       end loop;&lt;br /&gt;       dbms_output.put_line(' ');&lt;br /&gt;       if n = s then&lt;br /&gt;           b := 'D';&lt;br /&gt;       end if;&lt;br /&gt;          IF b='I' 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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-2089710009425047321?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/2089710009425047321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=2089710009425047321&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2089710009425047321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2089710009425047321'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/08/question-15.html' title='Question 15'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-4745408792540929478</id><published>2009-08-09T18:03:00.000-07:00</published><updated>2009-10-10T07:11:18.666-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='data'/><category scheme='http://www.blogger.com/atom/ns#' term='drop view'/><category scheme='http://www.blogger.com/atom/ns#' term='synonyms'/><category scheme='http://www.blogger.com/atom/ns#' term='index'/><category scheme='http://www.blogger.com/atom/ns#' term='views'/><category scheme='http://www.blogger.com/atom/ns#' term='drop index'/><category scheme='http://www.blogger.com/atom/ns#' term='drop'/><category scheme='http://www.blogger.com/atom/ns#' term='drop table'/><category scheme='http://www.blogger.com/atom/ns#' term='get tables modifying time'/><category scheme='http://www.blogger.com/atom/ns#' term='delete'/><category scheme='http://www.blogger.com/atom/ns#' term='delete all'/><category scheme='http://www.blogger.com/atom/ns#' term='Rollback'/><category scheme='http://www.blogger.com/atom/ns#' term='truncate'/><category scheme='http://www.blogger.com/atom/ns#' term='auto commit'/><title type='text'>Question: 14: Drop Table - Dependency</title><content type='html'>&lt;span style="font-size:130%;"&gt;Evaluate the SQL statement&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;DROP TABLE DEPT&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Which four statements are true of the SQL statement? &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;A. You cannot roll back this statement.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;B. All pending transactions are committed.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;C. Al views based on the DEPT table are deleted.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;D. All indexes based on the DEPT table are dropped.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&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="font-size:130%;"&gt;G.All synonyms based on the DEPT table are deleted.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;A, B, D and E&lt;br /&gt;&lt;br /&gt;Explanation:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;A. You cannot roll back DROP TABLE statement. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;B. All pending transactions related on this table arecommitted. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Incorrect Answers&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&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="http://atchaya.com/ora/orahome.html"&gt;http://atchaya.com/ora/orahome.html&lt;/a&gt;  Goto Oracle forum click &lt;a href="http://atchaya.wikidot.com/forum/c-91091/discussion-about-oracle"&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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-4745408792540929478?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/4745408792540929478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=4745408792540929478&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4745408792540929478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4745408792540929478'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/08/question-14-drop-table-dependency.html' title='Question: 14: Drop Table - Dependency'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-9052184248421396992</id><published>2009-08-08T13:04:00.000-07:00</published><updated>2009-08-08T13:18:15.903-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Commit'/><category scheme='http://www.blogger.com/atom/ns#' term='auto commit'/><category scheme='http://www.blogger.com/atom/ns#' term='DDL'/><category scheme='http://www.blogger.com/atom/ns#' term='what about DDL statements after DML statement.'/><category scheme='http://www.blogger.com/atom/ns#' term='insert into'/><category scheme='http://www.blogger.com/atom/ns#' term='DDL with auto commit'/><title type='text'>Question 13: DDL and Commit</title><content type='html'>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 "invalid identifier.. " 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  "name is already used by an existing object"  exception after auto commiting the insert statements.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-9052184248421396992?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/9052184248421396992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=9052184248421396992&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/9052184248421396992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/9052184248421396992'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/08/question-13-ddl-and-commit.html' title='Question 13: DDL and Commit'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-5099680864022985962</id><published>2009-08-06T04:20:00.000-07:00</published><updated>2009-10-10T07:02:28.301-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Commit'/><category scheme='http://www.blogger.com/atom/ns#' term='Rollback'/><category scheme='http://www.blogger.com/atom/ns#' term='PRAGMA'/><category scheme='http://www.blogger.com/atom/ns#' term='PRAGMA AUTONOMOUS_TRANSACTION'/><category scheme='http://www.blogger.com/atom/ns#' term='Partially commit'/><category scheme='http://www.blogger.com/atom/ns#' term='AUTONOMOUS_TRANSACTION'/><title type='text'>Question 12: What is PRAGMA AUTONOMOUS_TRANSACTION?</title><content type='html'>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 "pragma autonomus transaction" 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="http://atchaya.com/ora/orahome.html"&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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-5099680864022985962?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/5099680864022985962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=5099680864022985962&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/5099680864022985962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/5099680864022985962'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/08/question-12-what-is-pragma.html' title='Question 12: What is PRAGMA AUTONOMOUS_TRANSACTION?'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-2499204995135854746</id><published>2009-08-01T12:21:00.000-07:00</published><updated>2009-08-01T12:28:17.393-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scn_to_timestamp'/><category scheme='http://www.blogger.com/atom/ns#' term='get tables modifying time'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><category scheme='http://www.blogger.com/atom/ns#' term='table modifying time'/><category scheme='http://www.blogger.com/atom/ns#' term='table altering time'/><title type='text'>Question 11: Oracle Tables Last Modifying Time</title><content type='html'>&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,'YYYYMMDDHH24MM') = to_char(sysdate,'YYYYMMDD')'1000'&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;;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-2499204995135854746?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/2499204995135854746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=2499204995135854746&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2499204995135854746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2499204995135854746'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/08/oracle-tables-last-modifying-time.html' title='Question 11: Oracle Tables Last Modifying Time'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-9053966758985980306</id><published>2009-07-29T17:21:00.000-07:00</published><updated>2009-07-29T17:33:41.347-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pl.sql'/><category scheme='http://www.blogger.com/atom/ns#' term='multiple rows'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><category scheme='http://www.blogger.com/atom/ns#' term='insert into'/><category scheme='http://www.blogger.com/atom/ns#' term='insert'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Question 10. Inserting Rows</title><content type='html'>&lt;p&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&gt;Answer : &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;Method 1:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&gt;Example: &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&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="font-size:130%;"&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="font-size:130%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-9053966758985980306?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/9053966758985980306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=9053966758985980306&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/9053966758985980306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/9053966758985980306'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/07/question-10-inserting-rows.html' title='Question 10. Inserting Rows'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-5896225514308520207</id><published>2009-06-10T14:07:00.000-07:00</published><updated>2009-06-10T14:26:05.924-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='descending'/><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='where'/><category scheme='http://www.blogger.com/atom/ns#' term='is null'/><title type='text'>Question 9: null in where clause</title><content type='html'>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't need to use outer join to display the desired results.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-5896225514308520207?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/5896225514308520207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=5896225514308520207&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/5896225514308520207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/5896225514308520207'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/null-in-where-clause.html' title='Question 9: null in where clause'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-3464321523097083902</id><published>2009-06-09T11:19:00.000-07:00</published><updated>2009-06-09T11:28:37.280-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aggregate function'/><category scheme='http://www.blogger.com/atom/ns#' term='min'/><category scheme='http://www.blogger.com/atom/ns#' term='avg'/><category scheme='http://www.blogger.com/atom/ns#' term='count'/><category scheme='http://www.blogger.com/atom/ns#' term='max'/><title type='text'>Question 8: Aggregate Functions</title><content type='html'>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.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-3464321523097083902?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/3464321523097083902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=3464321523097083902&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/3464321523097083902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/3464321523097083902'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/question-8-aggregate-functions.html' title='Question 8: Aggregate Functions'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-2766414370024777243</id><published>2009-06-09T11:12:00.001-07:00</published><updated>2009-06-09T11:25:16.681-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='max salary'/><category scheme='http://www.blogger.com/atom/ns#' term='group by'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><title type='text'>Question 7: Group By</title><content type='html'>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't need to group results of query by SALARY in the GROUP BY column.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-2766414370024777243?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/2766414370024777243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=2766414370024777243&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2766414370024777243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/2766414370024777243'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/question-7-group-by.html' title='Question 7: Group By'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-393271781561477133</id><published>2009-06-08T11:31:00.000-07:00</published><updated>2009-06-08T11:34:58.707-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='descending'/><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='order by'/><title type='text'>Question 6: ORDER BY with NULL</title><content type='html'>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.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-393271781561477133?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/393271781561477133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=393271781561477133&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/393271781561477133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/393271781561477133'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/question-6-order-by-with-null.html' title='Question 6: ORDER BY with NULL'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-8371947644935782839</id><published>2009-06-08T11:25:00.000-07:00</published><updated>2009-06-09T11:27:34.979-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='having'/><category scheme='http://www.blogger.com/atom/ns#' term='where'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><title type='text'>Question 5: Where and having clauses</title><content type='html'>&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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-8371947644935782839?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/8371947644935782839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=8371947644935782839&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/8371947644935782839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/8371947644935782839'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/question-5-where-and-having-clauses.html' title='Question 5: Where and having clauses'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-6123880505549241493</id><published>2009-06-06T07:10:00.001-07:00</published><updated>2009-06-06T07:34:46.998-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='having'/><category scheme='http://www.blogger.com/atom/ns#' term='where'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><category scheme='http://www.blogger.com/atom/ns#' term='range'/><title type='text'>Question: 4  -  WHERE clause</title><content type='html'>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 'order_total &gt;= 100 and &lt;= 2000' is incorrect.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-6123880505549241493?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/6123880505549241493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=6123880505549241493&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/6123880505549241493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/6123880505549241493'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/question-4-where-clause.html' title='Question: 4  -  WHERE clause'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-6327029618404429283</id><published>2009-06-06T07:10:00.000-07:00</published><updated>2009-06-09T11:29:43.375-07:00</updated><title type='text'></title><content type='html'>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 'order_total &gt;= 100 and &lt;= 2000' is incorrect.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-6327029618404429283?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/6327029618404429283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=6327029618404429283&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/6327029618404429283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/6327029618404429283'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/orders-table-has-these-columns-orderid.html' title=''/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-4301463447470989324</id><published>2009-06-05T10:10:00.000-07:00</published><updated>2009-06-05T10:13:29.919-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='descending'/><category scheme='http://www.blogger.com/atom/ns#' term='grades'/><category scheme='http://www.blogger.com/atom/ns#' term='order by'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Order By clause</title><content type='html'>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.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-4301463447470989324?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/4301463447470989324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=4301463447470989324&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4301463447470989324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/4301463447470989324'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/order-by-clause.html' title='Order By clause'/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-8029134043819458417</id><published>2009-06-04T10:54:00.000-07:00</published><updated>2009-06-04T10:59:22.535-07:00</updated><title type='text'></title><content type='html'>&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; '21-JAN-2001'&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; '21-JAN-2001'&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; '21-JAN-2001'&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;  '21-JAN-2001'&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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-8029134043819458417?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/8029134043819458417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=8029134043819458417&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/8029134043819458417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/8029134043819458417'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/question-2.html' title=''/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6615009983904348068.post-6200829598800124438</id><published>2009-06-04T10:40:00.001-07:00</published><updated>2009-06-04T10:51:31.296-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='select'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'></title><content type='html'>&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 "A" 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 '_A%';&lt;br /&gt;B. SELECT last_nameFROM EMPWHERE last name ='*A%'&lt;br /&gt;C.  SELECT last_nameFROM EMPWHERE last name ='_A%';&lt;br /&gt;D.  SELECT last_nameFROM EMPWHERE last name LIKE '*A%'&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  '_A%' extract the last names of those employees who have the letter  'A' as the second character in their names. Symbol '_' 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 '*'. 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 '_', it will not be considered as substitution symbol.&lt;br /&gt;D: This statement will return only names starting from symbol ' *'. It cannot be used as substitution symbol.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6615009983904348068-6200829598800124438?l=atchayasoracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://atchayasoracle.blogspot.com/feeds/6200829598800124438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6615009983904348068&amp;postID=6200829598800124438&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/6200829598800124438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6615009983904348068/posts/default/6200829598800124438'/><link rel='alternate' type='text/html' href='http://atchayasoracle.blogspot.com/2009/06/question-1.html' title=''/><author><name>Atchaya</name><uri>http://www.blogger.com/profile/01838506591606988207</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/__Kx1PY6jnbU/SrY7XlkuJ7I/AAAAAAAAABc/TN_IcnOC-QU/S220/DSC00045.JPG'/></author><thr:total>0</thr:total></entry></feed>
