A simple database design example and a simple database design example
An example of database design in a simple management system, including design tables, ergraphs, modeling, and scripts.
++ ++ ++
Project Name:Book Manager System
DB:MySQL5.5
DB Name:Db_library
Tables:
1). tb_book_info
2). tb_user
3). tb_admin_info
4). tb_borrow_return
5). tb_book_type
C: \ Program Files \ MySQL Server5.5 \ bin>Mysql-u root-pabcd <c: \ admin. SQL
NOTE:
1. Run MySQL-u root-pabcd <c: \ admin. SQL In the mysql/bin directory.
2. database name used for the exercise: db_library in the library Project
/* ===================================================== ======================================= */
/* Table: tb_admin_info Table for administrator login */
/* ===================================================== ======================================= */
Drop database if exists library; # the database used for the exercise. Delete the database if it exists.
Create database library; # create a database.
Use library; # Open the database. use a semicolon.
Create tabletb_admin_info # create an exercise table.
(
Admin_id int (3) auto_increment not null primary key, # primary key, non-empty, auto-increment.
Admin_user varchar (15) not null,
Admin_pwd varchar (15) not null
);
Insert into tb_admin_infovalues ('001', 'Tom ', 'Jerry'); # insert two pieces of data for testing.
Insert into tb_admin_infovalues ('002 ', 'root', 'root'); # insert two pieces of data for testing.