. SQL . SQL Count Distinct
SQL Count Distinct
SQL Count (Distinct) Example
Q: How many different movies were Humphrey Bogart and Ingrid Bergman in?
Select Count(Distinct Film_Title)
From Thespian_Film_Table
Where (Thespian_Last_Name = "Bogart"
and Thespian_First_Name = "Humphrey")
or (Thespian_Last_Name = "Bergman"
and Thespian_Last_Name = "Ingrid");
111
Note: Humphrey Bogart was in 72 films. Ingrid Bergman was in 40 films. However, the distinct count is 111, not 112 - because both were in Casablanca!
| Comments |
| Sign In |
| to add the first comment for SQL Count Distinct. |