CREATE TABLE LEFTTABLE
(
ID INT ,
NAME NVARCHAR(50)
)
INSERT INTO LEFTTABLE VALUES(1,'MONU')
INSERT INTO LEFTTABLE VALUES(2,'SONU')
INSERT INTO LEFTTABLE VALUES(3,'SYAM')
INSERT INTO LEFTTABLE VALUES(4,'RAM')
CREATE TABLE RIGHTTABLE
(
ID INT ,
DEP NVARCHAR(50)
)
INSERT INTO RIGHTTABLE VALUES(1,'COMPUTER')
INSERT INTO RIGHTTABLE VALUES(2,'COMERCE')
SELECT L.ID ,NAME ,DEP FROM LEFTTABLE L left JOIN RIGHTTABLE R ON L.ID=R.ID
Out Put
(
ID INT ,
NAME NVARCHAR(50)
)
INSERT INTO LEFTTABLE VALUES(1,'MONU')
INSERT INTO LEFTTABLE VALUES(2,'SONU')
INSERT INTO LEFTTABLE VALUES(3,'SYAM')
INSERT INTO LEFTTABLE VALUES(4,'RAM')
CREATE TABLE RIGHTTABLE
(
ID INT ,
DEP NVARCHAR(50)
)
INSERT INTO RIGHTTABLE VALUES(1,'COMPUTER')
INSERT INTO RIGHTTABLE VALUES(2,'COMERCE')
SELECT L.ID ,NAME ,DEP FROM LEFTTABLE L left JOIN RIGHTTABLE R ON L.ID=R.ID
Out Put
ID
|
NAME
|
DEP
|
1
|
MONU
|
COMPUTER
|
2
|
SONU
|
COMERCE
|
3
|
SYAM
|
Null
|
4
|
RAM
|
Null
|
No comments :
Post a Comment