I have 2 sample tables here:
MariaDB [Test_delete_query]> select * from tbl1;
+----+--------------+
| id | student_name |
+----+--------------+
| 1 | Tom |
| 2 | Emily |
+----+--------------+
2 rows in set (0.00 sec)
MariaDB [Test_delete_query]> select * from tbl2;
+----+------------+-------------+
| id | student_id | course_name |
+----+------------+-------------+
| 1 | 1 | Mathematic |
| 2 | 1 | History |
+----+------------+-------------+
2 rows in set (0.00 sec)
It is possible to delete Tom with his courses using the following SQL query:
delete tbl1.*, tbl2.* from tbl1 join tbl2 on ( tbl1.id = tbl2.student_id ) where tbl1.id = 1;
But as @mukesh-dhisale said you should set relationship with cascade delete between the two tables so when you delete the primary record its children will be deleted automatically from other tables. @marc-b thought us how to setup our tables to do so here.