sql - in MySQL can I compare id FK with varchar in another table -
i have table courseid, studentname , other table courseid , coursename user search course name in student table based on student name sql syntax should use ? join or inner join
if use join
, specify constraint (e.g. on a.courseid = b.courseid
) same if use inner join
, according table structure should like:
select * studenttable inner join coursetable on studenttable.courseid = coursetable.courseid studenttable.studentname = 'jack black';
in mysql write
select * studenttable, coursetable studenttable.courseid = coursetable.courseid , studentname = 'jack black';
as internally queried in same way.
check out exact syntax joins here: http://dev.mysql.com/doc/refman/5.7/en/join.html
Comments
Post a Comment