0

New to joins, constraints, and references in PostgreSQL,

Here are the two table schemas I'm trying to create. The instructors table works just fine. The instructor_profile throws all sorts of errors.

create table instructors (
    id serial primary key,
    auth0id text unique not null,
    name varchar(30) not null,
    email varchar(100) unique not null
);

create table instructor_profile (
    id serial primary key,
    instructor_id integer references instructors(id),                                       
    age integer not null,   
    gender varchar(10) not null,
    price integer(10,2) not null,
    imgUrl text not null,
    about text not null,
    yearsTeaching integer not null,
    acoustic boolean,
    electric boolean,
    latitude text,
    longitude text
);          
1
  • What kind of errors are you getting? Please post them in your question. Commented Sep 13, 2018 at 23:35

1 Answer 1

1

you are just making a mistake defining the type of the price column, replace this line with:

price decimal(10,2) not null,

this notation (10,2) is used to specify the precision of decimal types and you are trying to use it with the integer type.

Sign up to request clarification or add additional context in comments.

2 Comments

Ah! That makes sense. Thank you!
You are welcome = ). Just so you know, here we try to avoid comments like thank you and others not related to the question. Also can you accept my answer ? Cheers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.