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);
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。