Quiz 4 DB Solution
Quiz 4 DB Solution
DepartmentID DepartmentName
102 Finance
103 IT
104 Marketing
NULL NULL IT
NULL NULL IT
4. Natural Join
A natural join automatically joins tables based on columns with the same name and data type in both tables.
SQL Query:
SELECT Employees.EmployeeID, Employees.EmployeeName, Departments.DepartmentName
FROM Employees
NATURAL JOIN Departments;
Result:
EXAMPLE -2
Table 1: Customers
Table 2: Orders
101 1 250
102 1 300
103 3 150
104 2 400
4. Natural Join
A natural join automatically joins tables based on columns with the same name and data type in both tables.
SQL Query:
SELECT Customers.CustomerID, Customers.CustomerName, Orders.OrderAmount
FROM Customers
NATURAL JOIN Orders;
Result: