This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Virtuoso SQL to Build Tables

By: a guest on Aug 5th, 2010  |  syntax: SQL  |  size: 2.24 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. USE studies;
  2.  
  3. DROP TABLE studies;
  4. CREATE TABLE studies
  5. (
  6.   id                  INTEGER IDENTITY,
  7.   title               VARCHAR(300),
  8.   description         VARCHAR(4000),
  9.   url                 VARCHAR(255),
  10.   period              VARCHAR(300),
  11.   dtstart             DATE,
  12.   dtend               DATE,
  13.   rpo                 CHAR(1),
  14.   accrual             CHAR(1),
  15.   layman_title        VARCHAR(300),
  16.   layman_description  VARCHAR(4000),
  17.   layman_categories   VARCHAR(300),
  18.   layman_keywords     VARCHAR(300),
  19.   expiration          DATE,
  20.   irb                 CHAR(1),
  21.   irb_study_code      VARCHAR(20),
  22.   study_plan          VARCHAR(4000),
  23.   study_purpose       VARCHAR(2000),
  24.   keywords            VARCHAR(300),
  25.   PRIMARY KEY (id)
  26. );
  27.  
  28. DROP TABLE grant_amounts;
  29. CREATE TABLE grant_amounts
  30. (
  31.   id        INTEGER IDENTITY,
  32.   study_id  INTEGER,
  33.   currency  VARCHAR(15),
  34.   amount    FLOAT(2),
  35.   PRIMARY KEY (id)
  36. );
  37.  
  38. DROP TABLE entities;
  39. CREATE TABLE entities
  40. (
  41.   id           INTEGER IDENTITY,
  42.   entity_type  VARCHAR(10),
  43.   study_id     INTEGER,
  44.   tel          VARCHAR(25),
  45.   email        VARCHAR(300),
  46.   url          VARCHAR(255),
  47.   org          VARCHAR(300),
  48.   fn           VARCHAR(300),
  49.   PRIMARY KEY (id)
  50. );
  51.  
  52.  
  53. DROP TABLE addresses;
  54. CREATE TABLE addresses
  55. (
  56.   id                INTEGER IDENTITY,
  57.   entity_id         INTEGER,
  58.   staffer_id        INTEGER,
  59.   post_office_box   VARCHAR(10),
  60.   street_address    VARCHAR(300),
  61.   extended_address  VARCHAR(300),
  62.   locality          VARCHAR(30),
  63.   region            VARCHAR(30),
  64.   postal_code       VARCHAR(10),
  65.   country_name      VARCHAR(30),
  66.   PRIMARY KEY (id)
  67. );
  68.  
  69. DROP TABLE focus_regions;
  70. CREATE TABLE focus_regions
  71. (
  72.   id           INTEGER IDENTITY,
  73.   study_id     INTEGER,
  74.   locality     VARCHAR(30),
  75.   region       VARCHAR(30),
  76.   postal_code  VARCHAR(10),
  77.   country      VARCHAR(30),
  78.   tel          VARCHAR(10),
  79.   email        VARCHAR(300),
  80.   url          VARCHAR(300),
  81.   org          VARCHAR(300),
  82.   fn           VARCHAR(300),
  83.   PRIMARY KEY (id)
  84. );
  85.  
  86. DROP TABLE staffers;
  87. CREATE TABLE staffers
  88. (
  89.   id           INTEGER IDENTITY,
  90.   study_id     INTEGER,
  91.   ufid         VARCHAR(30),
  92.   involvement  VARCHAR(30),
  93.   fn           VARCHAR(30),
  94.   PRIMARY KEY (id)
  95. );
clone this paste RAW Paste Data