SHARE
TWEET

Untitled

a guest Aug 17th, 2018 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. users (InnoDB - utf8_general_ci):
  2. - usr_Id: int(11) unsigned Auto_Increment
  3. - usr_Username: varchar(50)
  4. - usr_Password: varchar(50)
  5.  
  6. messages (InnoDB - utf8_general_ci):
  7. - msg_Id: int(11) unsigned Auto_Increment
  8. - msg_UserId: int(11) unsigned
  9. - msg_Date: datetime
  10. - msg_Subject: varchar(50)
  11. - msg_Text: varchar(1024)
  12.    
  13. SELECT msg_Id, msg_Subject FROM messages WHERE msg_UserId = <Logged User Id> ORDER BY msg_Date DESC;
  14.    
  15. SELECT msg_Text FROM messages WHERE msg_Id = <Id From Clicked Message>;
  16.    
  17. DELETE FROM messages WHERE msg_Date < DATE_SUB(NOW(), INTERVAL 3 MONTH);
  18.    
  19. PRIMARY KEY(UserId, Date, msg_id),
  20. INDEX(msg_id)
  21.    
  22. PRIMARY KEY(Date, msg_id),
  23. INDEX(msg_id),
  24. INDEX(UserId, Date)
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