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
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

UPDATE Statement   The UPDATE statement transforms the values of the specified columns in one or more rows in the table or view. Syntax:

Datatypes Every constant and variable has a datatype that specifies the storage format, constraints, and the valid range of values. The PL/SQL gives a variety of predefined dat

Keyword and Parameter Description: label_name: This is an undeclared identifier which optionally labels the PL/SQL block. When used, label_name should be enclosed by the do

At times, customers make mistakes in submitting their orders and call to cancel the order. Brewbean’s wants to create a trigger that automatically updates the stock level of all pr

Explicit Cursor Attributes The cursor variable or each cursor has four attributes: %FOUND, %ISOPEN, %ROWCOUNT, and %NOTFOUND. When appended to the cursor or cursor variable, th

Map and Order Methods: The values of the scalar datatype like CHAR or REAL have a predefined order that allows them to be compared. While, the instances of an object type has

SQL Operators The PL/SQL uses all the SQL set, comparison, and row operators in the SQL statements. This part briefly describes some of these operators.  1. Comparison Opera

Table Represents an Extension - SQL It describes how each tuple in a relation represents a true instantiation of some predicate and each true instantiation is represented by s

Enrolment was split - SQL Example shows how relvars IS_CALLED and IS_ENROLLED_ON can be derived from the original ENROLMENT relvar, using projection in the initial assignment