Mysql inner join,Sql server inner join

An MYSQL JOIN clause is used to combine rows from two or more tables,

based on a common field

INNER JOIN:

Returns all rows when there is at least one match in BOTH tables


Syntex:

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;


Examples

SELECT Code,City,StateCode FROM city


Table 1

select Code,State,CountryCode from state;

Table 2


SELECT Code,Country FROM country


table 3

INNER JOIN

  select City,State,Country from city C 
  inner Join State S on S.Code=c.StateCode
  Inner Join Country CO on CO.Code=s.CountryCode


Result

Post a Comment

0 Comments