'SQL Oracle - Can not create a view (ORA-00998 ERROR)

I want to create view with select and count/order by. Select lonely works but when I add command CREATE VIEW pocetpresov AS it shows me a error. (ORA-00998: must name this expression with a column alias ) Where is problem please?

CREATE VIEW pocetpresov AS
SELECT mesto, COUNT( mesto ) FROM klient GROUP BY mesto
HAVING
    COUNT( mesto )> 1
ORDER BY
    mesto;


Solution 1:[1]

You need to give a name to your COUNT column to get this query worked as a VIEW -

CREATE VIEW pocetpresov AS
SELECT mesto, COUNT( mesto ) cnt_mesto 
  FROM klient 
 GROUP BY mesto
HAVING COUNT( mesto )> 1
 ORDER BY mesto;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ankit Bajpai