Search code examples
create-table

i cannot create a table , what is the wrong here ? ( Syntax error: Encountered "(" )


String sql = 

"CREATE TABLE coupon53 (
 id BIGINT PRIMARY KEY,
 title VARCHAR(25),
 start_date DATE,"+ " end_date DATE,
 amount INT,
 type ENUM ('Food', 'Electric', 'Travelling', 'Entertainment', 'Sport'))";

Solution

  •  String sql = "CREATE TABLE coupon40 (id BIGINT PRIMARY KEY, title VARCHAR(25), start_date DATE,"
    + " end_date DATE,"
    + "amount INTEGER,  type varchar(20) NOT NULL CHECK (type IN('Food', 'Electric', 'Traveling', 'Entertainment', 'Sport')), "
    + "message VARCHAR(25), price DOUBLE PRECISION, image VARCHAR(25))";