Welcome back! While you were gone
Amy just joined our user base with a score of 88.
Perfect.
Now let's learn a few more SQL commands that are useful.
What if I wanted to grab all users with names starting with 'A'. With SQL,
it's super fast and super easy.
We can simply say SELECT all FROM users WHERE name and this is a new one we're learning LIKE. And like
allows us to add a condition.
In our case we can say 'A'
And then the percentage sign which means anything after a.
If I click semi-colon and enter, look at that I get
Andrei and Amy. Let's try this on our GUI as well.
and show you what we can do.
If I go over here, just copy and paste this.
And if I change this to lowercase and run query, Well I don't get anything because it has to be uppercase
right.
We're searching for 'A'.
There you go.
Although with SQL our commands can be lowercase or uppercase when we do searches we want to make sure
that the case matters and that is why mostly when we store information in databases we want to make
sure that there is some consistency.
So when we save this information such as inserting. Maybe in the server we lowercase everything so that
we don't have this issue.
What if I wanted to do all names ending in 'y'.
If I do percentage y run query I get Sally and Amy. Amazing.
Okay what if I want to do something different.
Let's say I want to get everything sorted in order.
Maybe from the highest score to the lowest score.
Well we can select all from users and we can order by the column we want to order by.
In our case it will be the score.
And if we want to do ascending or descending- let's do descending first.
And I spelled descending wrong.
It's DESC.
Press enter and look at that.
I have Sally and John as the top score. If I do ascending ASC, I get low score Andrei, hmm.
I'm not doing too well in this game.
Very cool.
Are you starting to see the power of SQL.
Remember all the looping that we would have had to do if we had usernames. SQL is really
really good at grabbing this information.
You saw how fast this is even if this was hundreds of lines it will be really good at grabbing information,
updating information, maybe ordering it.
It is extremely powerful.
Pretty much since the 1960s it's been just the language of choice for databases because it's so
good.
All right.
Awesome.
We're starting to learn more and more, a few more to go.
I'll see you in the next one.
Bye bye.