 What's going on everybody? My name is Alex Freberg. And in today's video, we're going to be going over the select and the from statement. So if you joined us for our last video, we went over creating our tables and inserting data into those tables. And so we have this employee demographics table. And we also have this employee salary table. And today we're going to be walking through the select statement and the from statement on these tables. So here's some of the concepts that we're going to be going over today. Let's just get it started by doing select everything. And let's do this from the employee demographics table. So let's execute this. If we want to only show the first names, we can just do first name and run that. And if we want first name and last name, we can just separate that by using a comma. And it will return those. Well, if we want to return all columns and all rows, then all we have to do is use this star. So that's what the star does now we have nine rows of data here. And if we only wanted to return, let's say the top five, we can easily do that. And we can just say top five of everything. Now the reason this could be useful is say you have a table that has millions of rows in it and you only want a small sample, you can say select top 1000. And when you do that, it will only select the top five rows. Now let's get everything back in here really quick, because we're going to move on to this distinct feature. So when we use distinct, we're actually saying that we want the unique values in a specific column. So if we say distinct, and then let's do employee ID, everything should be returned. So all nine rows should be returned. And that's because every single one of these are unique. Now let's try gender. So there's only going to be two results, the male and the female. And that's because there's only two distinct values in that column. Now let's look at all of our data again. So now we want to look at count. Now count is very simple. All is going to do is going to show us all the non null values in a column. So let's look at last name, for example, if we do count of last name, all that's going to give us is a count of nine, because we have nine last names. If, for whatever reason, somebody's last name was left out and that was null, then it would have returned maybe eight or seven, depending on how many were actually in there. So if an entire column was null, it would be returned to zero. And if you notice, we are not given a column name. That's because this is derived information based off the last name. So if we want to actually give this a name so that that column does not say no column name, we can use this as right here. So once you put as you can actually name it. So since this is the count of the last name, we'll write last name count. Keep it simple. And if we execute that, as you can see, we have last name count right there. So that's how you use that as let's look at all of our data again. We want to look at some max minns and averages right now. And the only column here where it would be useful to do it on his age, but let's actually go over and let's look at our salary table. And at our salary table, we have some really interesting salaries that I think will be a little bit more useful for this information. So let's go over to employee salary. All right, and let's look at this table really quick. So we have our salary. Now we want to look at the maximum salary that is in that column. And that is going to be $65,000. Now let's say we wanted to know what the minimum salary was. Let's execute this and the person who makes the least money is making $36,000. Now what's the average? What is the average salary for all employees? That's going to be $48,555. So super easy to use all of these things. They're extremely useful. I use them every single day. So I know that each of these are very, very useful and are definitely among the basics that you have to know. Let's look real quick at everything really quick. So we just learned the select statement, but learning this from statement really quick is also important. Up here, this actually shows us that we're already hitting off the SQL tutorial database, but let's say we change it to master. When we try to run this, it's going to give us an error. And that's because now we're hitting off this database and this database does not have this table in it. So in order to do this, in order to still hit off that table while up here we're actually hitting off a different table, we can change this information. So the from statement, you have to specify three separate things. The first thing that you need to specify is the database. So let's say we want to hit off the SQL tutorial database. Now we want to select what table we're going to do. This is actually a .dbo. So let's put .dbo. There's a lot that can go into that. It's not worth getting into now, but .dbo. And let's do employee salary. When we execute this, our information comes up, even though up here we're still hitting off the master database. When we specify it right here, then we actually are choosing what database and what table to hit off of. And so it does not matter what it is up here. So that's how you use the from statement. In the next video, we're going to be going over the where statement. And then after that, you group by an order by statement, and that will be the complete basics of SQL tutorial. And then we'll start getting into a little bit more fun stuff, some more advanced concepts, which I think would be really, really exciting for everybody to learn. Thank you guys so much for joining me. I really appreciate it. I hope this has been helpful. If you like this type of content, subscribe below and I'll see you in the next video. Thanks and goodbye.