text: ALTER TABLE VISUAL.THREADS DROP CONSTRAINT SQL121109062555540;
  
  DROP INDEX VISUAL.SQL121109062555540;
  
  DROP VIEW VISUAL.CLASSIFIED_THREAD;
  
  DROP TABLE VISUAL.THREADS;
  
  DROP TABLE VISUAL.SIMILARITIES;
  
  DROP TABLE VISUAL.SVD_THREADS;
  
  DROP TABLE VISUAL.CLASSIFICATION;
  
  DROP TABLE VISUAL.TERMS;
  
  DROP TABLE VISUAL.PATTERNS;
  
  DROP TABLE VISUAL.PATTERN_2_PATTERN;
  
  DROP TABLE VISUAL.PATTERN_2_POST;
  
  DROP TABLE VISUAL.USERS;
  
  DROP SCHEMA VISUAL RESTRICT;
  
  CREATE SCHEMA VISUAL;
  
  CREATE TABLE VISUAL.THREADS (
  		ID INTEGER NOT NULL,
  		POSTTYPEID INTEGER,
  		ACCEPTEDANSWERID INTEGER,
  		PARENTID INTEGER,
  		CREATIONDATE VARCHAR(100),
  		SCORE INTEGER,
  		VIEWCOUNT INTEGER,
  		BODY CLOB(2147483647),
  		OWNERUSERID INTEGER,
  		OWNERDISPLAYNAME VARCHAR(40),
  		LASTEDITORUSERID INTEGER,
  		LASTEDITORDISPLAYNAME VARCHAR(40),
  		LASTEDITDATE VARCHAR(100),
  		LASTACTIVITYDATE VARCHAR(100),
  		TITLE VARCHAR(250),
  		TAGS VARCHAR(150),
  		ANSWERCOUNT INTEGER,
  		COMMENTCOUNT INTEGER,
  		FAVORITECOUNT INTEGER,
  		CLOSEDDATE VARCHAR(100),
  		COMMUNITYOWNEDDATE VARCHAR(100)
  	);
  
  CREATE TABLE VISUAL.SIMILARITIES (
  		THREADID INTEGER,
  		THREADID2 INTEGER,
  		SIMILARITY DOUBLE
  	);
  
  CREATE TABLE VISUAL.SVD_THREADS (
  		THREADID INTEGER,
  		X DOUBLE,
  		Y DOUBLE
  	);
  
  CREATE TABLE VISUAL.CLASSIFICATION (
  		THREADID INTEGER,
  		CLASSIFICATION INTEGER DEFAULT 0
  	);
  
  CREATE TABLE VISUAL.TERMS (
  		THREADID INTEGER,
  		TERM VARCHAR(350),
  		OCCURRENCES INTEGER,
  		TERMSTRENGTH INTEGER
  	);
  	
  
  CREATE TABLE VISUAL.PATTERNS (
      ID                  INTEGER NOT NULL,
  	PATTERNNAME			VARCHAR(350) NOT NULL,
  	PATTERNDESCRIPTION 	VARCHAR(350),
  	PATTERNSOLUTION 	VARCHAR(350),
  	CREATIONDATE		TIMESTAMP,
  	OWNERUSERID			INTEGER,
  	LASTEDITORUSERID	INTEGER,
  	LASTACTIVITYDATE	TIMESTAMP,
  	TAGS				VARCHAR(100)
  );
  
  CREATE TABLE VISUAL.PATTERN_2_PATTERN (
  	PATTERNNAMESOURCE	VARCHAR(350),
  	PATTERNNAMETARGET	VARCHAR(350)
  );
  
  CREATE TABLE VISUAL.PATTERN_2_POST (
  	PATTERNNAME		VARCHAR(350),
  	POSTID			INTEGER,	-- THE ID OF THE ANSWER OR COMMENT
  	POSTPARENTID	INTEGER	-- THE ID OF THE QUESTION
  );
  
  CREATE TABLE VISUAL.USERS (
      ID          INTEGER NOT NULL,
      DISPLAYNAME VARCHAR(40),   -- THE NAME OF THE USER
      REPUTATION  INTEGER    -- THE POINTS OF THE USER
  );
  
  CREATE VIEW VISUAL.CLASSIFIED_THREAD (ID, POSTTYPEID, ACCEPTEDANSWERID, PARENTID, CREATIONDATE, SCORE, VIEWCOUNT, BODY, OWNERUSERID, OWNERDISPLAYNAME, LASTEDITORUSERID, LASTEDITORDISPLAYNAME, LASTEDITDATE, LASTACTIVITYDATE, TITLE, TAGS, ANSWERCOUNT, COMMENTCOUNT, FAVORITECOUNT, CLOSEDDATE, COMMUNITYOWNEDDATE, CLASSIFICATION) AS
  (
  	SELECT T.*, COALESCE(C.CLASSIFICATION, 0) CLASSIFICATION 
  	FROM VISUAL.THREADS T LEFT JOIN VISUAL.CLASSIFICATION C ON T.ID = C.THREADID);
  	
  CREATE UNIQUE INDEX VISUAL.SQL121109062555540 ON VISUAL.THREADS (ID ASC);
  
  ALTER TABLE VISUAL.THREADS ADD CONSTRAINT SQL121109062555540 PRIMARY KEY (ID);