CREATE TABLE EMP (EMPNO NUMBER(4) PRIMARY KEY,ENAME VARCHAR2(10),JOB VARCHAR2(9),MGR NUMBER(4),HIREDATE DATE,SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO NUMBER(2)); Insert the values
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7369, 'SMITH', 'CLERK', 7902, '17-DEC-80', 800, NULL, 20);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7499, 'ALLEN', 'SALESMAN', 7698, '20-FEB-81', 1600, 300, 30);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7521, 'WARD', 'SALESMAN', 7698, '22-FEB-81', 1250, 500, 30);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7566, 'JONES', 'MANAGER', 7839, '02-APR-81', 2975, NULL, 20);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7654, 'MARTIN', 'SALESMAN', 7698, '28-SEP-81', 1250, 1400, 30);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7698, 'BLAKE', 'MANAGER', 7839, '01-MAY-81', 2850, NULL, 30);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7782, 'CLARK', 'MANAGER', 7839, '09-JUN-81', 2450, NULL, 10);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7788, 'SCOTT', 'ANALYST', 7566, '19-APR-87', 3000, NULL, 20);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7839, 'KING', 'PRESIDENT', NULL, '17-NOV-81', 5000, NULL, 10);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7844, 'TURNER', 'SALESMAN', 7698, '08-SEP-81', 1500, 0, 30);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7876, 'ADAMS', 'CLERK', 7788, '23-MAY-87', 1100, NULL, 20);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7900, 'JAMES', 'CLERK', 7698, '03-DEC-81', 950, NULL, 30);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7902, 'FORD', 'ANALYST', 7566, TO_DATE('03-DEC-81', 'DD-MON-RR'), 3000, 20, 20);
INSERT INTO EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) VALUES (7934, 'MILLER', 'CLERK', 7782, TO_DATE('23-JAN-82', 'DD-MON-RR'), 1300, 10, 10); Create department table
CREATE TABLE DEPT (DEPTNO NUMBER(2) PRIMARY KEY,DNAME VARCHAR2(14),LOC VARCHAR2(13)); Insert the values in the department table
INSERT INTO DEPT (DEPTNO, DNAME, LOC) VALUES (10, 'ACCOUNTING', 'NEW YORK');
INSERT INTO DEPT (DEPTNO, DNAME, LOC) VALUES (20, 'RESEARCH', 'DALLAS');
INSERT INTO DEPT (DEPTNO, DNAME, LOC) VALUES (30, 'SALES', 'CHICAGO');
INSERT INTO DEPT (DEPTNO, DNAME, LOC) VALUES (40, 'OPERATIONS', 'BOSTON'); Q1) List the name of the employees whose salary is greater than that of employee with empno 7566.
![271338255-4da768df-84f3-4a8c-85aa-1e184b5d672c](https://private-user-images.githubusercontent.com/119576222/272457476-3fe4e079-e157-4da2-a4e7-c1e74cd3b51d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF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lhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNzYzOWY1MDU1MWEyYzA1ZjIxMzBiNGIyMTRhNDUzOGMwMzEyYWQ4ZjdmNzYxZjM4MmYxMWE1MWJlZGRhZGU4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.mRYwzb3yjaX3u9krI_Pxj1t1CWSXlpP4p9Jw72fN2kw)
Q2) List the ename,job,sal of the employee who get minimum salary in the company.
![271338751-e9647973-af79-4a1e-a179-7b284c225d0b](https://private-user-images.githubusercontent.com/119576222/272457381-01126c2e-9cd5-45e9-89fe-8bb5dd30bca0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU3MzgxLTAxMTI2YzJlLTljZDUtNDVlOS04OWZlLThiYjVkZDMwYmNhMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00YTdkOGUxNzVlMmRjYzgxZWFiNDU2NjIxMDhmMDk4OTIyYTA4YTZiYzc5N2UzZTI1NTgzYjBkOWI5YTg0YzAxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9._3_Q6lE90dQWTfwcS7Px2XoEQXeeiuDgta4bMO7UCOo)
![271338909-6235cc68-e4dd-4965-a696-d94b63b9adfa](https://private-user-images.githubusercontent.com/119576222/272457372-16d72628-c23c-451d-a36a-4fb71616869a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU3MzcyLTE2ZDcyNjI4LWMyM2MtNDUxZC1hMzZhLTRmYjcxNjE2ODY5YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNWRjNjk1NjA5MzJjYmNlNjc4ODk0MjU0YjFkMjQyNjc2MzE2YzhmMGZkOWMwZjJlNmJiMzRjYWFlYmZlMDM3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.p8XabLWaTsRUUFY1_UuFw0nibZ23VSTHvMiDraKuyx0)
Q3) List ename, job of the employees who work in deptno 10 and his/her job is any one of the job in the department ‘SALES’.
![271339101-af237eb7-efb2-4a04-8e0b-d6b8997ce0da](https://private-user-images.githubusercontent.com/119576222/272457283-b5264329-421c-4321-b81a-c6429fe6b303.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU3MjgzLWI1MjY0MzI5LTQyMWMtNDMyMS1iODFhLWM2NDI5ZmU2YjMwMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZmRjNTNjOGMzYTFlNjFhY2EwMTFmZTQyZjk4ZjY0MWExNDk0ZGVkMDI5ZTc1ZTY1MmJiZjYyMWFlMDM2ODdiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.kpo5doKA1AhKf5rJtppZ9_NkUuVNGgF_Rz4wlDrHltY)
![271339283-70e7db53-9cee-417f-b12c-32e3d1438b92](https://private-user-images.githubusercontent.com/119576222/272457266-52cb72ee-9ef1-4038-b84f-01a583b1335f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU3MjY2LTUyY2I3MmVlLTllZjEtNDAzOC1iODRmLTAxYTU4M2IxMzM1Zi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02YTY4NTlhZmJhZTg3ZTU5MmFmMzkzM2E1NTlkMjI0YjdmZWYzYjJkMDMwZjczOWJhMTIwZmU3MDFiZTE2MzEwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.MPr6KRWg5peLdpEhqhHDDiZHMzT1cYYZofVJy5v9HhY)
Q4) Create a view empv5 (for the table emp) that contains empno, ename, job of the employees who work in dept 10.
![271339490-4d60f20e-18a0-432a-abfd-0da8334b07e9](https://private-user-images.githubusercontent.com/119576222/272457170-a505a1d4-6470-4c47-9531-d851267f2a7b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU3MTcwLWE1MDVhMWQ0LTY0NzAtNGM0Ny05NTMxLWQ4NTEyNjdmMmE3Yi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3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cG9faWQ9MCJ9.ZktR4wle4mHy9nDXf-m6xrqtbDX7kFRNWxJ32R3KAB4)
Q5) Create a view with column aliases empv30 that contains empno, ename, sal of the employees who work in dept 30. Also display the contents of the view.
![271339811-0210d44a-5c6d-4ff6-a2b3-9f0ef1be5cf3](https://private-user-images.githubusercontent.com/119576222/272457066-90b773f9-6994-4bbc-95c2-501fbf0a57ab.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU3MDY2LTkwYjc3M2Y5LTY5OTQtNGJiYy05NWMyLTUwMWZiZjBhNTdhYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hNGMzYWRmNTY4YTgxNDVkNDE0OWVhMjU1MGYyOWQyZDhlNWIzNmIzMjRlZWM4ZWY3YmEyZDk4ZjA4MzRlZTNlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Y8bwkGDmGjnURSzcMKAnylaqRT22DtiGVY8zbtLFPY4)
![271340001-d792f018-fd12-4b38-a976-23eec0c0d416](https://private-user-images.githubusercontent.com/119576222/272457042-6d9e6383-9e5d-4117-bc01-9c4dab9cbd81.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU3MDQyLTZkOWU2MzgzLTllNWQtNDExNy1iYzAxLTljNGRhYjljYmQ4MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zODVmZTAyY2NmZWM0N2VmYTY2NWRhOGQ1YWMxMzgxYTRlODc3YTg2MGI2Njg1MjEwNjkwZTQ0NmE3MGJkZTRhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.K6ucB3fCa4VKj1xHgPiwPhLapxJYpAyUHiD6q79DkqI)
Q6) Update the view empv5 by increasing 10% salary of the employees who work as ‘CLERK’. Also confirm the modifications in emp table
![271340210-da284c6e-6627-4237-a92a-69e5d8fdc09f](https://private-user-images.githubusercontent.com/119576222/272456957-640f7795-b219-4ba7-af75-107a11884ebb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU2OTU3LTY0MGY3Nzk1LWIyMTktNGJhNy1hZjc1LTE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pZ25hdHVyZT1hYmRlNzUwYzM1MjlkZmRiMjExMTRjYjc0Y2QyOWY0OWE2NTc3YjM5NGFkNDU5OTU0ZThiNWE3ZWQzZmRjNDM3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.trPIPNdhaOkaF5H_xRvXOuu75CzPhESqfuQn9ei4HPw)
CREATE TABLE Customer1 (customer_id INT,cust_name VARCHAR(20),city VARCHAR(20),grade INT,salesman_id INT); Inserting Values to the Table
INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3002, 'Nick Rimando', 'New York', 100, 5001); INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3007, 'Brad Davis', 'New York', 200, 5001); INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3005, 'Graham Zusi', 'California', 200, 5002); INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3008, 'Julian Green', 'London', 300, 5002); INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3004, 'Fabian Johnson', 'Paris', 300, 5006); INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3009, 'Geoff Cameron', 'Berlin', 100, 5003); INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3003, 'Jozy Altidor', 'Moscow', 200, 5007); INSERT INTO Customer1 (customer_id, cust_name, city, grade, salesman_id) VALUES(3001, 'Brad Guzan', 'London', NULL, 5005); Create a Salesperson1 table
CREATE TABLE Salesman1 (salesman_id INT,name VARCHAR(20),city VARCHAR(20),commission DECIMAL(4,2)); Inserting Values to the Table
INSERT INTO Salesman1 (salesman_id, name, city, commission) VALUES(5001, 'James Hoog', 'New York', 0.15); INSERT INTO Salesman1 (salesman_id, name, city, commission) VALUES(5002, 'Nail Knite', 'Paris', 0.13); INSERT INTO Salesman1 (salesman_id, name, city, commission) VALUES(5005, 'Pit Alex', 'London', 0.11); INSERT INTO Salesman1 (salesman_id, name, city, commission) VALUES(5006, 'Mc Lyon', 'Paris', 0.14); INSERT INTO Salesman1 (salesman_id, name, city, commission) VALUES(5007, 'Paul Adam', 'Rome', 0.13); INSERT INTO Salesman1 (salesman_id, name, city, commission) VALUES(5003, 'Lauson Hen', 'San Jose', 0.12); Q7) Write a SQL query to find the salesperson and customer who reside in the same city. Return Salesman, cust_name and city.
![271340967-c452ad5c-1a03-4b96-acc6-9262689b0174](https://private-user-images.githubusercontent.com/119576222/272456848-c7c7b8d9-7579-4742-8e74-7f49f2cc34ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU2ODQ4LWM3YzdiOGQ5LTc1NzktNDc0Mi04ZTc0LTdmNDlmMmNjMzRlZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01NGZmMGFiNDI4MGVkNjlkOTZjYzZjNjk2MDkxMzExN2JiZDhlMWQ2Y2JkNThhY2EwNDZjYWFkMTFmOWRhMGEwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.L-WAz5dtin7XZ_151lt8uJNzcLozUgGMgSyz8S7Ecxc)
![271341099-307dd60f-ef3c-400a-b8b1-ee64b7ed2c29](https://private-user-images.githubusercontent.com/119576222/272456793-81b3b74b-94ad-4d9d-b077-49f7613e133f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU2NzkzLTgxYjNiNzRiLTk0YWQtNGQ5ZC1iMDc3LTQ5Zjc2MTNlMTMzZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yMDQzOWQ3NzMwYzJiMDU5MTcwMjM2Yjg4MjlhNDlhYmZhYzE5ZGE5MTJlNGJlMTNhODQ2ZmUxYzQ3YzZkNzM1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.mzI6DAnqYCa0oWUbrGGgtIpc2dfWSekHvfqg8blwCmc)
Q8) Write a SQL query to find salespeople who received commissions of more than 13 percent from the company. Return Customer Name, customer city, Salesman, commission.
![271341282-2c628085-5574-43fc-8864-3d4752eb3663](https://private-user-images.githubusercontent.com/119576222/272456727-4cfeb22e-6e60-4568-bbdb-2702e0b70fff.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvb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RaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lYzk0MDRiMDhjOGM2OWQ4ZjU3OWVjYTM3NzE0NzAzMTA0ZGVmNzVhN2E0MGEyZDRiMDMxM2E1MGEzNWNkY2Q0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Fzbyzi4jj7_q3EzWlXKLLJDRaBNW3qevubGlYV5NHCI)
Q9) Perform Natural join on both tables
![271341692-1c7bdf18-bebd-47be-93a8-83e026886801](https://private-user-images.githubusercontent.com/119576222/272456634-63b455ed-44c3-4d01-b573-6e60b3ab9353.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU2NjM0LTYzYjQ1NWVkLTQ0YzMtNGQwMS1iNTczLTZlNjBiM2FiOTM1My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hMDZiMWExMTJiODkxNTU4MmE1NGQ0NWE1NjJhNDA4OWY2NDY1YTI3NWRlNzU4ODgxM2RhMzM2YTY3ZTUwY2NhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9._at8sLuw4CQZj6D-7lLbNvlxeGYV8zutGORqnLZ0qhA)
![271341834-5a33d1e3-333d-4d16-8d72-cf9243281678](https://private-user-images.githubusercontent.com/119576222/272456582-df0db24e-abf9-417d-9a36-dffa29ff931c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyNzIwNjYsIm5iZiI6MTcyNTI3MTc2NiwicGF0aCI6Ii8xMTk1NzYyMjIvMjcyNDU2NTgyLWRmMGRiMjRlLWFiZjktNDE3ZC05YTM2LWRmZmEyOWZmOTMxYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kN2RmMDhlNjFhNTVlZDM3OGJhM2ZmN2Q0Zjc5NWUwMjQ4ODc2ZmQyMmYyNTEyNDg5MDEwM2I3NDU0MGUwZjUwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.r2715QD875JD3Gbjai8iVWpGXDhHYPDIipd7BiLzozg)
Q10) Perform Left and right join on both tables
![271342626-c6736840-cc86-42ea-9b1c-3b0004d8bc02](https://private-user-images.githubusercontent.com/119576222/272456507-f14b8e64-88e0-4783-85e0-0ff6369a2e99.png?jwt=eyJhbGciOiJIUzI1N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XotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMlQxMDA5MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lYzI2NzE1OTgyNmU5ZmRiNjE2MWVkNTc1YTM5YTNlMzA0YmZlYmUxNDI0ZTJlOGM5MTY3YmVjNmNjNzAxZjdiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.oT-uOgTTGrVOGsnPb8Fr5P3J7LB2fFiW6oDTVrjM-as)
The program to create SubQueries, Views and Joins in SQL has been executed successfully.