1.CREATE TABLE TEMP (
EMP_ID text,
EMP_LNAME text,
EMP_MI text,
EMP_FNAME text,
EMP_SEX text,
EMP_AGE number,
EMP_SALARY currency,
EMP_HIREDATE datetime,
DEPT_CODE text);
Save as :Query1-TABLE TEMP
2. ALTER TABLE TEMP
ADD PRIMARY KEY (EMP_ID);
Save as :Query2-ALTER & ADD PRIMARY KEY
3. INSERT INTO TEMP
SELECT TOP 3 * FROM EMPLOYEE;
Save as Query3-INSERT INTO TEMP
4. DELETE * FROM TEMP WHERE YEAR(EMP_HIREDATE)<2010;
Save as Query4-DELETE FROM TEMP
5. INSERT INTO TEMP
SELECT TOP * FROM EMPLOYEE;
Save as Query5- INSERT INTO & SELECT SUBQUERY
6. DROP TABLE TEMP;
Save as Query6-DROP TEMP
7. SELECT * FROM EMPLOYEE WHERE
EMP_HIREDATE>'2018-1-1';
Save as Query7-DATE & COMPARISON
8. SELECT * FROM EMPLOYEE WHERE EMP_MI IS NULL;
Save as Query8-MIDDLE INITIAL IS NULL
9. SELECT * FROM EMPLOYEE WHERE EMP_LNAME LIKE 'B%';
Save as Query9 –EMPLOYEES WITH LASTNAME BEGIN WITH B
10. SELECT * FROM EMPLOYEE WHERE EMP_LNAME=ADAMS';
Save as Query-EMPLOYEES LASTNAME IS ADAMS
11. SELECT * FROM EMPLOYEE WHERE DEPT_CODE
IN('CPTR','MATH');
Save as Query11-EMPLOYEES IN MATH & COMPUTER SCIENCE
12. SELECT EMP_LNAME,EMP_FNAME,EMP_AGE FROM EMPLOYEE ORDER BY
DESC;
Save as Query12-ORDER BY LASTNAME.
13. SELECT COUNT(EMP_ID) AS TOTAL_EMPLOYEE FROM EMPLOYEE;
Save as Query13-TOTAL_EMPLOYEE
14. SELECT AVG(EMP_AGE) AS AVERAGE_AGE FROM EMPLOYEE;
Save as Query14-AVERAGE AGE
15. SELECT EMP_FNAME,EMP_LNAME,EMP_SALARY FROM EMPLOYEE WHERE
EMP_SALARY=(select max(EMP_SALARY) from EMPLOYEE);
Save as Query15-HIGHEST PAY
16. SELECT EMP_FNAME,EMP_LNAME,EMP_SEX FROM EMPLOYEE GROUP BY
EMP_SEX;
Save as Query16-GROUP BY SEX
17. SELECT EMP_FNAME,EMP_LNAME,EMP_SEX FROM EMPLOYEE GROUP BY
EMP_SEX HAVING EMP_SEX='female';
ave as Query17-GROUP BY SEX FEMALES. Hint: include a HAVING
CLAUSE
18. SELECT EMPLOYEE.EMP_FNAME,
EMPLOYEE.EMP_LName,DEPARTMENT.DEPT_TITLE FROM EMPLOYEE
INNER JOIN DEPARTMENT ON
EMPLOYEE.DEPT_CODE=DEPARTMENT.DEPT_CODE;
Save as Query18- JOIN QUERY
19. SELECT * FROM EMPLOYEE WHERE EMP_AGE>30 AND
EMP_SEX='female';
Save as Query19-USING AND
20. SELECT * FROM EMPLOYEE WHERE DEPT_CODE
IN('BIOL','HIST','MATH','RELB') OR DEPT_CODE='CPTR';
Save as Query20-USING OR
Get Answers For Free
Most questions answered within 1 hours.