Difference between revisions of "Inner Join"
Jump to navigation
Jump to search
(Created page with "'''A join of two or more tables that returns only the matched rows is called an inner join'''") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''A join of two or more tables that returns only the matched rows is called an inner join''' | '''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 | |||
[[#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