Mostly people think when you say i am oracle programmer, oracle DBA, Oracle BI Consultant.
They ask what is Oracle?
here is the answer
1. Oracle comes from the Latin word, oraculum or divine announcement.
2. In ancient Greece, it means somebody the tell the revelation.
3. In recent times, Oracle refers to the megalith company that supplies relational database
products to around 150 countries worldwide.
4. It is the worlds leading supplier of information management software with an annual
income of around $9.7 billion in recent years.
5. The product is used by some of the biggest web sites in cyberspace like the Fortune 1000
corporations.
6. Oracle is known for its sophisticated database system which makes it the highest ranking
performer in network computers.
what is Oracle database?
The Oracle database application makes use of microcomputers and high-end workstations as its
computer platform. It runs a set of processes on how to store and access data in the operating
system. It is a program that runs in the background but helps in the maintenance of stored data. It
also directs where these data shall be stored in the hard drive.
Developers needed for front-end programming, should be well versed in coding using tools,
reports, forms,and HTML among others. Back-end developers does not normally have the
detailed knowledge of forms as compared to their front-end counterparts.
Among the qualifications and requirements for the job would include the following:
1. Basic knowledge of SQL knowledge in nested subquery, aggregate functions, intervals, dual
tables, format mask, string conversion and so on.
2. Basic P/L and SQL -includes knowledge of block structures anonymous and unnamed; P/L
SQL collections, tablse, and arrays; explicit cursors; use of packages and straight procedures ;
maintenance and functionality among others.The above qualifications are needed for Junior
Developers that would still need further training. A Senior Developer however, would need to
have a good grasp of advanced PL/SQL topics.
For the Senior Developer level, the applicant should be well versed in the following areas:
1. Knowledge in aggregate and analytical programming
2. Knowledge in the creation of hierarchy query; generation of SML from a query; how to tune a
query
3. Implementing and creation of a member functions
4. Updates when SQL is not found
5. Knowldge of Select function with No Data Found exception
6. Knowledge in Native Dynamic SQL and autonomous transactions, among others
Oracle Developers being in great demand. Salaries of Oracle Developers on job posting in the
United States are 37% higher than all other job postings. The salary range is from $95,000 to
$107,000 per annum depending on qualifications and experience.
The cursor having query as SELECT. does not get closed even after COMMIT/ROLLBACK.
Q 15. Explain the usage of WHERE CURRENT OF clause in cursors ?
Answer : WHERE CURRENT OF clause in an UPDATE,DELETE statement refers to the latest
row fetched from a cursor.
Q 16. What is a database trigger ? Name some usages of database trigger ?
Answer : Database trigger is stored PL/SQL program unit associated with a specific database
table. Usages are Audit data modificateions, Log events transparently, Enforce complex business
rules Derive column values automatically, Implement complex security authorizations. Maintain
replicate tables.
Q 17. How many types of database triggers can be specified on a table? What are they?
Answer :
Insert
Update
Delete
Before Row
o.k.
o.k.
o.k.
After Row
o.k.
o.k.
o.k.
Before Statement
o.k.
o.k.
o.k.
After Statement
o.k.
o.k.
o.k.
If FOR EACH ROW clause is specified, then the trigger for each Row affected by the statement.
If WHEN clause is specified, the trigger fires according to the retruned boolean value.
Q 18. Is it possible to use Transaction control Statements such a ROLLBACK or COMMIT in
Database Trigger? Why?
Answer : It is not possible. As triggers are defined for each table, if you use COMMIT of
ROLLBACK in a trigger, it affects logical transaction processing.
Q 19. What are two virtual tables available during database trigger execution?
Answer : The table columns are referred as OLD.column_name and NEW.column_name.
For triggers related to INSERT only NEW.column_name values only available.
For triggers related to UPDATE only OLD.column_name NEW.column_name values only
available.
For triggers related to DELETE only OLD.column_name values only available.
Q 20. What happens if a procedure that updates a column of table X is called in a database
trigger of the same table?
Answer : Mutation of table occurs.
3. Implicit cursors are used in cursor for loops to handle data processing.
4. Implicit cursors are no longer a feature in Oracle.
2. END LOOP
3. IF-THEN
4. EXIT
6. Which line in the following statement will produce an error?
1. cursor action_cursor is
2. select name, rate, action
3. into action_record
4. from action_table;
5. There are no errors in this statement.
7. The command used to open a CURSOR FOR loop is
1. open
2. fetch
3. parse
4. None, cursor for loops handle cursor opening implicitly.
8. What happens when rows are found using a FETCH statement
1. It causes the cursor to close
2. It causes the cursor to open
3. It loads the current row values into variables
4. It creates the variables to hold the current row values
9. Read the following code:
10.
11.
17.
18.
19.
20.
FROM
gross_receipt
WHERE
movie_id = v_movie_id;
END IF;
END;
The trigger code should only execute when the column, COST_PER_TICKET, is greater
than $3. Which trigger information will you add?
1. WHEN (new.cost_per_ticket > 3.75)
2. WHEN (:new.cost_per_ticket > 3.75
3. WHERE (new.cost_per_ticket > 3.75)
4. WHERE (:new.cost_per_ticket > 3.75)
27. What is the maximum number of handlers processed before the PL/SQL block is
exited when an exception occurs?
1. Only one
2. All that apply
3. All referenced
4. None
28. For which trigger timing can you reference the NEW and OLD qualifiers?
1. Statement and Row
2. Statement only
3. Row only
4. Oracle Forms trigger
29. Read the following code:
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
yearly_budget
v_yearly_budget
studio
id = v_studio_id;
RETURN v_yearly_budget;
END;
Which set of statements will successfully invoke this function within SQL*Plus?
1. VARIABLE g_yearly_budget NUMBER
EXECUTE g_yearly_budget := GET_BUDGET(11);
2. VARIABLE g_yearly_budget NUMBER
EXECUTE :g_yearly_budget := GET_BUDGET(11);
3. VARIABLE :g_yearly_budget NUMBER
EXECUTE :g_yearly_budget := GET_BUDGET(11);
4. VARIABLE g_yearly_budget NUMBER
:g_yearly_budget := GET_BUDGET(11);
43.
44.
45.
46.
47.
48.
49.
1. An user defined exception must be declared and associated with the error code
and handled in the EXCEPTION section.
2. Handle the error in EXCEPTION section by referencing the error code directly.
3. Handle the error in the EXCEPTION section by referencing the
UNIQUE_ERROR predefined exception.
4. Check for success by checking the value of SQL%FOUND immediately after the
UPDATE statement.
51. Read the following code:
52.
53.
54.
55.
56.
57.
58.
59.
60.
You are about to add an argument to CALCULATE_BUDGET. What effect will this
have?
1. The GET_BUDGET function will be marked invalid and must be recompiled
before the next execution.
2. The SET_BUDGET function will be marked invalid and must be recompiled
before the next execution.
3. Only the CALCULATE_BUDGET procedure needs to be recompiled.
4. All three procedures are marked invalid and must be recompiled.
61. Which procedure can be used to create a customized error message?
1. RAISE_ERROR
2. SQLERRM
3. RAISE_APPLICATION_ERROR
4. RAISE_SERVER_ERROR
62. The CHECK_THEATER trigger of the THEATER table has been disabled. Which
command can you issue to enable this trigger?
This trigger must fire before each DELETE of the GROSS_RECEIPT table. It
should fire only once for the entire DELETE statement. What additional
information must you add?
1. BEFORE DELETE ON gross_receipt
2. AFTER DELETE ON gross_receipt
3. BEFORE (gross_receipt DELETE)
4. FOR EACH ROW DELETED FROM gross_receipt
72. Examine this function:
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
COMMIT;
1. Any DML statements issued by the construct are still pending and can be
committed or rolled back.
2. Any DML statements issued by the construct are committed
3. Unless a GOTO statement is used to continue processing within the BEGIN
section, the construct terminates.
4. The construct rolls back any DML statements issued and returns the unhandled
exception to the calling environment.
92. Examine this code
93.
94.
BEGIN
theater_pck.v_total_seats_sold_overall :=
theater_pck.get_total_for_year;
95.
END;
A stored function must return a value based on conditions that are determined at
runtime. Therefore, the SELECT statement cannot be hard-coded and must be
created dynamically when the function is executed. Which Oracle supplied package
will enable this feature?
1. DBMS_DDL
2. DBMS_DML
3. DBMS_SYN
4. DBMS_SQL
What are joins and Types of join?
Ans. We need retrive data from two or more tables to make our result complete. We need to
perform a join.
INNER JOIN
This join returns rows when there is at least one match in both the tables.
OUTER JOIN
There are three different Outer Join methods.
LEFT OUTER JOIN
This join returns all the rows from the left table with the matching rows from the right table. If
there are no field matching in the right table then it returns NULL values
RIGHT OUTER JOIN
Right outer join returns all the rows from the right table with the matching rows from the left
table. If there are no field matching in the left table then it returns NULL values
FULL OUTER JOIN
Full outer join merge left outer join and right outer join. this returns row from either table when
the conditions are met and returns null value when there is no match
CROSS JOIN
Corss join is does not necessary any condition to join. The output result contains records that are
multiplication of record from both the tables.
What is DIFFERENCE BETWEEN LEFT, RIGHT OUTER JOIN?
Ans:If there r any values in one table that do not have corresponding values in the other,in an
equi join that row will not be selected.Such rows can be forcefully selected by using outer join
symbol(+) on either of the sides(left or right) based on the requirement.
WHAT ARE SET OPERATORS?
Ans: UNION, INTERSECT or MINUS is called SET OPERATORS.
What are different datatypes supported by sql in oracle?
Ans: Char (size), Nchar (size), Varchar2 (size), Nvarchar2 (size) data types for character values,
Number (precision, scale), Number, Number (n), Float, Float (binary precision) data types for
numerical values, Date data type for date values, Long, Raw (size), Long Raw, Clob, Blob,
Nclob, Bfile for large objects.
What is difference between long and lob datatypes?
Ans:LOB
1) The maximum size is 4GB. 2) LOBs (except NCLOB) can be attributes of an object type. 3)
LOBs support random access to data. 4) Multiple LOB columns per table or LOB attributes in an
object type.
LONG
1) The maximum size is 2GB. 2) LONGs cannot. 3) LONGs support only sequential access. 4)
Only one LONG column was allowed in a table
How much memory is allocated for date datatype? What is default date format in oracle?
Ans: For Date data type oracle allocates 7 bytes Memory. Default Date Format is: DD-MONYY.
What is range for each datatype of sql?
Ans: Datatype Range Char Varchar2 Number Float LONG, RAW, LONGRAW Large
Objects (LOBs) 2000 bytes 4000 bytes Precision
1 to 38 Scale -84 to 127 Precision 38 decimals Or 122 binary precision 2 GB 4GB
What is a constraint? What are its various levels?
Ans: Constraint: Constraints are representators of the column to enforce data entity and
consistency.There r two levels
1)Column-level constraints 2)Table-level constraints.
List out all the constraints supported by oracle
Primary Key , Foreign Key or Referential Integrity, Not Null, Unique, Check.
Select 3 product which having highest sale price
SELECT * FROM ( SELECT * FROM product ORDER BY sales_price DESC) WHERE rownum
<= 3
Delete the records from product which having null description
delete from product where product_name is null
Display detail of product which having maximum sale
SELECT * FROM
( SELECT product_id, count(product_id)as cnt FROM sales group by product_id order by cnt
desc) WHERE rownum = 1
Select customer details and produtct details of cutomer imran
Select p.product_name, c.cutomer_name, p.sale_price from product p, cutomer c, sale s
where p.product_id=s.product_id and c.cutomer_id=s.ccustomer_id and
customer_name=imran
Difference between DELETE & TRUNCATE statement
Ans. Delete is a DML command. Truncate is a DDL command.
In Delete statement we can use where clause But we cant use where clause in truncate
statement.
Delete activates trigger. Truncate does not activate trigger.
We can rollback delete command. We can not rollback truncate command. Delete does not reset
identity of table. Truncate resets identity of table.
Difference between Primary key and Unique Key
Ans. Primary key and Unique key enforce uniqueness of the column on which they are defined.
But by default, the primary key creates a clustered index on the column, where as unique key
creates a non-clustered index by default. Another major difference is that primary key does not
allow NULL value, but unique key allows one NULL value only.
What are oracle number, character, date, conversion, other
functions.
Ans.
Oracle Number Functions
Round (m, [n]),
Trunc (m, [n]),
Power (m, n),
Sqrt,
Abs (m),
Ceil (m),
Floor (m),
Mod (m, n)Oracle Character FunctionsChr (x)
Concert (string1, string2)
Lower (string)
Upper (string)
Substr (string, from_str, to_str)
ASCII (string)
Length (string)
Initcap (string).Oracle Date Functionssysdate
Months between (d1, d2)
To_char (d, format)
Last day (d)
Next_day (d, day).
Oracle Conversion FunctionsTo_char
To_date
To_number
What is syntax of PL/SQL BLOCK
Ans. DECLARE
BEGIN
EXCEPTION
END;
What are different types of oracle PL/SQL BLOCKS?
Ans:
Oracle PL/SQL DECLARE BLOCK In DECLARE BLOCK all the declarations of the
variable used in the program is made. If no variables are used this block will become optional.
Oracle PL/SQL BEGIN BLOCK In BEGIN BLOCK all the executable statements are placed.
This block is Mandatory.
Oracle EXCEPTION BLOCK In EXCEPTION BLOCK all the exceptions are handled. this
block is optional.
what is a Oracle PL/SQL cursor? and how to create cursor syntax?
Ans: Cursor is Private SQL area in PL/SQL.
Declare the Cursor,
Open the Cursor,
Fetch values from SQL into the local Variables,
Close the Cursor.
Type of cursors are supported by oracle pl/sql?
Ans. There are two types of cursors namely Implicit Cursor, Explicit Cursor.
What is a cursor for loop?
Ans: Cursor For Loop is shortcut process for Explicit Cursors because the Cursor is Open, Rows
are fetched once for each iteration and the cursor is closed automatically when all the rows have
been processed.
What are cursor attributes?
Ans: %Found, %NotFound, %IsOpen, %RowCount are the cursor attributes.
Use of cursor with for update of clause?
Ans: This Clause stop accessing of other users on the particular columns used by the cursor until
the COMMIT is issued.
How Exception is different from error?
Ans: Whenever an error occurs Exception raises. Error is a bug whereas the Exception is a
warning or error condition.
Whats a PL/SQL table? Its purpose and Advantages?
one of these values it can retrieve it directly from the PL\SQL table in memory.
2 Global temporary tables act as performance enhancers when compared to standard
tables as they greatly reduce the disk IO.
3 They also offer the ease-of-use of standard tables, since standard SQL can be used with
them; no special array-processing syntax is required.
condition etc.)
Exception handlers are used to handle the exceptions that are raised. They prevent
exceptions from propagating out of the block and define actions to be performed when
exception is raised.
What are the two basic parameters that we have to pass while registering PL/SQL
procedure?
Error code and Error Buffer.
Items are imported from the legacy system using the item import interface using the
SRS. How are items imported using the UNIX /PLSQL commands with out using
SRS?
1.From the operating system, use CONCSUB to submit a concurrent program. Its an
easiest way to test a concurrent program.
Normally, CONCSUB submits a concurrent request and returns control to the OS
prompt/shell script without waiting for the request to complete. The CONCSUB WAIT
parameter can be used to make CONCSUB wait until the request has completed before
returning control to the OS prompt/shell script
By using the WAIT token, the utility checks the request status every 60 seconds and
returns to the operating system prompt upon completion of the request. concurrent
manager does not abort, shut down, or start up until the concurrent request completes. If
your concurrent program is compatible with itself, we can check it for data integrity and
deadlocks by submitting it many times so that it runs concurrently with itself.
Syntax: CONCSUB [WAIT= [START=] [REPEAT_DAYS=] [REPEAT_END=]
To pass null parameters to CONCSUB, use without spaces for each null parameter.
In words: single quote double quote double quote single quote
Following is an example of CONCSUB syntax with null parameters:
CONCSUB oe/oe OE Order Entry Super User JWALSH CONCURRENT XOE
XOEPACK 4 3 3
2. To Invoke a Concurrent Program using PL/SQL:
i) Just insert a row in FND_CONCURRENT_REQUESTS with the apropriate parameters
and commit.
ii) Invoke the SUBMIT_REQUEST procedure in FND_REQUEST package.
FND_REQUEST.SUBMIT_REQUEST( AR, RAXMTR, , , FALSE, Autoinvoice
Master Program, sc_time, FALSE, 1, 1020, VRP, 01-JAN-00, chr(0)
While registering a report and a pl/sql block we pass some parameters, for any
pl/sql block we pass 2 additional parameters. Can u list them?
It requires two IN parameters for a PL/SQL procedure thats registered as a concurrent
program in Apps. They are
1. Errcode IN VARCHAR2
2. Errbuff IN VARCHAR2
Invisible Column
Oracle 12c allows a column to be invisible. Invisible columns are considered only
when they are explicitly referred; otherwise they are ignored for queries and DML
operations.
You can make a column visible or invisible whenever you want using ALTER TABLE
command.
CREATE TABLE T2 ( C1
NUMBER(5),
C2 NUMBER(5) INVISIBLE)
C1
C2
---------- ---------10
20
30
ALTER TABLE T2 MODIFY (C2
SELECT
VISIBLE)
* FROM T2
t1
DESCRIPTION
-----------------------------DESCRIPTION
DESCRIPTION
The following example shows how to use NEXTVAL for master table and CURRVAL
for details or child table.
CREATE SEQUENCE order_master_seq;
CREATE SEQUENCE order_details_seq;
CREATE TABLE order_master (
Order_id
NUMBER DEFAULT order_master_seq.NEXTVAL,
Description VARCHAR2(20)
);
CREATE TABLE order_details (
id
NUMBER DEFAULT order_details_seq.NEXTVAL,
order_id
description
);
insert into order_master (description) values ('First Order');
insert into order_details (description) values ('First Item');
insert into order_details (description) values ('Second Item');
select * from order_master;
SQL> select * from order_master;
ORDER_ID DESCRIPTION
---------- -------------------1 First Order
select * from order_details;
SQL> select * from order_details;
ID
ORDER_ID DESCRIPTION
---------- ---------- -------------------------------------------------1
1 First Item
2
1 Second Item
DEFAULT ON NULL
If the column is referenced in INSERT, even when supplying the value NULL, the
default value is not used. Oracle 12c allows you to modify this behaviour using the
ON NULL clause in the default definition. When ON NULL is used, default value is
applied when NULL value is provided explicitly.
create sequence t1_seq;
CREATE TABLE t1 (
id
NUMBER DEFAULT ON NULL t1_seq.NEXTVAL,
description VARCHAR2(30)
);
insert into t1(description) values('First Item');
as value for ID is missing
insert into t1 values(null,'Second Item');
even when NULL is explicitly provided
insert into t1 values(333,'Third Item');
SQL> select * from t1;
ID
---------1
2
333
DESCRIPTION
-----------------------------First Item
Second Item
Third Item
Identity Columns
The 12c database introduces the ability to define an identity clause for a table
column defined using a numeric type.
GENERATED
[ALWAYS | BY DEFAULT [ ON NULL ] ]
AS IDENTITY [ (identity_options ) ]
Using ALWAYS forces the use of the identity. If an insert statement references the
identity column, even to specify a NULL value, an error is produced.
CREATE TABLE order_master (
Id NUMBER GENERATED ALWAYS AS IDENTITY,
Description Varchar2(20)
);
Insert into order_master (description) values('First Order');
Insert into order_master (description) values('Second Order');
SQL> select * from order_master;
ID
---------1
2
DESCRIPTION
-------------------First Order
Second Order
Using BY DEFAULT allows you to use the identity if the column isn't referenced in the
insert statement, but if the column is referenced, the specified value will be used in
place of the identity.
Attempting to specify the value NULL in this case results in an error, since identity
columns are always NOT NULL.
CREATE TABLE order_master(
Id NUMBER GENERATED BY DEFAULT AS IDENTITY,
Description Varchar2(20)
);
Insert into order_master (description) values('First Order');
Insert into order_master (id,description) values(20,'Second Order');
select * from order_master;
SQL> select * from order_master;
ID
---------1
20
DESCRIPTION
-------------------First Order
Second Order
Using BY DEFAULT ON NULL allows the identity to be used even when the identity
column is referenced and NULL value is specified.
CREATE TABLE order_master(
Id NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY ,
Description Varchar2(20)
);
Insert into order_master (id,description) values(null,'First Order');
Insert into order_master (id,description) values(20,'Second Order');
Insert into order_master (description) values('Third Order');
SQL> select * from order_master;
ID
---------1
20
2
DESCRIPTION
-------------------First Order
Second Order
Third Order
Note: Oracle uses a sequence internally to generate value to populate the identity
column.
Using RETURN_RESULT
Oracle 12c allows a procedure to return a list of rows by using RETURN_RESULT
procedure of DBMS_SQL package.
Rather than defining explicit ref cursor out parameters, the RETURN_RESULT
procedure in the DBMS_SQL package allows you to pass them out implicitly.
The following procedure returns list of rows from JOBS table as return value from a
procedure.
CREATE OR REPLACE PROCEDURE get_jobs
AS
job_cursor SYS_REFCURSOR;
BEGIN
OPEN job_cursor FOR
SELECT * from jobs;
DBMS_SQL.RETURN_RESULT(job_cursor);
END;
You can call the procedure and get the list of rows from the procedure as follows:
EXECUTE get_jobs
OFFSET provides a way to skip the N first rows in a result set before starting
to return any rows
The FETCH clause limits the number of rows returned in the result set
For the result offset clause, the value of the integer literal must be equal to 0
(default if the clause is not given), or positive. If it is larger than the number
of rows in the underlying result set, no rows are returned.
For the fetch first clause, the value of the literal must be 1 or higher. The
literal can be omitted, in which case it defaults to 1. If the clause is omitted
entirely, all rows (or those rows remaining if a result offset clause is also
given) will be returned.
//
//
//
select * from employees order by salary desc fetch next 5 rows only;
retrieves first 5 highest salaried employees
//
The maximum size of VARCHAR2, NVARCHAR2, and RAW data types has been
increased from 4,000 to 32,767 bytes. Increasing the allotted size for these
data types allows users to store more information in character data types
before switching to large objects (LOBs). This is especially useful for brief
textual data types and the capabilities to build indexes on these types of
columns.
Through Oracle Database 11g Release 2 (11.2), only definer's rights PL/SQL
functions could be result cached. Now, invoker's rights PL/SQL functions can
also be result cached.
Prior to Oracle 12c R1, undo records generated by the temporary tables used
to be stored in undo tablespace. However, with the temporary undo feature in
12c, the temporary undo records can now be stored in a temporary table
instead of undo tablespace.
from
table.
6. Select
LAST
n
records
from
a
table
select * from emp minus select * from emp where rownum <= (select count(*) - &n from
emp);
7. List dept no., Dept name for all the departments in which there are no employees in
the
department.
select * from dept where deptno not in (select deptno from emp);
alternate solution: select * from dept a where not exists (select * from emp b where
a.deptno
=
b.deptno);
altertnate solution: select empno,ename,b.deptno,dname from emp a, dept b where
a.deptno(+) = b.deptno and empno is null;
8. How
to
get
3
Max
salaries
?
select distinct sal from emp a where 3 >= (select count(distinct sal) from emp b where
a.sal <= b.sal) order by a.sal desc;
9. How
to
get
3
Min
salaries
?
select distinct sal from emp a where 3 >= (select count(distinct sal) from emp b where
a.sal >= b.sal);
10. How
to
get
nth
max
salaries
?
select distinct hiredate from emp a where &n = (select count(distinct sal) from emp b
where a.sal >= b.sal);
11. Select
DISTINCT
RECORDS
from
emp
table.
select * from emp a where rowid = (select max(rowid) from emp b where
a.empno=b.empno);
12. How
to
delete
duplicate
rows
in
a
table?
delete from emp a where rowid != (select max(rowid) from emp b where
a.empno=b.empno);
13. Count
of
number
of
employees
in
select count(EMPNO), b.deptno, dname from emp
a.deptno(+)=b.deptno group by b.deptno,dname;
department
a, dept b
wise.
where
14. Suppose there is annual salary information provided by emp table. How to fetch
monthly salary of each and every employee?
select ename,sal/12 as monthlysal from emp;
15. Select all record from emp table where deptno =10 or 40.
select * from emp where deptno=30 or deptno=10;
16. Select all record from emp table where deptno=30 and sal>1500.
between
1000
to
2000?
28. Select all records where dept no of both emp and dept table matches.
select * from emp where exists(select * from dept where emp.deptno=dept.deptno)
29. If there are two tables emp1 and emp2, and both have common record. How can I
fetch
all
the
recods
but
common
records
only
once?
(Select * from emp) Union (Select * from emp1)
30. How to fetch only common records from two tables emp and emp1?
(Select * from emp) Intersect (Select * from emp1)
31. How can I retrive all records of emp1 those should not present in emp2?
(Select * from emp) Minus (Select * from emp1)
32. Count the totalsa deptno
SELECT
deptno,
FROM
GROUP
HAVING COUNT(empno) > 2
wise
where more
sum(sal)
BY
than
2 employees exist.
As
totalsal
emp
deptno