SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE emp ( EMPNO INT PRIMARY KEY, ENAME VARCHAR(50), JOB VARCHAR(50), MGR INT, HIREDATE DATE, SAL DECIMAL(10, 2), COMM DECIMAL(10, 2), DEPTNO INT ); INSERT INTO emp (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7369, 'Raj', 'CLERK', 7902, '2005-12-17', 800, NULL, 20), (7499, 'Amit', 'SALESMAN', 7698, '2006-02-20', 1600, 300, 30), (7521, 'Suresh', 'SALESMAN', 7698, '2006-02-22', 1250, 500, 30), (7566, 'Ravi', 'MANAGER', 7839, '2006-04-02', 2975, NULL, 20), (7654, 'Vikram', 'SALESMAN', 7698, '2006-09-28', 1250, 1400, 30), (7698, 'Anil', 'MANAGER', 7839, '2006-05-01', 2850, NULL, 30), (7782, 'Manoj', 'MANAGER', 7839, '2006-06-09', 2450, NULL, 10), (7788, 'Arjun', 'ANALYST', 7566, '2007-12-09', 3000, NULL, 20), (7839, 'Vivek', 'PRESIDENT', NULL, '2006-11-17', 5000, NULL, 10), (7844, 'Sunil', 'SALESMAN', 7698, '2006-09-08', 1500, 0, 30), (7876, 'Prakash', 'CLERK', 7788, '2008-01-12', 1100, NULL, 20), (7900, 'Dinesh', 'CLERK', 7698, '2006-12-03', 950, NULL, 30), (7902, 'Naveen', 'ANALYST', 7566, '2006-12-03', 3000, NULL, 20), (7934, 'Rohan', 'CLERK', 7782, '2007-01-23', 1300, NULL, 10); CREATE TABLE dept ( DEPTNO INT PRIMARY KEY, DNAME VARCHAR(50), LOC VARCHAR(50) ); INSERT INTO dept (DEPTNO, DNAME, LOC) VALUES (10, 'ACCOUNTING', 'Mumbai'), (20, 'RESEARCH', 'Bangalore'), (30, 'SALES', 'Delhi'), (40, 'OPERATIONS', 'Chennai'); Select * from EMP; Select * from dept; create view V as select ename,job,sal from emp where job = 'CLERK' SELECT e.EMPNO, e.ENAME, e.JOB, e.SAL, e.DEPTNO FROM emp e INNER JOIN V v ON e.ENAME = v.ENAME AND e.JOB = v.JOB AND e.SAL = v.SAL;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear