java访问数据库的sql

drop database if exists STOREDB;
create database STOREDB;
use STOREDB;

create table CUSTOMERS (
ID bigint not null auto_increment primary key,
NAME varchar(16) not null,
AGE INT,
ADDRESS varchar(255)
);

create table ORDERS (
ID bigint not null auto_increment primary key,
ORDER_NUMBER varchar(16) not null,
PRICE FLOAT,
CUSTOMER_ID bigint,
foreign key(CUSTOMER_ID) references CUSTOMERS(ID)
);

insert into CUSTOMERS(ID,NAME,AGE,ADDRESS) values(1, '小张',23, '北京');
insert into CUSTOMERS(ID,NAME,AGE,ADDRESS) values(2,'小红',29, '天津');
insert into CUSTOMERS(ID,NAME,AGE,ADDRESS) values(3,'小丁',33, '山东');

insert into ORDERS(ID,ORDER_NUMBER,PRICE,CUSTOMER_ID) values(1, '小张_001',100.12, 1);
insert into ORDERS(ID,ORDER_NUMBER,PRICE,CUSTOMER_ID) values(2, '小张_002',200.32, 1);
insert into ORDERS(ID,ORDER_NUMBER,PRICE,CUSTOMER_ID) values(3, '小红_001',88.44, 2);

上一篇:jQuery匿名函数$(function(){ }


下一篇:JAVA 语法基础综合练习——学生成绩管理系统