- Previously, we've looked at creating tables and adding data and similar things like that. Now what we want to do is look at how do I go in and query my data? That is, look up information I need. So what I'm going to do is I'm going to go to my Create tab. Then I'm going to choose to make a query. I have two options. I can use a Query Wizard or open the query in design tool. Now a lot of this is going to depend upon what is it that I need to do. A simple query does not need to use the Wizard. In fact, an intermediate query, the wizard makes more difficult to do. The Query Wizard, if you click on it, however does allow you to find some specialty types of queries, such as a crosstab, duplicates, or even unmatched data. And those have their own uses. And you should understand that if you're going to get really good at using access. We're not going to focus on that. And so the Simple Query Wizard winds up being a little bit of overkill, and it makes making an intermediate query more difficult. So we're going to cancel out of that. What I'm going to choose is Query Design. When I open this up, I get a Show Table window. And so I can simply pick what customers do I want to pick or maybe some other table. For simplicity's sake, I'm just going to look at my products. Once I've added the table I want to display, I'm going to click Close. Now that I've done that, I'm going to select what fields do I want to display. If I want to display everything, I can click on the star. If I click on my data sheet view, you'll notice that it displays all of my fields for all of my rows. This is very, very simple, but may not be what we're looking for. So I'm going to go back to Design View. And I'm going to select my top field here where it says products dot star, star meaning everything. I'm going to delete that. And I'm going to choose the fields that I really care about. So, for example, product name, retail price, items in stock, discontinued, vendor, and category. Now notice I have left off description. I have left off the primary key or the ID for this particular field. When I go to View and choose Datasheet View, you can see just the columns that I selected. Now, right now it's showing all of my records because I have not filtered any. I've only selected or narrowed down to the columns I want. So this makes it very easy for me to work with and select and create queries. Now this is a very basic query that lets me select my columns. Now you might think, well, wait a second, we have the vendor and category, which are lookup fields. And you are absolutely correct on that. So I'm going to come over here to View and choose SQL View. Now you notice that I'm not joining multiple tables together or anything like that. This is because Access, as part of the lookup, displays the vendor name for me while storing the vendor ID. I can do this with other tables and other joins as well. This just makes it a little bit easier to work with. Behind the scenes, the data is all there, but it's making it easier. Remember, the reason for this is because Access is a desktop database. It's not designed to be used by a database professional. So they make a lot of things just easier for everyday users. In our next videos, we're going to start to look at how can we add some complexity to this simple query. Before I save this, I'm going to go back to my Design View, and I want to save this real quick. Notice when I click the Save button in the upper left hand corner, it's going to bring up a Save As. And this is just saving my query. Now, I like to start off my queries with qry or maybe vw for view, depending upon what system I'm using. Access likes to call them queries, other databases like to call them views. And then I'm going to give it a meaningful name. For example, products info. Gonna click OK. You'll notice that this now shows up in my all Access objects on my left hand side. And I have a new section called Queries where this displays. Notice it does get a different icon. That makes it a little bit easier for us to find as well. Notice if I click this dropdown arrow, I get a different way to view information. So, for example, I can group things. Because this is a product, I have products grouping. I personally like to do it by object type. I just find that a little bit easier for me. You may choose to do it differently. In our next couple of videos, we'll look at doing things like filtering out rows that are not necessary for us and joining tables to get more information.