Reputation: 28441
I'm really trying to get going with sql but can't even create a simple table. I've been working on this for the past two hours and can't get going. I know the solution is easy and everyone laughs, but where is the syntax wrong?
CREATE TABLE tbl1
(
state varchar(10),
city varchar(10),
);
The error reads line 2:1: mismatched input '(' expecting AS
.
When I add AS
:
CREATE TABLE tbl1 AS
(
state varchar(10),
city varchar(10),
);
line 3:1: no viable alternative at input 'state'
I've tried about 14 other combinations of AS
and curly braces {
, TEMPORARY TABLE
with others and can't solve it. There has to be something I'm missing.
Upvotes: 0
Views: 1534
Reputation: 4957
There is extra comma "," just before ")"
Run below code.
CREATE TABLE tbl1
(
state varchar(10),
city varchar(10)
);
CREATE TABLE tbl1
(
state varchar(10),
city varchar(10)
);
Upvotes: 1