I'm trying to get a complete understanding of how WordPress works with databases. I've read the documentation but I'm getting confused by all the different approaches available. So far my understanding is this (layered by level of abstraction from the database):
=========================
"WP_API" (for REST/HTTP data access)
=========================
"get/add/update/delete" functions (e.g., get_post_meta())
=========================
"WP_Query" class (access data without writing SQL)
=========================
"$wpdb" object (access data by writing direct SQL)
=========================
"MySQL" database (persistence storage)
Is this ordered correctly? Am I missing anything, what else is there? It seems to me any direct SQL query can be executed with $wpdb. Then there's an abstraction WP_Query on top of $wpdb for people who don't want to write SQL. Then yet again there's another abstraction on top of WP_Query for people who want to use simple functions. And finally there's the new WP REST API which can do it all and more.
I could just use $wpdb (or WP_API) for everything can't I? Why bother with WP_Query or the get/add/update/delete functions? Doesn't that just add more unnecessary bloat/complexity?