Weather Observation Station 4

Sort by

recency

|

1378 Discussions

|

  • + 0 comments

    For MySQL

    SELECT COUNT(city) - COUNT(DISTINCT city) FROM station;
    
  • + 0 comments

    select count(city)-count(DISTINCT city) from STATION;

  • + 0 comments

    COUNT () is the aggregate Funtion that used to count the number of rows in a table.

    COUNT(city) will count the number of row If it has city column and has value. If the city name is repeated in any row that also be counted .

    COUNT (DISTINCT city) count the number of row in which has the city column but did not count that row in which the city value is repeated.

    SELECT count(city) - count(DISTINCT city) FROM STATION;

  • + 0 comments

    MSSQL

    SELECT COUNT(CITY) - COUNT(DISTINCT CITY) FROM STATION;

  • + 0 comments

    I missed only the last semicolon as the description was, everything seems Okay.