----------------------------------------------------多表连接
select * from sale,Product,Customer
where sale.product_id =product.product_id
and sale.customer_id =customer.customer_id
and sale.customer_id in(select customer_id from customer where customer_name like '%李%')
order by sale_date desc;
-------------------------------------------------------多表嵌套
select * from sale
where customer_id in(select customer_id from customer where customer_name like '%李%')
order by sale_date desc;
---------------------------------------------------------操作日期
and sale_date>'2012/07/20 00:00:00'
--------------------------------------------------------------------java----oracle
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("创建驱动失败a");
e.printStackTrace();
}
try {
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:student", "achun", "asdf");
} catch (SQLException e) {
System.out.println("创建连接失败");
e.printStackTrace();
}