DAY 5
来源:互联网 发布:java电商项目经验 编辑:程序博客网 时间:2024/04/30 15:37
Day 5.
2.
CREATE TABLE CUSTOMER(
CUST_ID VARCHAR2(3) CONSTRAINT CUSTOMER_pk PRIMARY KEY ,
CUST_NAME VARCHAR2(30) CONSTRAINT CUSTOMER_CNAME_nnull NOT NULL ,
ANNUAL_REVENUE VARCHAR2(10) ,
CUST_TYPE VARCHAR2(30));
CREATE TABLE TRUCK(
TRUCK_NO VARCHAR2(3) CONSTRAINT TRUCK_pk PRIMARY KEY ,
DRIVER_NAME VARCHAR2(30) CONSTRAINT TRUCK_DNAME_nnull NOT NULL);
CREATE TABLE CITY(
CITY_NAME VARCHAR2(15) CONSTRAINT CITY_pk PRIMARY KEY ,
POPULATION VARCHAR2(20) CONSTRAINT CITY_POPULATION_nnull NOT NULL);
CREATE TABLE SHIPMENT(
SHIPMENT_NO VARCHAR2(3) CONSTRAINT SHIPMENT_pk PRIMARY KEY ,
CUST_ID VARCHAR2(3) CONSTRAINT SHIPMENT_fkey1 REFERENCES CUSTOMER(CUST_ID) ,
WEIGHT VARCHAR2(3),
TRUCK_NO VARCHAR2(3) CONSTRAINT SHIPMENT_fkey2 REFERENCES TRUCK(TRUCK_NO) ,
DESTINATION VARCHAR2(15));
INSERT INTO CUSTOMER VALUES('100','Revathi','500000','manufacturer');
INSERT INTO CUSTOMER VALUES('101','Richa','1800000','wholesaler');
INSERT INTO CUSTOMER VALUES('102','Rishi','1000000','retailer');
INSERT INTO CUSTOMER VALUES('103','Rajesh','4000000','wholesaler');
INSERT INTO CUSTOMER VALUES('104','Kalyan','24800000','wholesaler');
INSERT INTO TRUCK VALUES('100','Jensen');
INSERT INTO TRUCK VALUES('101','Sasi');
INSERT INTO TRUCK VALUES('102','Jake Stinson');
INSERT INTO TRUCK VALUES('103','Alex');
INSERT INTO CITY VALUES('London','100000000');
INSERT INTO CITY VALUES('Paris','120000000');
INSERT INTO CITY VALUES('Rome','200000000');
INSERT INTO CITY VALUES('Panama City','1230000000');
INSERT INTO CITY VALUES('San Francisco','20000000');
INSERT INTO SHIPMENT VALUES('100','101','500','101','Rome');
INSERT INTO SHIPMENT VALUES('101','101','100','102','London');
INSERT INTO SHIPMENT VALUES('102','103','300','101','London');
INSERT INTO SHIPMENT VALUES('103','103','10','101','Paris');
INSERT INTO SHIPMENT VALUES('104','101','20','103','Paris');
INSERT INTO SHIPMENT VALUES('105','101','200','101','San Francisco');
INSERT INTO SHIPMENT VALUES('106','100','50','101','Rome');
INSERT INTO SHIPMENT VALUES('107','102','500','101','Rome');
INSERT INTO SHIPMENT VALUES('108','101','50','102','San Francisco');
INSERT INTO SHIPMENT VALUES('109','101','25','100','Paris');
INSERT INTO SHIPMENT VALUES('110','101','25','101','Panama City');
3.
2.select DISTINCT DRIVER_NAME from TRUCK t, SHIPMENT s where t.TRUCK_NO=s.TRUCK_NO AND
s.DESTINATION='Rome';
select DRIVER_NAME from TRUCK t where t.TRUCK_NO in(select s.TRUCK_NO from SHIPMENT s where
s.DESTINATION='Rome');
select DRIVER_NAME from TRUCK t where exists(select s.TRUCK_NO from SHIPMENT s where
s.TRUCK_NO=t.TRUCK_NO and s.destination='Rome');
3.select CUST_ID from CUSTOMER c where c.CUST_ID in(select s.CUST_ID from SHIPMENT where c.CUST_ID=s.CUST_ID AND COUNT(SHIPMENT_NO)>1;
1. List the name of the customer who has sent shipments to ‘London’.
2. List the names of the truck drivers, who have delivered shipments to ‘Rome’
3. List the names of the customers, who have sent more than one shipment.
4. List the names of the truck drivers, whose total weight of delivered shipment is more than 1000.
5. Display the name and annual revenue of the customer, who has not sent any shipment.
6. Display the names and the population of the city if the population is more than 100000000 and if more than one
shipment has gone to the city.
7. List the names of drivers, who have delivered shipments weighing over 100 pounds taken cumulatively.
8. List the names of the customers and total weight of shipments, if the total weight of shipment is the maximum
among the total shipments of each customer.
- DAY 5
- Day 5
- day 5
- Day-5
- DAY 5
- Day 5
- CoreJava Day 5
- DAY 4 &5
- DAY 5 kejian
- day 5 list
- day 9 (frequency 5)
- day 10 ( frequency 5)
- day 11 (frequency 5)
- [day 5]算术测验
- 函数(Day-5)
- Java Day 5
- [2016.7 day.5] T2
- Summer day 5
- WINDOWS 逻辑坐标 设备坐标 屏幕坐标 客户区坐标
- Socket编程基础范例
- RegQueryValueEx函数返回234错误解决方法
- 重写Ext.MessageBox.confirm中文按钮名称
- 彻底搞定C指针---指向指针的指针
- DAY 5
- CSS常用技巧介绍
- 七种武器:Collection 之 Google Guava
- 深入理解c#中的lock
- js 复制到剪贴板 火狐
- 在Windows中获取指定目录的API函数SHGetSpecialFolderPath
- Timer类的schedule使用方法
- c#多线程调用有参数的方法
- 2010/8/20