Select by attribute does exactly what it sounds like. You can select things from a table based on their attribute. It's a very powerful thing to be able to use, it's a handy tool, and it's actually not that hard to use. So, what I'm going do here is just walk through conceptually how it works and some of the different options that are available or scenarios where you may want to use it. So, here I have some restaurant data that I have downloaded from the City of Toronto open data website, and I'm just going to use this to show you some examples of how to perform queries, which is just another way of saying selections that I'm going to do, in this case, based on the attribute of those restaurants. Here's the attribute table for this, so all I have in here are the name of the restaurants and their addresses, and this is just a screenshot of the website where I got the data from. So, this is actually data based on the inspections that are done for restaurants in the city, it's called the Dinesafe program, and what I did was I downloaded that in a non GIS format and cleaned it up and then I was able to geocode it using the addresses and then turn it into a GIS file. So, this is not something that you can download directly and map directly, it actually took a little bit of work to clean this up and map it, but I thought it'd be an interesting and useful dataset to show you how these things work the select by attribute function is available in the main menu in ArcMap, you just go into the selection option in the top, and then you'll be able to select by attribute, that's the name of the tool, and so this is just a screenshot of the dialog box so it's easy to see, and what I'm going to do here is do a selection of all of the restaurants that have a name called THE GARDEN DELI. So we've got the layer up here, that's the feature class I'm going to perform our selection on, these are the fields that are available as options for me to use, and in this case, I'm going to say, "Select from restaurants where name equals THE GARDEN DELI." I say, "Apply," and it turns out there's one restaurant that has that name, and it's selected that, that's the result of doing a select by attribute is that you now have a selection, that's all it is, there's nothing permanent, there's nothing written into a file, with that selection you can just look at it, you can see what it is in the table or on the map, and if you like you can do things like export that to a new file, but we'll get to that in a minute. Here's the attribute table, and if we scroll down, you can see that we actually have it selected not only on the map, but also in the attribute table. So, it's selected it in both places so we can look at it geographically or by attribute. If you want, you can narrow it down by only displaying the attributes records that are selected, and in this case there's just one, but it's often away, in this case, we have over 6,000 records to be able to quickly see the ones that were selected and make sure they're the ones that you wanted to select and I did it the way you thought it would. Just one thing to note here, depending on how you're performing this query or what kind of data you're using is that in a geodatabase, you'll notice that it says, "Name" here, what that means here is that in the query, if you were just typing this in, you could type the name without the quotes. If you're using a shapefile though, the same data, but in a different file format, then you do have to put quotes in there. So, it depends on where you're getting your data from, if it's a shapefile, the field names have to be in double quotes, if it's in a geodatabase there are no quotes, just a little tip that might be useful to you. When you're building a query, there's three main parts to it; there's a field, an operator, and a value. All that a query does, and this is when you're performing a selection is a test for true or false. So in other words, if you think of this value here as the criteria that you're specifying, then it's going to test the records or the entries in your table to see, based on the operator, does any particular value meet that criteria? Then if it does it will be selected and if it doesn't it won't, so that's what we mean by the true or false aspect of this. There's lots of options available when you're doing a select by attribute and one of them that's really handy is to use a wildcard. So what you can do is say, for example, I want to find all of the restaurants that have DELI in the name, and if I do that, I can say, "Select all of the records where NAME LIKE '%DELI%'," and what that means, and here's a better way of looking at it here is that anywhere that DELI exists in the attribute names, this will be selected. So, the percent signs as wildcards just mean that there can be any number of characters before D-E-L-I and any number of characters after D-E-L-I as long as D-E-L-I is somewhere in the name in that attribute, then it will get selected, and that's what we've seen over here. On this side is that all of those restaurants that are selected have D-E-L-I in the name, so they're presumably you would think that they are DELIs. If we actually look at the attribute table though, let's have a look, so we have a plus DELI, so that's a DELI, might be able to get a nice Reuben sandwich there or something, but wait a minute, Aberdeen delicious, says delicious. So, it has D-E-L-I in the name, but that doesn't necessarily mean it's a DELI, it could be some other kind of restaurant. Africans Delight Cafe and Restaurant. So, the reason I'm putting this in is to help you to realize that you have to be very specific and particular about how you specify your query. So, this did exactly what I asked it to. I asked it to find anything that has D-E-L-I in the name, and that's what it did. So, that includes DELI, but it also includes things like delica and delimark and delight, and so, we may want to somehow narrow this down further in order to get restaurants that just have DELI as it's own word and a name, and you're probably already thinking, "Oh, well, what that would mean is we have to find a way of searching for words that have D-E-L-I, but have a space before and a space after." So, let's see if we can do a better version of that query. If we go back, and so here's our improved version of this, is that now we have the same wildcard, and by the way, I didn't really mention this, but the reason I'm using "LIKE" there, that's the operator that needs to be used with the wildcard symbol, and that's basically telling the software that you want to use wildcard and it's words that are like this because it has let something in the name that relates to that wildcard, that's the way I think of it anyway. So, all I've done here is now I have a space before DELI and a space after DELI, so it's basically wildcards space DELI space wildcard, and that will isolate or select only the entries, the names that have DELI as a separate word that are surrounded by spaces. So now we have fewer restaurants selected, so that means we've narrowed things down, let's have a look at our attribute table and see if it worked the way we hoped. This is our before selection and this is our after selection. So, now we have DELI here, DELI here, DELI here, so it did work. So, it actually gave us what we wanted. Now, there's one slight wrinkle to this though, is that when I ask it to find only entries where there's space DELI space, what if DELI's at the beginning of the name? Well, then it's going to not pick that up because there's no space before the beginning of the name, or what if DELI's at the end of the name? Then there may not be a space after it unless somebody typed in by accident or something. So, we want to then find a way of having a combination where it's like, well, maybe there's spaces on both sides or spaces on one side, but not the other, so let's see how we can do that. So now what I've done is I've used what's known as a boolean operator, and what that is, is a way of creating a compound statement. In other words, I have multiple criteria that I can specify at the same time, and it has to look for all of those things to be true in order for it to meet the criteria and to be selected as part of my result. So, now, I have spaces on both sides with wildcards. I have a space at the beginning but not at the end, and I have a space at the end, but not at the beginning. So, you can go on and on with this. I'm just trying to show you that there's different ways of doing this. You can use wildcards, but that the consequences may not always be quite the way you intend. Let's just finish this off, and if we look at our results, this is before and now this is after. So, you'll notice that it's picked up things like, for example, where DELI is at the end of the name. So, that did what we wanted it to do. We've now got a more realistic result and I really encourage you, of course, to always do this is when you do any tool function, query, whatever, is to look at the result and say, is that what I thought I was going to get? To zoom in or look at the selection or whatever it is you're doing and say, is that what I wanted to see? Is there anything that it didn't quite work the way I expected? Especially when you're first starting out, it may not work quite the way you want or there might be a little bit of wishful thinking involved where you think, "Well, It must have done it right," and then you look and go, "Oh, actually I need to go back and narrow it down a bit." So, hopefully, that helps. There are different operators available when you're specifying a query. So, remember, a query is a field, an operator and a value, and so we can specify different types of operators. Here are these are mathematical operators. So, as you would expect, you can use addition, subtraction, multiplication, and so on. So, for example, if you wanted to do a query of population density but you didn't have that calculated already in your table, maybe you have one field for population and another field for area, you can actually do the calculation of population divided by area, inside the query and it will do that calculation and then get the result for you and then apply the query to that. You can use relational operators, so less than, greater than, and so on. This is just the format that's used inside the software. If you want to see how these are applied, I can look at some data here. I've got median household income for census tracks in Toronto, and I'm going to classify this data into five quantiles. You'll notice when I do that, I can write down if I need to, and this'll come in handy here, the class boundaries for those quantiles. So, I may be useful if I wanted to, for example, select everything that's in the highest quantile or everything that's in the lowest quantile. There's no quick shortcut to do this in ArcMap. If you want to be able to save you a selection of all of the records that are below this threshold value, then really you just have to write that down, like 19,418 and then use that in the query as I'll show you. So, here, I have a choropleth map of median household income with five quantiles, and I'm just going to isolate or select the ones in the lowest quantile for household income. I can go into my select by attributes dialog box, and I'm going to select median income, less than or equal to 19,418, which is the value I have here, which I just wrote down from looking at the symbology box and class boundaries there. So, I know that it's 19,418. I put that in here. I'm going to select less than or equal to and then apply that. That's it, that's the result. I selected these census tracks based on this attribute using this my attribute tool. If we look at the attribute table, we can see the values that are selected are all below our threshold of 19,418. So, you can see these are all below that value, so they're selected and the ones that are above or not. So, that's basically it. Now, we can also look at population density, that was household income. We can also perform selections on a different field in the same data set and let's see what happens then. So, now, I'm going to look at the census tracks that are in the highest quantile for population density. Just do exactly the same thing, select by attribute, but now, I'm using a different field. I am using the density field here and I'm going to use the operator and value of greater than or equal to 9,259. So, that's the census tracks that meet those criteria, and so now, we can compare the two. So, I've selected census tracks that are low income, I can select census tracts that are high density, but can I select census tracks that meet both criteria at the same time? It would not be handy. Maybe, I'm interested in areas that are high population density but low-income. This is where Boolean operators come in. We can use things like and, or, not, or exclusive or to do that, and it is useful to remember and you may want to memorize the fact that and, means intersection, or, means union, and so on. Depending on what software you're using or what context or maybe you're reading a textbook or something, you may see either term used, and it's just a matter of getting to know what that means and how it relates to things like Venn diagrams, and queries, and selections, and so on. So, I'm just putting that in here now. So, let's see how this works. If I use median income, less than or equal to that value and density, greater than or equal to that value, so that's the operator here. That's the Boolean operator and what that's going do is test for true or false so the both things have to be true at the same time in order for it to be selected. That's what we end up with as our result here is you'll see that these are the selected census tracks where both of those things are true. So, with intersection, it's way of narrowing down a data set, it's a way of saying and I've got a selection here and a selection there, but where both of those things true at the same time, you're going to have fewer results than you would with either of those things separately. It's worth pointing out that what I'm doing is selecting two different things at the same time from the same table. So, here, I'm performing a selection based on median income. Here, I'm performing a selection based on density, and here, I'm doing a selection based on both of those things at the same time. So, in other words, you can have different criteria for two different fields in the same table at the same time. You could do three or four or ten or whatever you want. So, it's really powerful that way is there's lots of ways of mixing and matching criteria based on what it is you're looking for. So, now what? Once you've selected something you can export that selection as a new file. So, here's my selection, I can just right-click on it in the table of contents and say export the selected features and that will actually create a new feature class of just the selected values that's a really handy thing to be able to do. You can also perform a calculation just on that selection. So, for example, if you wanted to use the field calculator, you could do that and just have it do the calculation based on things that are already selected, and you can use that selection in another query. So, once you have one selection, that result of one query can become the input for another query. So, select values that are part of or inside, let's say, the census tracks that I've already selected.