Joining in sql, PL-SQL Programming

Joining in SQL

Joining IS_CALLED and IS_ENROLLED_ON in SQL

SELECT * FROM IS_CALLED NATURAL JOIN IS_ENROLLED_ON

This is an example of an SQL table expression. I have been assuming you are already familiar with the SELECT-FROM-WHERE structure for certain table expressions. Here an explanation in a different style from that found in the SQL text books, appealing to the concept of operator invocation.

384_Joining in SQL.png

Explanation

  • Example is an invocation of the SQL operator SELECT and for that reason I shall refer to such table expressions as SELECT expressions.
  • Here the SELECT operator operates on the table denoted by the table expression FROM IS_ CALLED NATURAL JOIN IS_ENROLLED_ON, an invocation of the operator FROM. I shall call such table expressions FROM expressions.
  • The FROM operator here is operating on the table denoted by the table expression IS_CALLED NATURAL JOIN IS_ENROLLED_ON, an invocation of the operator NATURAL JOIN.
  •  NATURAL JOIN here is operating on the tables denoted by the table expressions IS_CALLED and IS_ENROLLED_ON, each in turn denoting the table that is the current value of the variable (base table) of that name.
  • NATURAL JOIN is almost equivalent to Tutorial D's JOIN. It differs only in being noncommutative because of the ordering to the columns of an SQL table. The common columns appear first in the result, in the order in which they appear in the left operand. Then come the remaining columns of the left operand, followed by the remaining columns of the right operand. As in Tutorial D, common columns must be of the same type in both operands.
  • FROM is an operator that takes a commalist of one or more table expressions. In this example the list has just one element, IS_CALLED NATURAL JOIN IS_ENROLLED_ON, and the result is that table. An invocation of FROM is usually referred to as a FROM clause. A FROM clause is not permitted to exist in isolation-it must appear in some containing SELECT expression. Similarly, some table expressions are permitted only when they appear as elements of a FROM clause. Simple table names and invocations of NATURAL JOIN are a case in point. The result of a FROM clause must always be operated on by some other clause. In Example it is operated on by a SELECT clause. It can also be operated on by any clause that immediately follows it syntactically, such as a WHERE clause, for example. As we shall see, SQL dictates a strict order in which the clauses of a SELECT expression must appear. Evaluation always starts at the FROM clause, then proceeds forwards from clause to clause, then finally back to the SELECT clause.
Posted Date: 1/18/2013 4:33:31 AM | Location : United States







Related Discussions:- Joining in sql, Assignment Help, Ask Question on Joining in sql, Get Answer, Expert's Help, Joining in sql Discussions

Write discussion on Joining in sql
Your posts are moderated
Related Questions
Example of UNWRAP Operator - SQL Example here shows how unwrapping can be done in longhand in SQL. Example: Unwrapping in SQL Letting CONTACT_INFO_WRAPPED denote the res

Cause of Indeterminacy in SQL One root cause of indeterminacy in SQL lies in its implementation of comparison for equality. For certain system-defined types it is possible for

Object Types An object type is a user-defined complex datatype which encapsulates the data structure along with the functions and procedures required to manipulate the data. Th

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

Using raise_application_error The Package DBMS_STANDARD that is supplied with Oracle gives language facilities that help your application to interact with Oracle. For illustra

Using FORALL and BULK COLLECT Together You can unite the BULK COLLECT clause with the FORALL statement, in that case, the SQL engine bulk-binds column values incrementally. In

V ariables and Constants in PL/SQL The PL/SQL permits you to declare constants and variables, and then use them in SQL and procedural statements anywhere in the expression. Th

Keys in SQL SQL support for keys in the following respects: SQL does not require at least one key for every base table. If no key is explicitly declared, then KEY {ALL B

PITS Depressions in secondary cell wall is called pit. A pit present on the free cell wall surface without its partner is called Blind pit. It consists of 2 parts -

Assignment Statement: The assignment statement sets the present value of the variable, parameter, field, or element. The statement consists of an assignment target followed by