0% found this document useful (0 votes)
67 views5 pages

Scott SQL Script As Per Exercise2

Uploaded by

ajm
The document contains SQL statements that create a job_history table to store employee job details and a locations table to store location data. It then populates both tables with multiple INSERT statements providing sample data.

Copyright:

© All Rights Reserved

Available Formats

Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
67 views5 pages

Scott SQL Script As Per Exercise2

Uploaded by

ajm
The document contains SQL statements that create a job_history table to store employee job details and a locations table to store location data. It then populates both tables with multiple INSERT statements providing sample data.

Copyright:

© All Rights Reserved

Available Formats

Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 5

CREATE TABLE job_history

( employee_id NUMBER(6)
CONSTRAINT jhist_employee_nn NOT NULL
, start_date DATE
CONSTRAINT jhist_start_date_nn NOT NULL
, end_date DATE
CONSTRAINT jhist_end_date_nn NOT NULL
, job_id VARCHAR2(10)
CONSTRAINT jhist_job_nn NOT NULL
, department_id NUMBER(4)
, CONSTRAINT jhist_date_interval
CHECK (end_date > start_date)
) ;

INSERT INTO job_history


VALUES (102
, TO_DATE('13-JAN-1993', 'dd-MON-yyyy')
, TO_DATE('24-JUL-1998', 'dd-MON-yyyy')
, 'IT_PROG'
, 60);
INSERT INTO job_history
VALUES (101
, TO_DATE('21-SEP-1989', 'dd-MON-yyyy')
, TO_DATE('27-OCT-1993', 'dd-MON-yyyy')
, 'AC_ACCOUNT'
, 110);
INSERT INTO job_history
VALUES (101
, TO_DATE('28-OCT-1993', 'dd-MON-yyyy')
, TO_DATE('15-MAR-1997', 'dd-MON-yyyy')
, 'AC_MGR'
, 110);
INSERT INTO job_history
VALUES (201
, TO_DATE('17-FEB-1996', 'dd-MON-yyyy')
, TO_DATE('19-DEC-1999', 'dd-MON-yyyy')
, 'MK_REP'
, 20);
INSERT INTO job_history
VALUES (114
, TO_DATE('24-MAR-1998', 'dd-MON-yyyy')
, TO_DATE('31-DEC-1999', 'dd-MON-yyyy')
, 'ST_CLERK'
, 50
);
INSERT INTO job_history
VALUES (122
, TO_DATE('01-JAN-1999', 'dd-MON-yyyy')
, TO_DATE('31-DEC-1999', 'dd-MON-yyyy')
, 'ST_CLERK'
, 50
);
INSERT INTO job_history
VALUES (200
, TO_DATE('17-SEP-1987', 'dd-MON-yyyy')
, TO_DATE('17-JUN-1993', 'dd-MON-yyyy')
, 'AD_ASST'
, 90
);
INSERT INTO job_history
VALUES (176
, TO_DATE('24-MAR-1998', 'dd-MON-yyyy')
, TO_DATE('31-DEC-1998', 'dd-MON-yyyy')
, 'SA_REP'
, 80
);
INSERT INTO job_history
VALUES (176
, TO_DATE('01-JAN-1999', 'dd-MON-yyyy')
, TO_DATE('31-DEC-1999', 'dd-MON-yyyy')
, 'SA_MAN'
, 80
);
INSERT INTO job_history
VALUES (200
, TO_DATE('01-JUL-1994', 'dd-MON-yyyy')
, TO_DATE('31-DEC-1998', 'dd-MON-yyyy')
, 'AC_ACCOUNT'
, 90
);

CREATE TABLE locations


( location_id NUMBER(4)
, street_address VARCHAR2(40)
, postal_code VARCHAR2(12)
, city VARCHAR2(30)
CONSTRAINT loc_city_nn NOT NULL
, state_province VARCHAR2(25)
, country_id CHAR(2)
) ;

INSERT INTO locations VALUES


( 1000
, '1297 Via Cola di Rie'
, '00989'
, 'Roma'
, NULL
, 'IT'
);
INSERT INTO locations VALUES
( 1100
, '93091 Calle della Testa'
, '10934'
, 'Venice'
, NULL
, 'IT'
);
INSERT INTO locations VALUES
( 1200
, '2017 Shinjuku-ku'
, '1689'
, 'Tokyo'
, 'Tokyo Prefecture'
, 'JP'
);
INSERT INTO locations VALUES
( 1300
, '9450 Kamiya-cho'
, '6823'
, 'Hiroshima'
, NULL
, 'JP'
);
INSERT INTO locations VALUES
( 1400
, '2014 Jabberwocky Rd'
, '26192'
, 'Southlake'
, 'Texas'
, 'US'
);
INSERT INTO locations VALUES
( 1500
, '2011 Interiors Blvd'
, '99236'
, 'South San Francisco'
, 'California'
, 'US'
);
INSERT INTO locations VALUES
( 1600
, '2007 Zagora St'
, '50090'
, 'South Brunswick'
, 'New Jersey'
, 'US'
);
INSERT INTO locations VALUES
( 1700
, '2004 Charade Rd'
, '98199'
, 'Seattle'
, 'Washington'
, 'US'
);
INSERT INTO locations VALUES
( 1800
, '147 Spadina Ave'
, 'M5V 2L7'
, 'Toronto'
, 'Ontario'
, 'CA'
);
INSERT INTO locations VALUES
( 1900
, '6092 Boxwood St'
, 'YSW 9T2'
, 'Whitehorse'
, 'Yukon'
, 'CA'
);
INSERT INTO locations VALUES
( 2000
, '40-5-12 Laogianggen'
, '190518'
, 'Beijing'
, NULL
, 'CN'
);
INSERT INTO locations VALUES
( 2100
, '1298 Vileparle (E)'
, '490231'
, 'Bombay'
, 'Maharashtra'
, 'IN'
);
INSERT INTO locations VALUES
( 2200
, '12-98 Victoria Street'
, '2901'
, 'Sydney'
, 'New South Wales'
, 'AU'
);
INSERT INTO locations VALUES
( 2300
, '198 Clementi North'
, '540198'
, 'Singapore'
, NULL
, 'SG'
);
INSERT INTO locations VALUES
( 2400
, '8204 Arthur St'
, NULL
, 'London'
, NULL
, 'UK'
);
INSERT INTO locations VALUES
( 2500
, 'Magdalen Centre, The Oxford Science Park'
, 'OX9 9ZB'
, 'Oxford'
, 'Oxford'
, 'UK'
);
INSERT INTO locations VALUES
( 2600
, '9702 Chester Road'
, '09629850293'
, 'Stretford'
, 'Manchester'
, 'UK'
);
INSERT INTO locations VALUES
( 2700
, 'Schwanthalerstr. 7031'
, '80925'
, 'Munich'
, 'Bavaria'
, 'DE'
);
INSERT INTO locations VALUES
( 2800
, 'Rua Frei Caneca 1360 '
, '01307-002'
, 'Sao Paulo'
, 'Sao Paulo'
, 'BR'
);
INSERT INTO locations VALUES
( 2900
, '20 Rue des Corps-Saints'
, '1730'
, 'Geneva'
, 'Geneve'
, 'CH'
);
INSERT INTO locations VALUES
( 3000
, 'Murtenstrasse 921'
, '3095'
, 'Bern'
, 'BE'
, 'CH'
);
INSERT INTO locations VALUES
( 3100
, 'Pieter Breughelstraat 837'
, '3029SK'
, 'Utrecht'
, 'Utrecht'
, 'NL'
);
INSERT INTO locations VALUES
( 3200
, 'Mariano Escobedo 9991'
, '11932'
, 'Mexico City'
, 'Distrito Federal,'
, 'MX'
);

You might also like