Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use book_api_db;
- create table books(
- id varchar(255) unique not null,
- image_link text,
- page_count int ,
- published_date varchar(200),
- publisher varchar(200),
- title text,
- subtitle longtext,
- primary key(id)
- );
- create table categories(
- id int auto_increment unique not null ,
- name varchar(255) unique ,
- parent_category int default 0,
- primary key (id)
- );
- create table authors(
- id int auto_increment unique not null ,
- name varchar(255) unique ,
- primary key (id)
- );
- create table book_categories(
- book_id varchar(255) not null ,
- category_id int not null,
- foreign key (book_id) references books(id),
- foreign key (category_id) references categories(id)
- );
- create table book_authors(
- book_id varchar(255) not null ,
- author_id int not null ,
- foreign key (book_id) references books(id),
- foreign key (author_id) references authors(id)
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement