Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can anyone explain about join?

Answers were Sorted based on User's Feedback



Can anyone explain about join?..

Answer / sekar

SQL JOIN:

type of join

1.cross join
Ans :
cross join not support where clause.
The size of cartesian product result set is number
of row in first table multiplied by number of row in second
table.

2.inner join
Ans: Inner join is used to retrive the matching record
first and second table.

3.self join
Ans:Self join is used to retrive matching record in same
table.

4.right outer join
Ans:right outer join is used to return the all the value of
second table and plus matching record(innerjoin) of both
table.

5.left outer join
Ans:left outer join is used to return the all the value of
first table and plus matching record(innerjoin) of both
table.

6 full outer join

Example:
<?php
$con = mysql_connect("localhost","root","") or die ("could
not connet".mysql_error());
$db = mysql_select_db("sekar",$con) or die ("could not
connet".mysql_error());
//$sql = mysql_query("create table emp2(eno int(4) not null
auto_increment primary key, ename varchar(20), sal int
(10))") or die ("could not connet".mysql_error());
//$record = mysql_query("insert into std2(sno, sname, mark)
values (4, 'krish', 100)") or die("could not
add".mysql_error());
//$record = mysql_query("insert into emp2(eno, ename, sal)
values (4, 'kanna', 10000)") or die("could not
add".mysql_error());
/*cross join
$query = "select * from std2, emp2";
$query = "select s.sname, s.mark, e.ename,e.sal from std2
s,emp2 e";
*/
/*inner join
$query = "select s.sname, s.mark, e.ename,e.sal from std2 s
inner join emp2 e on(s.sname= e.ename)";
*/
/*self join
$query = "select s.sname, s.mark, e.sname from std2 s join
std2 e on(s.sname= e.sname)";
*/
/*Right outer join
$query = "select s.sname, s.mark, e.ename,e.sal from std2 s
left outer join emp2 e on(s.sname= e.ename)";
*/
/*Right outer join
$query = "select s.sname, s.mark, e.ename,e.sal from std2 s
right outer join emp2 e on(s.sname= e.ename)";
*/
//full outer join
$query = "select s.sname, s.mark, e.ename,e.sal from std2 s
join emp2 e on(s.sname= e.ename)";

$result= mysql_query($query) or die("could not
select".mysql_error());
echo "<table border='1' cellpadding='0' cellspacing='0'
width='700'>";
while($rec = mysql_fetch_array($result))
{
$sno = $rec[sno];
$sname = $rec[sname];
$mark = $rec[mark];
$eno = $rec[eno];
$ename = $rec[ename];
$sal = $rec[sal];
echo "<tr><td>$sno</td><td>$sname</td><td>$mark</td>
<td>$eno</td><td>$ename</td><td>$sal</td></tr>";
}
echo "</table>";
echo "sucess"
?>

Is This Answer Correct ?    13 Yes 1 No

Can anyone explain about join?..

Answer / vipin gurjar

join :- when we want to fetch the records from more then
two tables which r interlinked then we use the joins to
fetch a proper result. Joins query depends on that what
type of result we want.

there are many types of join like
1)Inner join 2)left join 3) Outer Join 4)Simple Join

example of these are as follows:-

Is This Answer Correct ?    8 Yes 1 No

Can anyone explain about join?..

Answer / guest

join is basically use to join b/w tables;

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More PHP Interview Questions

How to access a global variable inside a function?

0 Answers  


How come the code works, but doesn’t for two-dimensional array of mine?

0 Answers  


What is the function file_get_contents() useful for?

0 Answers  


what is benefit of magento?

0 Answers  


Tell me what is the use of isset() in php?

0 Answers  


What is inheritance in php? How many types of inheritance supports php?

0 Answers  


What is the maximum size of a table in mysql?

0 Answers  


How i can integrate merchant payment get way in zen cart? in php? plz help me

1 Answers   BA Continnum Solutions,


What is meant by pdo in php?

0 Answers  


Which php framework is best for web development?

0 Answers  


How to get seconds from current date using date function ?

8 Answers   Sarna Technologies, Satyam,


What is exception in php?

4 Answers  


Categories