After following a 2-day SQL training, I wanted to practice for myself in the same database. I used dbgate and postgreSQL. I wanted a query which returns an overview of the initials that movies start with. Or an overview of the initials that first names of actors start with.
I read the postgresql documenten on the left function and the left-function example in an sql online tutorial and as far as I know, I did exactly the same but I do get an error telling me that there is a syntax error near '(' in line 1. I don't understand what is going wrong and would like to know how I have to adjust the query.
SELECT Left(first_name, 1),
count(*)
FROM actors
ORDER BY COUNT(*);
adjusted it for my question/situation:
SELECT Left(first_name, 1) as initial
COUNT(*)
FROM actors
GROUP BY initial
ORDER BY initial;
But still, this is the outcome:
Even this simple query doesn't work:
SELECT Left('ABCD', 1);
The same syntax error near '('.
I am using PostgreSQL 15 and DBGate.