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
Transactions in SQL BEGIN TRANSACTION, COMMIT, and ROLLBACK, SQL has the same syntax except for START in place of BEGIN. However, START TRANSACTION is used only for outermost

Case Sensitivity Similar to all the identifiers, the variables, the names of constants, and parameters are not case sensitive. For illustration, PL/SQL considers the following n

CURRVAL and NEXTVAL The series is a schema object which generates the sequential numbers. Whenever you form a sequence, you can specify its primary value and an increment. T

Procedures   The procedure is a subprogram which performs a specific action. You write procedures using the syntax as shown below: PROCEDURE name [(parameter[, parameter, .

Effects of NULL Operator As a general rule-but not a universal one-if NULL is an argument to an invocation of a system-defined read-only operator, then NULL is the result of t

Positional and Named Notation You can write the actual parameters when calling a subprogram, using either positional or named notation. That is, you can point to the relationsh

Aggregate Operators SQL Supports all of the aggregate operators mentioned in the theory book and many more besides. The syntax, however, involves an unusual trick that SQL cal

At times, Brewbean's has changed the id number for existing products. In the past, they have had to add a new product row with the new id to the BB_PRODUCT table, modify all the co

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

Block Structure The PL/SQL is a block-structured language. That is, the fundamental units (procedures, anonymous blocks, and functions) that make up a PL/SQL program are logi