Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This needs to be unique #6

Open
umutdogan opened this issue Feb 8, 2022 · 4 comments
Open

This needs to be unique #6

umutdogan opened this issue Feb 8, 2022 · 4 comments

Comments

@umutdogan
Copy link

@f-mda
Copy link

f-mda commented Jun 7, 2022

Yes, had the same issue when doing Chapter 3, need to define it as unique or just call it a primary key

@dainank
Copy link

dainank commented Aug 10, 2023

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
);

@hasanraj3100
Copy link

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)
);

@dainank
Copy link

dainank commented Dec 9, 2023

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.

undefine-man added a commit to undefine-man/spring-in-action-v6-translate that referenced this issue Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants