Quipex

Query

Apr 28th, 2017
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.88 KB | None | 0 0
  1. PRAGMA foreign_keys = 0;
  2.  
  3. CREATE TABLE sqlitestudio_temp_table AS SELECT *
  4.                                           FROM mark;
  5.  
  6. DROP TABLE mark;
  7.  
  8. CREATE TABLE mark (
  9.     id_mark  INTEGER PRIMARY KEY AUTOINCREMENT
  10.                      NOT NULL,
  11.     points   INTEGER,
  12.     id_topic INTEGER REFERENCES topic (id_topic) ON DELETE CASCADE
  13.                                                  ON UPDATE CASCADE
  14.                      NOT NULL,
  15.     id_user          REFERENCES users (id_user) ON DELETE CASCADE
  16.                                                 ON UPDATE CASCADE
  17.                      NOT NULL
  18. );
  19.  
  20. INSERT INTO mark (
  21.                      id_mark,
  22.                      points
  23.                  )
  24.                  SELECT id_mark,
  25.                         points
  26.                    FROM sqlitestudio_temp_table;
  27.  
  28. DROP TABLE sqlitestudio_temp_table;
  29.  
  30. PRAGMA foreign_keys = 1;
Advertisement
Add Comment
Please, Sign In to add comment