Creating Tables from ERD

  • I need to write create table statements for the er diagram that I attached. I am new to sql and I have trouble integrating foreign keys with these bigger er diagrams. Could someone give me some assistance with these?

    These are the tables I need to create:

    Create Table Author(...)

    Create Table Writes(...)

    Create Table Book(...)

    Create Table Copy(...)

    Create Table Loan(...)

    Create Table Customer(...)

    A point in the right direction would be appreciated!

  • This is what I have so far...

    Create Table Author(Aid integer primary key, First text, Last text)

    Create Table Writes(Booknum integer references Book(Booknum), Aid integer references Author(Aid), Percent integer, primary key Booknum(Aid)

    Create Table Book(...haven't done this one yet)

    Create Table Copy(Copynum integer primary key, Price decimal(8,2), Booknum not null, foreign key(Booknum) references Book(Booknum))

    Create Table Loan(Loannum integer primary key, Out text, Due text, Ret text, foreign key(Copynum) references Copy(Copynum))

    Create Table Customer(...haven't done this one yet)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply