Much of our ability to manipulate the potentially large amount of data in a database depends on restricting our data sets to exactly the data elements that we want to use. A data set that is too small, prevents us from accomplishing our task, and one that is too large can overwhelm our process from a performance standpoint. We now examine how we can use a new clause to selectively return rows based on a condition.
In most of the examples we used in Chapter 2, every row was returned from each one of our queries. Only when using the DISTINCT
clause were we able to restrict output to unique rows, and only if there were duplicates. If we projected the first_name
and last_name
columns from the employee
table, every employee's first name and last name was returned. Until now, we had no way of displaying only the data that met a certain condition. For instance, say that we are working with our employee
table...