Programming Exercise IV Construction (Cont.)

  1. Oracle 12c DB Implementation Using SQL*Plus (SQL)
  2. Use Oracle SQL*Plus or SQL Developer to manage your database as follows:

    An Example of Oracle 12c Database Implementation

    undcemcs02> source ~/.profile 
    
    undcemcs02> sqlplus C##user.id/password@//65.52.222.73:1521/cdb1 
    
    SQL*Plus: Release 12.2.0.1.0 Production on Sat Jul 17 03:32:43 2021
    Copyright (c) 1982, 2016, Oracle.  All rights reserved.
    Last Successful login time: Mon Jul 12 2021 02:31:52 -05:00
    
    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
    
    SQL> DROP SEQUENCE  route_seq; 
    
    Sequence dropped.
    
    SQL> CREATE SEQUENCE  route_seq  START WITH 1 INCREMENT BY 1 CACHE 100; 
    
    Sequence created.
    
    SQL> DROP TABLE  route; 
    
    Table dropped.
    
    SQL> CREATE TABLE  route ( 
      2    rid    INTEGER PRIMARY KEY, 
      3    begin  INTEGER NOT NULL, 
      4    end    INTEGER NOT NULL ); 
    
    Table created.
    
    SQL> DROP SEQUENCE  stop_seq; 
    
    Sequence dropped.
    
    SQL> CREATE SEQUENCE  stop_seq  START WITH 1 INCREMENT BY 1 CACHE 100; 
    
    Sequence created.
    
    SQL> DROP TABLE  stop; 
    
    Table dropped.
    
    SQL> CREATE TABLE  stop ( 
      2    sid   INTEGER PRIMARY KEY, 
      3    name  VARCHAR(32) NOT NULL ); 
    
    Table created.
    
    SQL> DROP SEQUENCE  route_stop_seq; 
    
    Sequence dropped.
    
    SQL> CREATE SEQUENCE  route_stop_seq  START WITH 1 INCREMENT BY 1 CACHE 100; 
    
    Sequence created.
    
    SQL> DROP TABLE  route_stop; 
    
    Table dropped.
    
    SQL> CREATE TABLE  route_stop ( 
      2    rsid  INTEGER PRIMARY KEY, 
      3    rid   INTEGER NOT NULL, 
      4    sid   INTEGER NOT NULL, 
      5    ord   INTEGER NOT NULL ); 
    
    Table created.
    
    SQL> INSERT INTO  stop 
      2    SELECT  stop_seq.NEXTVAL, 'Alerus Center'  FROM DUAL; 
    
    1 row created.
    
    SQL> INSERT INTO  stop 
      2    SELECT  stop_seq.NEXTVAL, 'Starbucks'  FROM DUAL; 
    
    1 row created.
    
    SQL> INSERT INTO  route 
      2    SELECT  route_seq.NEXTVAL, 1, 2  FROM DUAL; 
    
    1 row created.
    
    SQL> INSERT INTO  route_stop 
      2    SELECT  route_stop_seq.NEXTVAL, 1, 1, 0 FROM DUAL; 
    
    1 row created.
    
    SQL> INSERT INTO  route_stop 
      2    SELECT  route_stop_seq.NEXTVAL, 1, 2, 8 FROM DUAL; 
    
    1 row created.
    
    SQL> SELECT * FROM  stop; 
    
    SID            NAME  
    ---    ------------------- 
      1    Alerus Center           
      2    Starbucks
    
    SQL> SELECT * FROM  route; 
    
    RID    BEGIN    END
    ---    -----    ---
      1      1       2
    
    SQL> SELECT * FROM  route_stop; 
    
    RSID    RID    SID    ORDER
    ----    ---    ---    -----
     1       1      1       0
     2       1      2       5
    
    SQL> commit; 
    SQL> exit; 
    Disconnected from Oracle Database 12c Enterprise Edition Release
     12.1.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Advanced Analytics and Real Application
     Testing options
    
    undcemcs02>

    The italic text with a white color and a navy background color is entered by users.



      Stop being such a dog in the manger (a person    
      who is habitually gloomy, sullen or miserable)
   
      and let your sister ride your bike if you’re not using it.