SQL doesn't care about relationships on SELECTs. Only on INSERTs. It's called referential integrity. A student_class can't reference a student_id that doesn't exist, so it won't let you insert a...
Type: Posts; User: smoseley
SQL doesn't care about relationships on SELECTs. Only on INSERTs. It's called referential integrity. A student_class can't reference a student_id that doesn't exist, so it won't let you insert a...
Also, if you want to return a record from one table even if there are no records in the related table, consider using LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
LEFT returns records from the...
Well that's the standard that I've always used... it is generally accepted as the way to go.
Also, regarding:
INNER JOIN students AS s ON classes.id = sc.student_id
I meant to say:
INNER...
SQL is not an intuitive language. It will not allow you to select from a table unless you specify it in your FROM list.
Additionally, your database is not relational. Relational implies an...