Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. SELECT avg(vote) FROM votes WHERE uid = $uid AND gid = $gid;
  2. SELECT count(uid) FROM votes WHERE uid = $uid AND gid = $gid;
  3.  
  4. CREATE TABLE IF NOT EXISTS `games` (
  5. `id` int(8) NOT NULL auto_increment,
  6. `title` varchar(50) NOT NULL,
  7. PRIMARY KEY (`id`)
  8. ) AUTO_INCREMENT=1 ;
  9.  
  10. CREATE TABLE IF NOT EXISTS `users` (
  11. `id` int(8) NOT NULL auto_increment,
  12. `username` varchar(20) NOT NULL,
  13. PRIMARY KEY (`id`)
  14. ) AUTO_INCREMENT=1 ;
  15.  
  16.  
  17. CREATE TABLE IF NOT EXISTS `votes` (
  18. `uid` int(8) NOT NULL,
  19. `gid` int(8) NOT NULL,
  20. `vote` int(1) NOT NULL,
  21. KEY `uid` (`uid`,`gid`)
  22. ) ;
  23.  
  24. CREATE TABLE IF NOT EXISTS `votes` (
  25. `uid` int(8) unsigned NOT NULL,
  26. `gid` int(8) unsigned NOT NULL,
  27. `vote` int(1) NOT NULL,
  28. PRIMARY KEY (`gid`, `uid`)
  29. ) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement