Top Banner

of 13

SQL Statement - Week 3

Jun 02, 2018

Download

Documents

Zaid Buttercup
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/11/2019 SQL Statement - Week 3

    1/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 1

    a) Create table DEPT and EMP

    b) Insert values into tables

  • 8/11/2019 SQL Statement - Week 3

    2/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 2

  • 8/11/2019 SQL Statement - Week 3

    3/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 3

    c) List of all details of department

    d) List salaries of all employees, showing only employee number & salary

  • 8/11/2019 SQL Statement - Week 3

    4/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 4

    e) List all employees with salary more than $2900

    f) List all departments with department number 20 or 40

    g) List all employeesname with alphabet i as 2ndcharacter.

  • 8/11/2019 SQL Statement - Week 3

    5/13

  • 8/11/2019 SQL Statement - Week 3

    6/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 6

    k) Produce employeesname with the biggest salary

    l) Produce average salary for Salesman job

    m) List employees name and its position who working for the 1stdate.

  • 8/11/2019 SQL Statement - Week 3

    7/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 7

    n) List all employeesdetails which occur during 1982.

    o) List employeesname and its position who working at last date

    p)

    List all employeesdetails which notoccur in 1980

  • 8/11/2019 SQL Statement - Week 3

    8/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 8

    q) List all employeesname with alphabet j as 1stcharacter

    r) List all employees nameand its position where manager employees number is null

    s) Find number of employees as currently working

  • 8/11/2019 SQL Statement - Week 3

    9/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 9

    t) List all employeesname and salaries, ordered by salary descending

    u) List all difference designations in the company

  • 8/11/2019 SQL Statement - Week 3

    10/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 10

    v) List all current salaries in range $2000 to $ 3000, list their empNo, employee name and its

    salaries descending.

    w)

    List all employees name, job, department number, where its department number is 20, 30 and

    40 using INcommands

  • 8/11/2019 SQL Statement - Week 3

    11/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 11

    x) List all employee names, job, department number where its department number is not 20,30

    and 40 using NOT INcommand.

    y) List all the employee names that have name J as 1stcharacter ands as last character (single

    name)

    z)

    List all employees namethat have alphabet M as 1stcharacter ors as last character

  • 8/11/2019 SQL Statement - Week 3

    12/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 12

    aa) List all employeesname and its correspondingly uppercase.

    bb)Update salary for President into 20% increase than current salary

  • 8/11/2019 SQL Statement - Week 3

    13/13

    SQL STATEMENT WEEK 3

    Muhamad Zaid Bin Amirudin UK27719 13

    cc) Update hiredate for employee number 7943 into 24/12/82 using yyyy-mm-ddformat.

    Displays new hiredate and employee number that corresponding it.

    dd)Drop table employee and departmnet using SQL commands.