SQL Tables and Queries
SQL Tables and Queries
-
INSERT INTO EmpSalary VALUES
(101, 2000, 'Yes'),
(102, 10000, 'Yes'),
(103, 5000, 'No'),
(104, 1900, 'Yes'),
(105, 2300, 'Yes');
-- 1. Select the detail of the employee whose name starts with 'P'.
SELECT * FROM Employee WHERE EmpName LIKE 'P%';
-- 3. Select the details of employees who work either for department E-104 or E-102.
SELECT * FROM Employee WHERE Department IN ('E-104', 'E-102');
-- 5. List the names of all employees whose names end with 'a'.
SELECT EmpName FROM Employee WHERE EmpName LIKE '%a';
-- 10. How many projects started and finished in the same year?
SELECT COUNT(*) FROM EmpProject WHERE StartYear = EndYear;