Answer the question
In order to leave comments, you need to log in
How are requests different?
Suppose there is a table `album` with fields: `album_id`, `album_name`
The second table `song` with the fields `song_id`, `song_name`
The third table `song_album` with foreign keys contains the fields `album_id` and `song_id` of two tables. One-to-many normalization.
But what is the difference between requests (I saw this example on some site), let's say I get a list of songs for albums:
SELECT `song`.`song_id`, `song`.`song_name` FROM `album`, `song_album ` WHERE `song_album`.`album_id` = '$id' AND `song`.`song_id` = `song_album`.`song_id`;
But the same could be done using Join.
And so it works as it should. So what's the difference and which is better?
Answer the question
In order to leave comments, you need to log in
SELECT `song`.`song_id`, `song`.`song_name` FROM `album`, `song_album` WHERE `song_album`.`album_id` = '$id' AND `song`.`song_id` = `song_album`. `song_id`;
this request is not correct.
the song table is used but the song was not mentioned in FROM
but even if it is mentioned then with a large amount of data the query will work for a long time it is
better to use join
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question