Need help with Oracle 10g

Discussion in 'Databases' started by pcbro34, Jan 1, 2013.

  1. #1
    Hi

    Can someone please help me generate SQL for this question.

    Create EMPLOYEES_2 table based on the structure of EMPLOYEES table. Include only the employee_id, initial of the first name, last name, last 4 digits of the phone number, salary divided by 2, and department_id. Name the colums as follows, ID, INITIAL, SURNAME, PHONE EXTENSION, SALARY, DEPARTMENT.

    any help is greatly appreciated.
     
    pcbro34, Jan 1, 2013 IP
  2. Peetter123

    Peetter123 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    hi,
    If you want to create a database table then the syntax for creating is
    Create table EMPLOYEES_2(ID number(3),INITIAL varchar2(10),SURNAME varchar2(20),PHONE_EXTENION number(3),SALARY number(5,3), DEPARTMENT varchar2(20);
     
    Peetter123, Jan 5, 2013 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    More like

    Create table EMPLOYEES_2(ID number(3),INITIAL varchar2(1),SURNAME varchar2(20),PHONE_EXTENSION varchar2(4),SALARY number(5,3), DEPARTMENT varchar2(20);

    The extension has to be 4 characters (the number 0012 is stored as 12 if it's a number), and the initial is a single character. (The ID may need a larger number - it depends on how many employees there may ever be.)
     
    Rukbat, Jan 5, 2013 IP