SHARE
TWEET

Untitled

a guest May 19th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Generated by Oracle SQL Developer Data Modeler 18.4.0.339.1536
  2. --   at:        2019-05-19 13:52:04 CEST
  3. --   site:      Oracle Database 11g
  4. --   type:      Oracle Database 11g
  5.  
  6.  
  7.  
  8. CREATE TABLE aircrafts (
  9.     registration     VARCHAR2(8) NOT NULL,
  10.     engine_hours     FLOAT,
  11.     airframe_hours   FLOAT
  12. )
  13. LOGGING;
  14.  
  15. ALTER TABLE aircrafts ADD CONSTRAINT aircrafts_pk PRIMARY KEY ( registration );
  16.  
  17. CREATE TABLE airports (
  18.     airportid     INTEGER NOT NULL,
  19.     airporticao   VARCHAR2(4)
  20. )
  21. LOGGING;
  22.  
  23. ALTER TABLE airports ADD CONSTRAINT airports_pk PRIMARY KEY ( airportid );
  24.  
  25. CREATE TABLE locations (
  26.     airports_airportid       INTEGER NOT NULL,
  27.     aircrafts_registration   VARCHAR2(8) NOT NULL
  28. )
  29. LOGGING;
  30.  
  31. ALTER TABLE locations ADD CONSTRAINT relation_5_pk PRIMARY KEY ( airports_airportid,
  32.                                                                  aircrafts_registration );
  33.  
  34. CREATE TABLE rentals (
  35.     rentalid                 INTEGER NOT NULL,
  36.     cost                     FLOAT,
  37.     aircraftid               INTEGER NOT NULL,
  38.     aircrafts_registration   VARCHAR2(8) NOT NULL,
  39.     users_userid             INTEGER NOT NULL
  40. )
  41. LOGGING;
  42.  
  43. CREATE UNIQUE INDEX rentals__idx ON
  44.     rentals (
  45.         aircrafts_registration
  46.     ASC )
  47.         LOGGING;
  48.  
  49. CREATE UNIQUE INDEX rentals__idxv1 ON
  50.     rentals (
  51.         users_userid
  52.     ASC )
  53.         LOGGING;
  54.  
  55. ALTER TABLE rentals ADD CONSTRAINT rentals_pk PRIMARY KEY ( rentalid );
  56.  
  57. CREATE TABLE users (
  58.     userid      INTEGER NOT NULL,
  59.     firstname   VARCHAR2(50),
  60.     lastname    VARCHAR2(50),
  61.     license     INTEGER
  62. )
  63. LOGGING;
  64.  
  65. ALTER TABLE users ADD CONSTRAINT users_pk PRIMARY KEY ( userid );
  66.  
  67. ALTER TABLE locations
  68.     ADD CONSTRAINT relation_5_aircrafts_fk FOREIGN KEY ( aircrafts_registration )
  69.         REFERENCES aircrafts ( registration )
  70.     NOT DEFERRABLE;
  71.  
  72. ALTER TABLE locations
  73.     ADD CONSTRAINT relation_5_airports_fk FOREIGN KEY ( airports_airportid )
  74.         REFERENCES airports ( airportid )
  75.     NOT DEFERRABLE;
  76.  
  77. ALTER TABLE rentals
  78.     ADD CONSTRAINT rentals_aircrafts_fk FOREIGN KEY ( aircrafts_registration )
  79.         REFERENCES aircrafts ( registration )
  80.     NOT DEFERRABLE;
  81.  
  82. ALTER TABLE rentals
  83.     ADD CONSTRAINT rentals_users_fk FOREIGN KEY ( users_userid )
  84.         REFERENCES users ( userid )
  85.     NOT DEFERRABLE;
  86.  
  87.  
  88.  
  89. -- Oracle SQL Developer Data Modeler Summary Report:
  90. --
  91. -- CREATE TABLE                             5
  92. -- CREATE INDEX                             2
  93. -- ALTER TABLE                              9
  94. -- CREATE VIEW                              0
  95. -- ALTER VIEW                               0
  96. -- CREATE PACKAGE                           0
  97. -- CREATE PACKAGE BODY                      0
  98. -- CREATE PROCEDURE                         0
  99. -- CREATE FUNCTION                          0
  100. -- CREATE TRIGGER                           0
  101. -- ALTER TRIGGER                            0
  102. -- CREATE COLLECTION TYPE                   0
  103. -- CREATE STRUCTURED TYPE                   0
  104. -- CREATE STRUCTURED TYPE BODY              0
  105. -- CREATE CLUSTER                           0
  106. -- CREATE CONTEXT                           0
  107. -- CREATE DATABASE                          0
  108. -- CREATE DIMENSION                         0
  109. -- CREATE DIRECTORY                         0
  110. -- CREATE DISK GROUP                        0
  111. -- CREATE ROLE                              0
  112. -- CREATE ROLLBACK SEGMENT                  0
  113. -- CREATE SEQUENCE                          0
  114. -- CREATE MATERIALIZED VIEW                 0
  115. -- CREATE MATERIALIZED VIEW LOG             0
  116. -- CREATE SYNONYM                           0
  117. -- CREATE TABLESPACE                        0
  118. -- CREATE USER                              0
  119. --
  120. -- DROP TABLESPACE                          0
  121. -- DROP DATABASE                            0
  122. --
  123. -- REDACTION POLICY                         0
  124. --
  125. -- ORDS DROP SCHEMA                         0
  126. -- ORDS ENABLE SCHEMA                       0
  127. -- ORDS ENABLE OBJECT                       0
  128. --
  129. -- ERRORS                                   0
  130. -- WARNINGS                                 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top