Προσπαθώ να καταλάβω τα JOIN και δοκίμασα τα παραδείγματα και τους κώδικες που δίνονται στις σημειώσεις και δεν δουλεύουν.
mysql> select*from employees;
+------------+------------+------------+
| EmployeeID | Name | Department |
+------------+------------+------------+
| 1 | John Smith | 1 |
| 2 | John Doe | 3 |
| 3 | John Doe | 4 |
+------------+------------+------------+
3 rows in set (0.02 sec)
mysql> select*from departments;
+--------+------------------+
| DeptID | DeptName |
+--------+------------------+
| 1 | Sales |
| 2 | Research |
| 3 | Customer Service |
+--------+------------------+
3 rows in set (0.02 sec)
mysql> SELECT Employees.Name Departments.DeptName FROM Employees LEFT JOIN Departments
-> ON Employees.Department=Departments.DeptID;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.DeptName FROM Employees LEFT JOIN Departments
ON Employees.Department=Depar' at line 1
και στο inner join που δίνεται παρόμοιο πρόβλημα
mysql> select*from employees;
+------------+------------+------------+
| EmployeeID | Name | Department |
+------------+------------+------------+
| 1 | John Smith | 1 |
| 2 | John Doe | 3 |
| 3 | John Doe | 4 |
+------------+------------+------------+
3 rows in set (0.02 sec)
mysql> select*from departments;
+--------+------------------+
| DeptID | DeptName |
+--------+------------------+
| 1 | Sales |
| 2 | Research |
| 3 | Customer Service |
+--------+------------------+
3 rows in set (0.02 sec)
mysql> SELECT Employees.Name Departments.DeptName FROM Employees LEFT JOIN Departments
-> ON Employees.Department=Departments.DeptID;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.DeptName FROM Employees LEFT JOIN Departments
ON Employees.Department=Depar' at line 1
και στο inner join που δίνεται παρόμοιο πρόβλημα