cc_square

Coders Campus

Before we get into the show notes for this podcast episode, I want to spend some time talking about the Coders Campus community

I'm a BIG believer in online communities. Masterminds and communities are the main reason why I've come as far as I have in my life. Online communities are where I've met some of my closest friends and they have guided me through some very challenging parts of my career.

So it came as a bit of a shock to me that I don't belong to an online community dedicated to programmers.

When I tried to find a community for programmers online, I just couldn't find any good ones.

So, being the “go-getter” that I am, I've decided to start our very own community dedicated to programmers and the advancement of our common goal – To be a success as a programmer.

And that is how The Coders Campus Bootcamp began. We wanted to bring learning programmers together, and help them learn Java and get a job. You can learn all about our Online Java Coding Bootcamp here.

Database Keys

Okay, now that I've talked a bit about that cool new community for programmers, it's time to go over the show notes for this particular podcast episode.

Here's a diagram that outlines the example relationship I was mentioning in the podcast episode. This one uses “Account” and “Address”, but you can just replace “Account” with “User” to make it work with the example I mentioned in the episode.

Account - Address Relationship

Here you'll notice that the “Account” table has declared a primary key known as “Account_id”, and the “Address” table holds a relationship via the foreign key “Account_id”

This relationship is what we use to be able to JOIN data from the “Account” table to the “Address” table.

Here's an example of how we would read data from these tables by joining them together:

select * from Account
inner join Address on Account.account_id = Address.account_id;

This will actually join ALL the data from the “Account” table to the “Address” table… but what if we just want to get the information for a single account? Well we would just add a ‘where' clause to our sql like so:

select * from Account
inner join Address on Account.account_id = Address.account_id
where Account.firstname = 'trevor'
and Account.lastname = 'page';

Free Java Beginners Course

Start learning how to code today with our free beginners course. Learn more.