Join on and where clause
SQL> CREATE TABLE emp
2 (
3 cid NUMBER,
4 address VARCHAR2(40) ,
5 postal_code VARCHAR2(10) ,
6 city VARCHAR2(30) ,
7 customer_state VARCHAR2(40)
8 );
Table created.
SQL>
SQL> CREATE TABLE sales(
2 product_id NUMBER(6),
3 cid NUMBER,
4 time_id DATE,
5 channel_id CHAR(1),
6 promo_id NUMBER(6),
7 sold NUMBER(3),
8 amount NUMBER(10,2),
9 cost NUMBER(10,2)
10 );
Table created.
SQL>
SQL> select c.cid, c.customer_state, s.sold
2 from sales s join emp c
3 on s.cid = c.cid
4 where product_id = 117;
no rows selected
SQL>
SQL>
SQL> drop table sales;
Table dropped.
SQL> drop table emp;
Table dropped.
Related examples in the same category