SpringBoot项目练习
一.Springboot小项目入门
1.创建数据库
create database springboot_demo;
use springboot_demo;
#创建用户表
create table users(
userid int auto_increment primary key,
username varchar(20),
password varchar(20),
flag int #账号标识: 可用/禁用
)
insert into users(username,password,flag)
values('admin','123456',1),('123456','123456',1)
select * from users;
#创建商品分类表
create table category(
categoryid int auto_increment primary key,
categoryname varchar(20)
)
insert into category(categoryname)
select '饮品' union
select '食品'
select * from category;
#创建商品信息表
use springboot_demo;
create table goods(
goodsId INT AUTO_INCREMENT PRIMARY KEY,
goodsName VARCHAR(200),
price NUMERIC(5,1),
address VARCHAR(200),
produceDate DATE,
pricture VARCHAR(200),
categoryId INT,
FOREIGN KEY(categoryId)
REFERENCES category(categoryId)
)
use springboot_demo;
select * from goods;
2.