Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011
    Posts
    1

    Unanswered: Oracle table creation/script help

    Having a hard time running my script. Essentially I have to create a few table entries into the 3 tables shown in my E/R Diagram and create the "Personnel Emergency Vehicle Shelter" table using the primary keys from the other three tables as a foreign key.

    http://imageshack.us/photo/my-images...amicenies.png/

    notepad+ doesn't have anything for Oracle only SQL.


    drop table emergency_vehicle;

    create table emergency_vehicle(
    emergency_vehicle_ID varchar2(8) primary key,
    emergency_vehicle_plate varchar2(8),
    emergency_vehicle_registered_owner varchar2(50),
    emergency_vehicle_make varchar2(50),
    emergency_vehicle_model varchar2(50),
    );

    insert into emergency_vehicle values
    ('veh00001','ABA12345','General Hospital','FORD','E-350');

    insert into emergency_vehicle values
    ('veh00002','ANA56844','General Hospital','FORD','E-350');

    insert into emergency_vehicle values
    ('veh00003','TEST8408','City Fire Department','MACK','Model 95');

    insert into emergency_vehicle values
    ('veh00004','EMRGNCEE','City Police Department','Dodge','Charger');

    select * from emergency_vehicle;


    drop table shelter;

    create table shelter(
    shelter_ID varchar2(8) primary key,
    shelter_location varchar2(100),
    shelter_description varchar2(50),
    );

    insert into shelter values
    ('she00001','1660 Main Street','This is the General hospital for the city');

    insert into shelter values
    ('she00002',’100 Wayne Drive’,’Red Cross location #808’);

    insert into shelter values
    ('she00003',’3000 Jefferson Place’,’Red Cross shelter #321’);

    select * from shelter;


    drop table first_responders;

    create table first_responders(
    first_responder_ID varchar2(8) primary key,
    first_responder_name varchar2(50),
    first_responder_function varchar2(50),
    );

    insert into first_responders values
    ('FRP00001',’Jack Smith’,’EMT’);

    insert into first_responders values
    ('FRP00002',’Officer Kimble’,’Police Officer’);

    insert into first_responders values
    ('FRP00003',’John Matthews’,’Firemen’);

    select * from first_responder;
    Attached Thumbnails Attached Thumbnails Dynamic Entities.bmp  

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >notepad+ doesn't have anything for Oracle only SQL.
    Why does this matter. SQL source files are plain, vanilla text files that any text editor can change!

    Code:
     
    SQL> create table emergency_vehicle(
      2  emergency_vehicle_ID varchar2(8) primary key,
      3  emergency_vehicle_plate varchar2(8),
      4  emergency_vehicle_registered_owner varchar2(50),
      5  emergency_vehicle_make varchar2(50),
      6  emergency_vehicle_model varchar2(50),
      7  );
    emergency_vehicle_registered_owner varchar2(50),
    *
    ERROR at line 4:
    ORA-00972: identifier is too long
    SQL object names are limited to 30 characters.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Code:
    SQL> @shelter
    SQL> drop table shelter;
    
    Table dropped.
    
    SQL> create table shelter(
      2  shelter_ID varchar2(8) primary key,
      3  shelter_location varchar2(100),
      4  shelter_description varchar2(50)
      5  );
    
    Table created.
    
    SQL> insert into shelter values ('she00001','1660 Main Street','This is the General hospital for the city');
    
    1 row created.
    
    SQL> select count(*) from shelter;
    
      COUNT(*)
    ----------
    	 1
    
    SQL> insert into shelter values ('she00002','100 Wayne Drive','Red Cross location #808');
    
    1 row created.
    
    SQL> select count(*) from shelter;
    
      COUNT(*)
    ----------
    	 2
    
    SQL> insert into shelter values ('she00003','3000 Jefferson Place','Red Cross shelter #321');
    
    1 row created.
    
    SQL> select count(*) from shelter;
    
      COUNT(*)
    ----------
    	 3
    
    SQL> 
    SQL>
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •