Here is my code:
SET SEARCH_PATH TO work
/* Task 1 */
INSERT INTO Category (CategoryID, Name, CategoryType)
VALUES(1,'English','fiction');
and here is the error:
ERROR: syntax error at or near "INSERT"
LINE 4: INSERT INTO Category (CategoryID,Name,CategoryType)
^
********** Error **********
ERROR: syntax error at or near "INSERT"
SQL state: 42601
Character: 45
This SQL error generally means that somewhere in the query, there is invalid syntax. Some common examples: Using a database-specific SQL for the wrong database (eg BigQuery supports DATE_ADD, but Redshift supports DATEADD) Typo in the SQL (missing comma, misspelled word, etc)
Another common error code with PostgreSQL database is 42703 as well as the error message “column does not exist”. This error indicates either that the requested column does not it exist, or that the query is not correct.
In order to connect to a database you need to know the name of your target database, the host name and port number of the server, and what user name you want to connect as. psql can be told about those parameters via command line options, namely -d, -h, -p, and -U respectively.
You need a semi-colon at the end of the SET statement:
SET SEARCH_PATH TO work;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With