@TomB After reading through your book(PHP mysql 6th edition which you co-authored with teacher Kevin Yank). You talked about using ORM instead of using JOIN. In the book, all the examples are based on 2 tables. How can I use ORM to join 3 tables and above.This is a rough sketch. Relational Database, you do this in joining 3 tables together.
SELECT user.id, name, email.id, mail.user_id, email, sport, sport.user_id FROM user LEFT JOIN mail ON email.user_id = user.id LEFT JOIN sport.user_id = user.id`
As with everything it depends on a lot of factors, however an ORM will reduce the need to repeatedly write code to write queries. It also allows you to decouple your application from the database, the ORM could be using a CSV or JSON file behind the scenes instead of a database.
If you’re using an ORM in a project, you’re probably better off being consistent and using it throughout. If you are building on top of an existing project which has queries everywhere, you’re probably better off not introducing an ORM (or the next person to look at the code will be frustrated).