I am trying to create a table in a PSQL database with VSCode, but I receive syntax error. INT is underlined by vscode, if I delete it then TEXT and so on…
Could you please give me any idea what is the issue?
CREATE TABLE nfl_week_three (
rank INT,
team TEXT,
games INT,
points_scored INT,
total_yards INT,
offensive_plays INT,
yards_per_play DOUBLE PRECISION,
turnover_lost INT,
fumbles_lost INT,
1st_downs INT,
passes_completed INT,
passes_attempted INT,
passing_yards INT,
passing_touchdowns INT,
passing_interceptions INT,
net_yards_per_passing_attempt DOUBLE PRECISION,
passing_1st_downs INT,
rushing_attempts INT,
rushing_yards INT,
rushing_touchdowns INT,
rushing_yards_per_attempt DOUBLE PRECISION,
rushing_1st_downs INT,
penalties INT,
penalty_yards INT,
1st_down_penalties INT,
percetage_scoring_drives INT,
percentage_turnover_drives INT,
expected_points INT
);
2
Answers
You just had some extra 1’s in there as typo.
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS says:
This means your column name
1st_downs
and others that start with a digit are a problem.You can either change the column names, or else delimit such names in double-quotes.