iSelfSchooling.com - Copyright © 1999-2009 iSelfSchooling.com ||  References  |  Job Openings
    Home  | Search more...  |  FREE Online VIDEO Oracle Training 

   Unlimited access!   

    Oracle  Syntax  | Suggestions

Copyright & User Agreement

Email2aFriend  | Homepage us! |  Bookmark

Products/Services

 Vision/Mission

 Community Sharing

 Services

  Products

 Biography

 Contact Us

 FAQ

 Current News

 Website Traffic

 FREE Training

 SQL

 PL/SQL

 Forms 

 Reports

 Other TOOLS

 Fundamentals

 Performance

 OEM

 Application Server

 Grid Control

 Articles

 Prepare for OCP

Oracle SYNTAX

 Oracle Functions

 Oracle Syntax

 Oracle 10g Syntax

  PL/SQL Syntax

UNIX and more...

 UNIX for DBAs

 LINUX for DBAs

 DB using PHP

  A+ Certification

 Basics of JAVA  

 Tips of  SEO

Finance/Jobs

 Financial Aid

 Skilled

 Oracle

 Jobs

  Magazine

More Training

 Q & Answers

 SQL-PL/SQL

 DBA

 Developer

 Important Notes

 Case Studies

 9i New Features

 10g New Features

 10g Qs/As

 Grid Control

 OracleAS # I

 OracleAS # II

  LDAP and OID

  HTTP Server

 Instructor-Led

  Virtual Hosts

 Community Sharing

More to know...

Acknowledgement**

 FREE Legal Forms

 Who is who

 Market Place

 University Directory

 Advisory Articles

 Links...

 

 

Topics:  Hands-On 03

Your organization, has another table that contains employee data for the accounting department only. You have been assigned to check the contents of the accounting table with the base EMP table.

 

More Resources by Google:

Manuscript

-- Hands-On 03 (Troubleshooting) 

SET ECHO ON
CLEAR SCR
-- Connect to SQLPLUS as the iself user.
-- 
pause

CONNECT iself/schooling
pause

CLEAR SCR
-- Set the linesize to 100 and the pagesize to 55.
--
pause

SET LINESIZE 100 PAGESIZE 55
pause

CLEAR SCR
-- Create a table named accounting and 
-- copy all of the accounting employees into it.
pause

CREATE TABLE accounting
AS (SELECT * FROM emp 
WHERE deptno = 10)
/
pause

CLEAR SCR
-- Query the accounting table.
--
pause

SELECT * FROM accounting
/
pause

CLEAR SCR
-- Now, insert a new record into the accounting table.
--
pause

INSERT INTO accounting VALUES 
(9000,'Dana','Kazerooni',7782,'04-Apr-02',1500,null,10)
/
COMMIT;
pause


CLEAR SCR
-- Insert a new record into the EMP table.
--
pause

INSERT INTO EMP VALUES 
(9999,'Borna','Kazerooni',7782,'04-Apr-02',1500,null,10)
/
COMMIT;
pause

CLEAR SCR
-- Query the accounting table again.
--
pause

SELECT * FROM accounting
/
-- Note the employee that was added to accounting table.
pause

CLEAR SCR 
-- Query the accounting employees from the EMP table.
--
pause

SELECT * FROM emp
WHERE deptno = 10
/
-- Note! 
-- The employee record was added to the EMP table.
--
pause

CLEAR SCR
-- Find all of the records from the EMP table 
-- in the accounting department, that are not in 
-- the accounting table.
--
pause

SELECT * FROM emp 
WHERE deptno = 10 
MINUS SELECT * FROM accounting
/
-- Notice that this is the record that you added into
-- the EMP table.
--
pause

CLEAR SCR
-- Search and list for all of the records that 
-- are common in both tables.
--
pause

SELECT * FROM emp
WHERE deptno = 10
INTERSECT SELECT * FROM accounting
/
-- Notice the common records
pause

CLEAR SCR
-- Merge the two tables so that you can query all 
-- of the records with no duplicated records.
--
pause


SELECT * FROM accounting
UNION ALL SELECT * FROM emp WHERE deptno = 10
AND empno NOT IN (SELECT empno FROM accounting)
/
pause

CLEAR SCR
-- Now, drop the accounting table.
--
pause

DROP TABLE accounting
/
pause

CLEAR SCR
-- Delete the record which was added to the EMP table.
--
pause

DELETE FROM emp
WHERE empno = 9999
/
COMMIT;
pause

CLEAR SCR
-- Now, you should practice this Hands-On over and over
-- until you become a master at it.

-- For more information about the subject, you are encouraged
-- to read from a wide selection of available books.

-- Good luck!
pause

 

 
 
Google
 
Web web site