0

What am I doing wrong on this query sql Joining Table exercise?

Having trouble executing this query can anyone help? Thanks! select Students.ID, Students.Firstname, Students.Lastname, Teachers.Lastname, as teacher from students, teachers where Students.TeacherID=Teachers.ID order by students.id

12th Sep 2022, 4:41 AM
Rafael
5 Antworten
+ 5
Tibor Santa In mysql the name of the tables can be case sensitive, it depends on the os used. Either way, once a syntax is used to call a table or column, the same must be used thereafter. https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html
12th Sep 2022, 11:04 AM
Roland
Roland - avatar
+ 4
Roland thanks, I learned something new about MySQL :) I was not aware that you cannot use the same identifier twice in the same statement with different casing... But this seems to be a particular quirk of MySQL itself. https://stackoverflow.com/questions/153944/is-sql-syntax-case-sensitive
12th Sep 2022, 4:33 PM
Tibor Santa
Tibor Santa - avatar
+ 3
Roland SQL is not case sensitive :) But you are correct about the comma before "as" is not needed
12th Sep 2022, 8:34 AM
Tibor Santa
Tibor Santa - avatar
+ 3
I don't see you use JOIN anywhere ...
12th Sep 2022, 10:52 AM
Ipang
+ 1
The table and column are case sensitive. Be carefull to uppercase and lowercase. There is no comma before AS Key in the select
12th Sep 2022, 5:26 AM
Roland
Roland - avatar