准备两个关联的表
1.
CREATE DATABASE Qifengbaozi;
USE Qifengbaozi;
CREATE TABLE Yihaodian/*假设这是一号店的一上午的营业额*/
(
f_id INT NOT NULL AUTO_INCREMENT,
f_name NVARCHAR(60) NOT NULL ,
f_price INT NOT NULL,
f_count INT NOT NULL,
f_bianhao INT NOT NULL,
PRIMARY KEY (f_id)
)ENGINE=INNODB;
2.
CREATE TABLE person
(
p_id INT NOT NULL AUTO_INCREMENT,
p_name NVARCHAR(60) NOT NULL ,
p_bianhao INT NOT NULL,
PRIMARY KEY(p_id)
)ENGINE=INNODB;
1>这个是yihaodian表
2>这个是person表
一 分组查询
1>
2>
3>
4>
5>
二 子查询
1>
2>
3>