So one more thing we're going to talk about with reading data when we're talking about crud.
Before we move on to updating, deleting, there's one other thing which are aliases.
These are really simple, very short video here.
Basically, we can specify how our data should be displayed back to us.
So what that means is rather than having cat ID, name, breed and age here, I could tell my SQL that
instead of breed I want, I don't know, type of cat or instead of age I want years and it won't alter
the the data itself.
It just is how it's displayed to me.
So let me show you a more specific example.
Here we have using an alias.
We're selecting the cat ID as ID.
So rather than saying cat ID in the results, it will only say ID and then name from cats.
Now, this is not that clear why it's useful, and that won't become clear for a little bit, because
right now our data is very simple and straightforward.
But once we have multiple tables and we're selecting from.
Let me give you an example.
Let's say we have a pet shelter where we have a cat's table and a dog's table and both of them have
a name.
So dogs have names, cats have names.
And when we talk about join tables, which you'll learn about in a little bit, that's when we take
both tables and we select from them at once and combine them and the results.
We would have two columns with name, so we would need to figure out which one is cat name, which one
is dog name.
So we could use this as to relabel it so it wouldn't change the actual data or our data is the same,
the columns are the same, but when it printed back out to us, when it spits out the data, it would
use an alias.
So if we try this now.
Cat ID as ID common name from cat.
You'll see that we get ID here.
And just to make that clear, I did the same thing and I even put a little arrow pointing to that ID.
It doesn't say cat ID, it says ID.
So also just to prove this, we could do something like select name as cat name or also just to show
you, you can use quotes to add spaces.
So cat name like that comma will also select breed as kitty breed.
Why not from cats?
And there you go.
Our new column headers here are cat name and kiddie breed.
But of course, if we do a describe cats, you'll see nothing has changed.
Our fields are still name and breed just when we print them out.
So that's all there is to aliases.
You'll see us using them later on.
But I wanted to introduce them now so that you're not overwhelmed with a bunch of new stuff when we
get to join tables.