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 and 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 as well 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 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.
But let me give you an example let's say we have a pet shelter where we have a cat table and a dog 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 meat.
So we could use this as to label it so it wouldn't change the actual data.
Ours our data is the same the columns are the same but when 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 a common name from cats 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 I.D. 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 the 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 Kitty breed.
But of course if we do 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 alias's you'll see us using them later on.
But I want to introduce them now so that you're not overwhelmed with a bunch of new stuff.
When we get to join tables.