SQL Inner Join

SQL inner joins are used to join data or records of two or more tables based on matching values ​​in both tables. The Inner Join will create the resulting set until the condition is satisfied by combining all rows from both tables.

INNER JOIN

Inner Join Syntax :

The syntax of the Inner Join is βˆ’

SELECT column-name(s)
FROM table1
INNER JOIN table2
ON table1.column-name = table2.column-name;



SQL Inner Join Example :

Consider the Customer table with the following records -

ID Name Age Address Salary
1 Aarav 36 Udaipur 35000
2 Vivaan 33 Mumbai 30000
3 Reyansh 28 Chennai 40000
4 Muhammad 29 Udaipur 50000
5 Sai 27 Mumbai 27000


Consider the Order table with the following records -

OID Date CustomerID Amount
102 2019-10-08 00:00:00 3 3000
100 2019-10-08 00:00:00 3 1500
101 2019-11-20 00:00:00 2 1800
103 2018-05-20 00:00:00 4 2500


TEST CASE 1 :-Let us join these two tables using the INNER JOIN as follows

SELECT  ID, Name, Amount, Date
FROM Customer
INNER JOIN Order
ON Customer.ID = Order.CustomerID;


The result for the respective sql query is as follows βˆ’

ID Name Amount Date
3 Reyansh 3000 2019-10-08 00:00:00
3 Reyansh 1500 2019-10-08 00:00:00
2 Vivaan 1800 2019-11-20 00:00:00
4 Muhammad 2500 2018-05-20 00:00:00





Visit :


Discussion



* You must be logged in to add comment.

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
-1 OR 2+61-61-1=0+0+0+1 --

pHqghUme
-1 OR 3+61-61-1=0+0+0+1 --

pHqghUme
-1 OR 3*2<(0+5+61-61) --

pHqghUme
-1 OR 3*2>(0+5+61-61) --

pHqghUme
-1 OR 2+450-450-1=0+0+0+1

pHqghUme
-1 OR 3+450-450-1=0+0+0+1

pHqghUme
-1 OR 3*2<(0+5+450-450)

pHqghUme
-1 OR 3*2>(0+5+450-450)

pHqghUme
-1' OR 2+472-472-1=0+0+0+1 --

pHqghUme
-1' OR 3+472-472-1=0+0+0+1 --

pHqghUme
-1' OR 3*2<(0+5+472-472) --

pHqghUme
-1' OR 3*2>(0+5+472-472) --

pHqghUme
-1' OR 2+386-386-1=0+0+0+1 or 'odL1NPHc'='

pHqghUme
-1' OR 3+386-386-1=0+0+0+1 or 'odL1NPHc'='

pHqghUme
-1' OR 3*2<(0+5+386-386) or 'odL1NPHc'='

pHqghUme
-1' OR 3*2>(0+5+386-386) or 'odL1NPHc'='

pHqghUme
-1" OR 2+593-593-1=0+0+0+1 --

pHqghUme
-1" OR 3+593-593-1=0+0+0+1 --

pHqghUme
-1" OR 3*2<(0+5+593-593) --

pHqghUme
-1" OR 3*2>(0+5+593-593) --

pHqghUme
if(now()=sysdate(),sleep(15),0)

pHqghUme
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

pHqghUme
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

pHqghUme
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

pHqghUme
-1; waitfor delay '0:0:15' --

pHqghUme
-1); waitfor delay '0:0:15' --

pHqghUme
1 waitfor delay '0:0:15' --

pHqghUme
sOuyK4sU'; waitfor delay '0:0:15' --

pHqghUme
-5 OR 618=(SELECT 618 FROM PG_SLEEP(15))--

pHqghUme
-5) OR 771=(SELECT 771 FROM PG_SLEEP(15))--

pHqghUme
-1)) OR 126=(SELECT 126 FROM PG_SLEEP(15))--

pHqghUme
9kyj5aEc' OR 797=(SELECT 797 FROM PG_SLEEP(15))--

pHqghUme
j47X9zg0') OR 39=(SELECT 39 FROM PG_SLEEP(15))--

pHqghUme
Ph03Wi64')) OR 375=(SELECT 375 FROM PG_SLEEP(15))--

pHqghUme
555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

pHqghUme
555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

pHqghUme
1'"

pHqghUme

pHqghUme
@@mszpJ

pHqghUme
555

pHqghUme
555

pHqghUme
555