I have an SQL database of textbooks that I need help with. The database has the following tables:
I need help with queries that would allow me to do things like:
find out the top 10 most used biology books;
how many schools are using a certain book;
The top 10 books in use
The structure of this database looks like this:
One to Many Relationships
state_province ==> university ==> department
Each department is affiliated with a university.
Each university is affiliated with a state_province.
Many to Many Relationships
course <==> textbook
course <==> department
Each course has one or more textbooks while each textbook is in one or more courses.
Each course is taught at one or more departments while each department has one or more courses.
All the relationships are maintained by the id field of each entity.
For example, there are 381 different biology courses in the course table if you search title by '%biology%'. And then you can find thousands of biology books. For any of them, to find the number of universities that are using it, you need a query that's concerning 6 tables:
Which eventually lead to the university table. I need someone who can write such a query.
Data Processing, MySQL