Join query, PL-SQL Programming

Using a join on 3 tables, select 5 columns and 10 rows from the 3 tables without the use of a Cartesian product

Query:

SELECT E.LAST_NAME, E.FIRST_NAME, S.BUILDING, S.BRANCH, C.COMPANY FROM EMPLOYEE1 E JOIN STAFF S ON E.EMP_ID=S.EMP_ID JOIN CONTRACT C ON C.EMP_ID=S.EMP_ID WHERE ROWNUM<6;

Select distinct rows using joins on 3 tables without the use of a Cartesian product.

Query:

SELECT DISTINCT E.LAST_NAME,E.FIRST_NAME,S.BUILDING,S.BRANCH,C.COMPANY FROM EMPLOYEE1 E JOIN STAFF S ON E.EMP_ID=S.EMP_ID JOIN CONTRACT C ON C.EMP_ID=S.EMP_ID;

 

Posted Date: 3/14/2013 2:02:13 AM | Location : United States







Related Discussions:- Join query, Assignment Help, Ask Question on Join query, Get Answer, Expert's Help, Join query Discussions

Write discussion on Join query
Your posts are moderated
Related Questions
The SQL ‘CREATE TABLE' scripts for all the tables you have implemented. Note that your tables must correspond exactly to the ERD you have provided in 1. above, or you will lose ma

Complete the following steps to create a procedure to calculate the tax on an order. The BB_TAX table contains the states that require taxes to be submitted for Internet sales. If

THEO R Y OF PANSPERMIA - Arrhenius (1908) postulated the cosmic panspermia theory that claims that organisms existed throughout the universe, and their spores, etc., could

Assignment of Variable - Updating a Variable Syntax: SET SN = SID ('S2'); This can obviously be read as "set the variable SN to be equal in value to SID ( 'S2' )".

Bulk Fetching The illustration below shows that you can bulk-fetch from a cursor into one or more collections: DECLARE TYPE NameTab IS TABLE OF emp.ename%TYPE; TYPE S

Understanding Nested Tables Within the database, the nested tables can be considered as one-column database tables. The Oracle stores the rows of a nested table in no specific o

Wrapping and unwrapping in SQL Operators WRAP and UNWRAP in connection with attributes whose declared types are tuple types. Example shows how extension and projection can be

Declaring and Initializing Objects: An object type is once defined and installed in the schema; you can use it to declare the objects in any PL/SQL, subprogram, block or packa

Using the student and faculty tables create a select query that outputs all students for a specific advisor. Generate the execution plan, select out the explain plan . Create an

Declarations in SQL Your program stores values in the variables and constants. As the program executes, the value of the variables can change, but the values constants cannot.