Java-self-built online bookstore (2)

Source: Internet
Author: User

Database Design: I use powerdesigner 15 (cracked version) here. If you need to download it, you can search for it.
I have simply designed it and I have no in-depth consideration. After all, the entire project is relatively simple and not formal.
one:
after the PD is designed, CTRL + G generates the script file:

Drop table if exists tbbookauthor; drop table if exists tbbookcategory; drop table if exists tbbookinfo; drop table if exists tbbookpublisher; drop table if exists tbmanagerinfo; drop table if exists tborderinfo; drop table if exists tborderitem; drop table if exists tbstoreinfo; drop table if exists tbuseraddress; drop table if exists tbuserinfo; drop table if exists tbrbookauthor; /* ===================================================== =======================================* // * Table: tbbookauthor * // * ========================================= =========================*/create table tbbookauthor (author_id int not null auto_increment, author_name varchar (64) not null, author_info text, author_memo text, primary key (author_id); alter table tbbookauthor comment 'author info table '; /* ===================================================== =======================================* // * Table: tbbookcategory * // * ======================================== =========================*/create table tbbookcategory (category_id int not null auto_increment, category_name varchar (32) not null, category_description text, category_memo text, primary key (category_id); alter table tbbookcategory comment 'book category table '; /* ===================================================== =======================================* // * Table: tbbookinfo * // * ======================================== =========================*/create table tbbookinfo (book_id int not null auto_increment, category_id int, publisher_id int, book_name varchar (64) not null, book_price float, book_description text, book_memo text, book_nowprice float, book_storeno int, primary key (book_id )); alter table tbbookinfo comment 'book info table '; /* ===================================================== =======================================* // * Table: tbbookpublisher * // * ============================================== =========================*/create table tbbookpublisher (publisher_id int not null auto_increment, publisher_name varchar (32) not null, publisher_addr varchar (64), publisher_phone varchar (18), publisher_email varchar (32), publisher_url varchar (64), publisher_description text, publisher_memo text, primary Key (publisher_id); alter table tbbookpublisher comment 'publisher info table '; /* ===================================================== =======================================* // * Table: tbmanagerinfo * // * =========================================== =========================*/create table tbmanagerinfo (manager_id int not null auto_increment, manager_name varchar (32) not null, manager_password varchar (32) not null, primary key (manager_id); alter table tbmanagerinfo comment 'bookstore administrator info table '; /* ===================================================== =======================================* // * Table: tborderinfo * // * ======================================== =========================*/create table tborderinfo (order_id int not null auto_increment, addr_id int, order_tel varchar (18) not null, order_time datetime, order_memo text, primary key (order_id); alter table tborderinfo comment 'order info table '; /* ===================================================== =======================================* // * Table: tborderitem * // * ======================================== =========================*/create table tborderitem (item_id int not null auto_increment, order_id int, book_id int, item_number int, item_memo text, primary key (item_id); alter table tborderitem comment 'information table for each order '; /* ===================================================== =======================================* // * Table: tbstoreinfo * // * ======================================== =========================*/create table tbstoreinfo (store_name varchar (32) not null, store_addr varchar (64), store_phone varchar (18), store_email varchar (64), store_descriptrion text, store_memo text, primary key (store_name )); alter table tbstoreinfo comment 'the bookstore basic information table, including the bookstore name, address, phone number, and other information '; /* ===================================================== =======================================* // * Table: tbuseraddress * // * ======================================== =========================*/create table tbuseraddress (addr_id int not null auto_increment, user_id int, addr_addr varchar (64) not null, addr_memo text, primary key (addr_id); alter table tbuseraddress comment 'users' shipping address '; /* ===================================================== =======================================* // * Table: tbuserinfo * // * ======================================== =========================*/create table tbuserinfo (user_id int not null auto_increment, user_name varchar (32) not null, user_password varchar (32) not null, user_email varchar (64), user_phone varchar (18), user_description text, user_memo text, primary Key (user_id); alter table tbuserinfo comment 'user table '; /* ===================================================== =======================================* // * Table: tbrbookauthor * // * ========================================== =========================*/create table tbrbookauthor (rba_id int not null auto_increment, book_id int, author_id int, primary key (rba_id); alter table tbrbookauthor comment 'book and Author Relationship table, many-to-many '; alter table tbbookinfo add constraint fk_bookcategory foreign key (category_id) references tbbookcategory (category_id) on Delete set null on update cascade; alter table tbbookinfo add constraint fk_bookpublisher foreign key (publisher_id) References tbbookpublisher (publisher_id) on Delete set null on update cascade; alter table tborderinfo add constraint limit foreign key (addr_id) References tbuseraddress (addr_id) on update cascade; alter table tborderitem add constraint limit foreign key (book_id) References tbbookinfo (book_id) on update Cascade; alter table tborderitem add constraint fk_orderitem foreign key (order_id) References tborderinfo (order_id) on update cascade; alter table tbuseraddress add constraint fk_useraddress foreign key (user_id) References tbuserinfo (user_id) on Delete cascade on update cascade; alter table tbrbookauthor add constraint fk_rauthor foreign key (author_id) References tbbookauthor (author_id) on Delete cascade on update cascade; alter table tbrbookauthor add constraint fk_rbook foreign key (book_id) References tbbookinfo (book_id) on Delete restrict on update cascade;

entire file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.