Beruflich Dokumente
Kultur Dokumente
TABLE: DEPARTMENT
Notice that the "Dept_no" column in the "employee" table points to the "Dept_no"
column in the "Department" table.
The "Dept_no" column in the " Department" table is the PRIMARY KEY in the
"Department " table.
The "Dept_no" column in the "employee" table is a FOREIGN KEY in the
" employee" table.
The FOREIGN KEY constraint is used to prevent actions that would destroy links
between tables.
The FOREIGN KEY constraint also prevents invalid data from being inserted into
the foreign key column, because it has to be one of the values contained in the
table it points to.
Question 2 - How many joins are there? Explain each with an example.
SELECT column_name
FROM table1
INNER JOIN table2 ON table1.column_name = table2.column_name;
SQL INNER JOIN Example
3. RIGHT (OUTER) JOIN: Return all records from the right table, and the
matched records from the left table.
SQL RIGHT JOIN Example
SELECT Department.Dept_name, Employee.Name, Employee.Empsal
FROM Department
RIGHT JOIN Employee ON Orders.Dept_no= Employee.Dept_no
ORDER BY Department.Dept_name;