Asych 1 Database

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Lord Jervy Thomson Q. Leopoldo Mr.

John Carlo Campit


Information Systems Management Intro to Database Systems

1. What is SQL Join?

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).

3. What is SQL Subquery?


A Subquery or Inner query or Nested query is a query within another SQL query and
embedded within the WHERE clause. A subquery is used to return data that will be used
in the main query as a condition to further restrict the data to be retrieved. Subqueries
can be used with the SELECT, INSERT, UPDATE, and DELETE statements along with the
operators like =, <, >, >=, <=, IN, BETWEEN etc.

You might also like