Difference between revisions of "Inner Join"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 5: | Line 5: | ||
ON sales.product_id = product.product_id; | ON sales.product_id = product.product_id; | ||
01-FEB-15 1269 200 Samsung F7100 | OR | ||
01-JAN-15 1267 100 Mobile Cover | SELECT A.sales_date, A.order_id, A.product_id, B.product_name | ||
01-JAN-15 1267 101 iPhone | FROM sales A INNER JOIN product B | ||
02-JAN-15 1268 100 Mobile Cover | ON A.product_id = B.product_id ; | ||
09-FEB-15 1270 105 HTC 7800 | |||
09-FEB-15 1270 106 Microsoft Keyboard 7865 | SALES_DATE ORDER_ID PRODUT_ID PRODUCT_NAME | ||
09-FEB-15 1270 101 iPhone | 01-FEB-15 1269 200 Samsung F7100 | ||
01-JAN-15 1267 100 Mobile Cover | |||
01-JAN-15 1267 101 iPhone | |||
02-JAN-15 1268 100 Mobile Cover | |||
09-FEB-15 1270 105 HTC 7800 | |||
09-FEB-15 1270 106 Microsoft Keyboard 7865 | |||
09-FEB-15 1270 101 iPhone | |||
[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]] | [[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]] |
Latest revision as of 14:07, 1 November 2017
A join of two or more tables that returns only the matched rows is called an inner join
SELECT sales.sales_date, sales.order_id, sales.product_id, product.product_name FROM sales INNER JOIN product ON sales.product_id = product.product_id;
OR
SELECT A.sales_date, A.order_id, A.product_id, B.product_name FROM sales A INNER JOIN product B ON A.product_id = B.product_id ;
SALES_DATE ORDER_ID PRODUT_ID PRODUCT_NAME 01-FEB-15 1269 200 Samsung F7100 01-JAN-15 1267 100 Mobile Cover 01-JAN-15 1267 101 iPhone 02-JAN-15 1268 100 Mobile Cover 09-FEB-15 1270 105 HTC 7800 09-FEB-15 1270 106 Microsoft Keyboard 7865 09-FEB-15 1270 101 iPhone