Joins
TABLE1.CREATE
TABLE EMP(EMPNO INT(10) PRIMARY KEY, ENAME VARCHAR(20), SAL FLOAT(10,2),DEPTNO
INT(2));
TABLE2.
CREATE TABLE DEPT(DEPTNO INT(2) PRIMARY KEY,DNAME VARCHAR(20), LOC
VARCHAR(20));
TABLE1:
INSERT
INTO EMP(EMPNO,ENAME,SAL,DEPTNO)
VALUES(101,’CHANDU’,123.45,10),(102,’KARANAM’,124.34,20),(103,’ASWINI’,145.23,10);
TABLE2:INSERT
INTO DEPT(DEPTNO,DNAME,LOC)
VALUES(10,’TECHNICAL’,’HYD’),(20,’ACCOUNTS’,’CHANNAI’);
SELECT E.EMPNO ,
E.ENAME,E.ESAL,E.DEPTNO,D.DNAME,D.LOC FROM EMP E , DEPT D WHERE E.DEPTNO =
D.DEPTNO;
0 comments:
Post a Comment