Skip to content

Linking on names rather than ids #10

Closed
@ZooeyMiller

Description

@ZooeyMiller

in the seconds exercise you have to link the tables together like this:

SELECT mentors.name, count (post_num) FROM mentors
INNER JOIN posts
ON mentors.name = posts.mentor_name
INNER JOIN likes
ON posts.num = likes.post_num
GROUP BY mentors.name;

We are joining on names, and then on post_num.
Yesterday in our research we were led to believe that we should INNER JOIN on the IDs, not the names as those things can be variable, and joining on ID is then a consistent way for our databases to work.

I just wanted to raise an issue because I found it a bit confusing to join in a way I had been led to believe was bad practice.
(I may even have a wrong solution! Sorry if I'm wrong, just confused).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions