content_image/850996.jpg content_image/851002.jpg
## 3.3.4.3 Selecting Particular Columns 

mysql> SELECT * FROM pet WHERE (species = ’cat’ AND sex = ’m’) OR (species = ’dog’ AND sex = ’f’); 

<img src='content_image/850996.jpg'>

If you do not want to see entire rows from your table, just name the columns in which you are interested, separated by commas. For example, if you want to know when your animals were born, select the name and birth  columns: 

mysql> SELECT name, birth FROM pet; 

<img src='content_image/851002.jpg'>

To find out who owns pets, use this query: 

mysql> SELECT owner FROM pet; +--------+ | owner | +--------+ | Harold | | Gwen | | Harold | | Benny | | Diane | | Gwen | | Gwen | | Benny | | Diane | +--------+ 

Notice that the query simply retrieves the owner  column from each record, and some of them appear more than once. To minimize the output, retrieve each unique output record just once by adding the keyword DISTINCT : 

mysql> SELECT DISTINCT owner FROM pet; +--------+ | owner | +--------+ | Benny | | Diane | | Gwen | | Harold | +--------+ 

You can use a WHERE  clause to combine row selection with column selection. For example, to get birth dates for dogs and cats only, use this query: 

