Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7500625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:14:44+00:00 2026-05-29T20:14:44+00:00

I was practising with an example that I was creating like the one below

  • 0

I was practising with an example that I was creating like the one below (where I was thinking about a movie being able to belong to many categories and a category being able to belong to have many subcategories).

Not sure if chaining two many-to-many relationships is correct (I split them up in several one to many relationships), but when I’m making a query I’m getting pretty weird results.

Any clue how could I get movie title and genre name for all movies, even the ones without genre name? I’m using a query similar to this but it’s not returning those titles :S

If I stop after the 1st many-to-many relationship, the results seem correct but once I add the 2nd relationship (with the query below), I don’t receive anything… any suggestion pls?

SELECT movie.title, genre.name 
FROM movie 
LEFT OUTER JOIN movie_genre 
ON (movie.movie_id = movie_genre.movie_id) 
JOIN genre 
ON (genre.genre_id = movie_genre.genre_id) 
JOIN genre_subgenre 
ON (genre_subgenre.genre_id = genre.genre_id) 
JOIN subgenre 
ON (subgenre.subgenre_id = genre_subgenre.subgenre_id) 



+++++++++++++++++ 
+ Movie ID (PK) + 
+ Movie Title + 
+++++++++++++++++ 
| 
| 
| 
+++++++++++++++++ 
+ Movie ID (FK) + 
+ Genre ID (FK) + 
+++++++++++++++++ 
| 
| 
| 
+++++++++++++++++++ 
+ Genre ID (PK) + 
+ Genre Name + 
+++++++++++++++++++ 
| 
| 
| 
++++++++++++++++++++ 
+ Genre ID (FK) + 
+ Subgenre ID (FK) + 
++++++++++++++++++++ 
| 
| 
| 
+++++++++++++++++++++++++ 
+ Subrenre ID (PK) + 
+ Subgenre Name (FK) + 
+++++++++++++++++++++++++
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:14:46+00:00Added an answer on May 29, 2026 at 8:14 pm

    Let me propose sample data to see if I get it right:

    • Movies: “Saw”, “Twilight”, “Platoon”
    • Genre: “Thriller”, “Comedy”, “Action”
    • Subgenre: “Hollywood”, “French”, “Italian”

    If this picture is correct then your design may be wrong as there is no relationship between Movie and Subgenre. That told, try this

    SELECT movie.title, genre.name 
    FROM movie 
    LEFT OUTER JOIN movie_genre 
    ON (movie.movie_id = movie_genre.movie_id) 
    JOIN genre 
    ON (genre.genre_id = movie_genre.genre_id) 
    LEFT OUTER JOIN genre_subgenre 
    ON (genre_subgenre.genre_id = genre.genre_id) 
    LEFT OUTER JOIN subgenre 
    ON (subgenre.subgenre_id = genre_subgenre.subgenre_id) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm practising making a form and I would like to position the form elements
I was just practicing some coding and noticed that I was able to use
I am practising c# with a phonebook example using Hashtable. I have a class
Hi everyone for the past 6 months I have been practising on creating websites
I am looking for a line of code that can show how many replies
Good day! I'm practising materials from Ruby on Rails Tutorial by Michael Hartle. Below
I'm practising on threading and came across this problem. The situation is like this:
I'm practising with C, writing simple programs. The little program below should just get
While practicing a tutorial on GTK+ I have encountered sample code that looks like
I've been playing around with Haskell a fair bit, including practising writing functions in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.