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
LONG and LONG RAW You use the LONG datatype to store the variable-length character strings. The LONG datatype is such as the VARCHAR2 datatype, except that the maximum length o

Cursor Attributes   The Cursors and cursor variables have 4 attributes which give you helpful information about the execution of a data manipulation statement. Syntax:

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

Query: SELECT * FROM EMPLOYEE1; Select 5 columns and all rows from one table Query: SELECT C_ID, COMPANY, BUILDING, DEPARTMENT, BRANCH FROM CONTRACT;

Data Types in SQL - XML, Array, Row BINARY LARGE OBJECT for arbitrarily large bit strings. XML for XML documents and fragments. ARRAY types for arrays.

SQL outer join SELECT * FROM IS_CALLED NATURAL LEFT JOIN IS_ENROLLED_ON Note that adding LEFT to an invocation of CROSS JOIN has no effect unless the right-hand operand

Collections:   The collection is an ordered group of elements, all of similar type (for illustration, the grades for a class of students). Each element has an exclusive subsc

Need Windows and Linux system Administrator We are seeking a part time system administrator to take care of our servers. Your things to do would add, but not limited to: -

Selecting Objects: Suppose that you have run the SQL*Plus script below that creates object type Person and object table persons, and that you have settled the table: CREATE

Updating by replacement Syntax: UPDATE ENROLMENT SET Name = 'Ann' WHERE StudentId = SID ('S1'); Note the use of SET, as already noted in connection with direct a