Sybase Joins

Sybase Joins: Joins are used to retrieve data from two or more tables.

Rules:

  • The joining tables must have common columns. Which means column should be similar datatypes.
  • We can embed a join in a select, insert, update, delete or subquery.
  • There are several types of joins, such as equijoins, natural joins, and outer
    joins.

Joins Syntax:

start of select, insert, update, delete or subquery
from [table_list | view_list]
where
[table_name. | view_name.]column_name join_operators
[table_name. | view_name.]column_name
[{and | or} [not]
[table_name.|view_name.]column_name join_operator
[table_name.|view_name.]column_name]…
End of select, insert, update, delete or subquery

Example:

select au_fname, au_lname, pub_name
from authors a, publishers p
where p.city = p.city

Output:

au_fname au_lname pub_name ----------- ---------------------- ----------- Abraham Bennet New Age Books Reginald Blotchet-Halls New Age Books Cheryl Carson New Age Books Michel DeFrance New Age Books Ann Dull New Age Books Marjorie Green New Age Books Morningstar Greene New Age Books Burt Gringlesby New Age Books Sheryl Hunter New Age Books

Powered by k2schools