1

here is my code :

frontgreat=> CREATE TABLE contact_titlemessagesuggestion;
ERROR:  syntax error at or near ";"
LINE 1: CREATE TABLE contact_titlemessagesuggestion;

i don't understand why it's not working and why it's an syntax error.

frontgreat=> DROP TABLE contact_titlemessagesuggestion;
ERROR:  table "contact_titlemessagesuggestion" does not exist

have no syntax error and work fine.

Regards

2
  • Exactly which SQL dialect is this? Commented Oct 17, 2020 at 14:34
  • 1
    Most databases require tables to have at least one column, so CREATE TABLE foo ( bar INT ); for example. Commented Oct 17, 2020 at 14:35

1 Answer 1

3

You can normally not create a table without any columns. Therefore one often either has to list the columns, or use for example a query that provides both data (but meta-data as well) to construct the columns in the table.

For example:

CREATE TABLE contact_titlemessagesuggestion (
    pk INT
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.