Give user permission for querying a view
CREATE USER 'GERARD'@'localhost' IDENTIFIED BY 'XYZ1234' ; CREATE VIEW RESIDENTS (TOWN, NUMBER_OF) AS SELECT TOWN, COUNT(*) FROM PLAYERS GROUP BY TOWN ; GRANT SELECT ON RESIDENTS TO GERARD