Open umutdogan opened 2 years ago
Yes, had the same issue when doing Chapter 3, need to define it as unique or just call it a primary key
Yes, had the same issue when doing Chapter 3, need to define it as unique or just call it a primary key
@f-mda Why has this not been updated in the book? Could throw some people off:
create table if not exists Ingredient (
id varchar(4) primary key not null,
name varchar(25) not null,
type varchar(10) not null
);
This also worked for me:
create table if not exists Ingredient (
id varchar(4) not null,
name varchar(25) not null,
type varchar(10) not null,
unique(id)
);
This also worked for me:
CREATE TABLE IF NOT EXISTS ingredient ( id VARCHAR(4) NOT NULL, name VARCHAR(25) NOT NULL, type VARCHAR(10) NOT NULL, UNIQUE(id) );
Maybe wrap the code within your comment in sql
format just for readability.
https://github.com/habuma/spring-in-action-6-samples/blob/33acc6497f9a98a3ba8dfe980fd00b87ce0dee5b/ch03/tacos-jdbctemplate/src/main/resources/schema.sql#L30