So the next couple of videos are all about tables which are the most important part of sequel.
They are the true heart of using sequel and in this first video we'll start off by setting the stage
or setting the table if you will let me get away with that for how they work what they are and then
we'll dive into data types next and then will actually create tables and see the code that you use to
create them.
So let's get started.
The first thing you should know is that a database is just a bunch of tables.
So we've already created a couple of empty databases and deleted them as well.
But what goes in them are just a bunch of tables.
That's where the data is stored as a short aside.
This is in a relational database So everything we're talking about uses sequel things like my Escudo
postscripts sequel like those are relational databases and they use tables they use tabular data but
not every single database in the world does.
And we'll see some examples of those later on this course is not about those types of databases but
it helps to kind of bring them in to show you some contrast to what you're learning.
So we'll see that later on.
Just a short caveat there.
So tables hold the data.
That's my definition if you want the boring Wikipedia definition.
It looks like this.
Tables are a collection of related data held in a structured format within a database.
Hopefully you're still awake after that.
But let's take a quick example using CAS.
So we're going to model some cat data using a table.
OK.
So let's take a quick look at the cats table.
Drum roll please.
That or die.
I know it's pretty hilarious.
You're probably falling out of your chair.
All right.
So the real cats table at least in this context doesn't have an apostrophe.
Look something like this.
And of course there's a million different ways we could break down the data for cat for modeling cats.
In my case I just went with a name breed and age.
So we could do plenty of other things like location gender is spayed is neutered that sort of thing.
But just doing name breed and age.
So I've put a couple of cats in here.
We've got flu.
Who's this Scottish Fold who's one year old.
That's my cat.
I've got rocket who is a Persian who's three years old.
Totally made up Monte who is a tabby who is 10 years old.
That is my childhood cat.
He's still kicking and biting people.
We've got Sam who is a munchkin.
If you don't know what that breed is look them up they're pretty hilarious.
Although Pender's said they have really stubby legs who is five years old also made that cat.
So some terminology when we're talking about tables and you hear the term columns it's referring to
the headers on that table.
So what are the different components of data the different pieces that have to be there.
In our case we have name breed and age.
So those are the columns and then the rows are the actual data in the table.
So here a row.
Blue Cat is one row rocket is another row Monte is another row Sam.
It's another row.
I really wish those lined up correctly but I just drove myself nuts trying to get it to work.
Please forgive me.
Anyways so databases are made up of lots and lots of these tables.
It's usually not just one.
And if you have a really really simple app and you're just storing one thing then it will just be one
but usually apps are pretty complicated and data is complicated.
All that we modeled there was cat.
But imagine if this was actually an app let's say it was a pet sitting app and cats were one thing that
we had to keep track of.
But we also have to keep track of owners and the pet sitters and addresses and dates and appointments
and payments and those are all going to be tables.
Some of them might even even be multiple tables.
But for now we're not going to really worry too much about that.
But just to show you sometimes it does get crazy you can click this link or I'll click it follow my
own instructions to see the breakdown of some of the tables that Facebook's database or a social network
might use in their database.
So this is not actual.
It's not 100 percent accurate.
There are things that are missing or incomplete but this just shows all the different tables or at least
some of the different tables involved in a pretty complex app.
So as you can see there is a bunch of them here.
Things like accounts and events and message notification Web site screen name address blah blah blah
all these different things to take into consideration.
So things can get messy.
And as you progress in this course you will start working with multiple tables you'll see how they connect.
But we haven't even seen how to create a single table yet.
So we're going to focus just on individual tables and then we'll move on from there.