Asych 1 Database
Asych 1 Database
Asych 1 Database
The relational model permits you to bring data from separate tables into relationships
new and unanticipated. Relationships become explicit when data is manipulated: when
you query the database, not when you create it. When data from more than one table
in the database is required, a join condition is used. Rows in one table can be joined to
rows in another table according to common values existing in corresponding columns,
that is, usually primary and foreign key columns. When data from more than one table
in the database is required, a join condition is used. Rows in one table can be joined to
rows in another table according to common values existing in corresponding columns,
that is, usually primary and foreign key columns.
2. What are the types of SQL Joins? Describe and give the syntax for each
type.
Inner Join - Inner join produces only the set of records that match in both Table A and
Table B. Most commonly used, best-understood join.
Syntax:
Left Outer Join- Left outer join produces a complete set of records from Table A, with
the matching records (where available) in Table B. If there is no match, the right side
will contain null.
Syntax:
Right outer join- produces a complete set of records from Table B, with the matching
records (where available) in Table A. If there is no match, the left side will contain null.
Syntax:
Full outer join - produces the set of all records in Table A and Table B, with matching
records from both sides where available. If there is no match, the missing side will
contain null.
Syntax:
Left Join Excluding Inner Join- This query will return all of the records in the left table
(table A) that do not match any records in the right table (table B).
Right Join Excluding Inner Join- This query will return all of the records in the right
table (table B) that do not match any records in the left table (table A).