Selecting Distinct Values

If you look at the original table, CHECKS, you see that some of the data repeats itself. For example, if you looked at the AMOUNT column using

SQL> select amount from checks;
					

you would see

   AMOUNT
---------
      150
   245.34
   200.32
       98
      150
       25
     25.1

Notice that the amount 150 is repeated. What if you wanted to see how many different amounts were in this column? Try this:

SQL> select DISTINCT amount from checks;
					

The result would be

   AMOUNT
---------
       25
     25.1
       98
      150
   200.32
   245.34

6 rows selected.

Notice that only six rows are ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.