I'm new to mysql and I'm learning join queries now. when I compare strings I got weird output that mentioned below. I have two tables
MariaDB [test]> select * from classroom;
+---------+-----------+
| subject | classroom |
+---------+-----------+
| maths | 1 |
| englishs| 2 |
+---------+-----------+
Table student:
MariaDB [test]> select * from student;
+------+------+---------+
| id | name | subject |
+------+------+---------+
| 1 | abc | maths |
| 2 | abcd | english |
+------+------+---------+
I have tried this query
select b.classroom,a.name,b.subject from student a left join classroom b
on a.subject = b.subject ;
and the output is like,
+-----------+------+---------+
| classroom | name | subject |
+-----------+------+---------+
| 1 | abc | maths |
| NULL | abcd | NULL |
+-----------+------+---------+
I don't understand why am getting second row if the strings are doesn't match in both tables.