Top Operator

TOP OPERATOR We may want to have only a certain number of records returned. The keyword TOP will allow us to limit the number of rows returned. You can either set the number of rows to return or you can set a percentage. The keyword PERCENT is used to indicate a...

Filtering Data

In most cases, we will not want every single row in the table and we need a way to identify which rows we want returned. We can add a filter to the query and limit the rows returned. While performance tuning is beyond the scope of this book, you would be surprised at...

Special Filter Operators

LIKE  Let‘s say we‘re looking for a cat, but couldn’t quite remember its name; however, we know it started with Gar. We can use the LIKE operator to help us find the list of names that start with Gar. We should only use the LIKE operator with text data types. ...

Combining Operators

We can include as many conditions to our query as we want. We can set multiple conditions on the same column or we can use two or more columns to help decide what should be returned. Two conditions could be given and if either of them contain a match, the...

Distinct Operator

Distinct Operator There may be times when we want to see only one item in a list even though it may appear many times in the database. The keyword DISTINCT will return a single result for each unique value in the column. This example returns only one record for each...