FAQ: What Are Database Keys? - Foreign Key Part 2

This community-built FAQ covers the “Foreign Key Part 2” exercise from the lesson “What Are Database Keys?”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Design Databases With PostgreSQL

FAQs on the exercise Foreign Key Part 2

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I think the query explained in this exercise is the same as inner join, and I saw this way for the first time:

SELECT person.name AS name, email.email AS email
FROM person, email
WHERE person.id = email.person_id;

Is this exactly the same as using JOIN clause:

SELECT person.name AS name, email.email AS email
FROM person
JOIN email
  ON person.id = email.person_id;

or is there any difference?

I had a chance to learn a little more about this in another topic:

Both can get basically the same result, but it depends on RDBMS. It seems that the former (implicit) way is old syntax. Now the explicit way (with JOIN clause) seems to be recommended for several reasons, such as code readability.

Hello @object2161442840,

:+1: Yes, you are correct they are the same. It’s great you found more info on the topic. I think it’s debatable on whether EXPLICIT joins are more readable :slightly_smiling_face:. I personally find implicit joins more concise and readable but don’t have issues working with either methods. It’s best to follow the development standards established by the environment you are working with.

1 Like