SHARE
TWEET

Untitled

a guest Sep 18th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*10
  2. */
  3. select SUM(worth)
  4. from object, tile, tileType
  5. where tile.id = tileType.id AND description = "Forest";
  6.  
  7. /*11
  8. */
  9. select edescription, COUNT(enemyType.id)
  10. from enemyType, enemy
  11. where enemytype = enemyType.id
  12. GROUP BY edescription;
  13.  
  14. /*12
  15. */
  16. select edescription, COUNT(enemyType.id)
  17. from enemyType, enemy
  18. where enemytype = enemyType.id
  19. GROUP BY edescription
  20. HAVING COUNT(*)>1;
  21.  
  22. /*1 TASK 2
  23. */
  24. select xcoordinate, ycoordinate
  25. from player, tile
  26. where ptile_id = tile.id;
  27.  
  28. /*2
  29. */
  30. select description
  31. from player, tile, tileType
  32. where ptile_id = tile.id AND tileType_id = tileType.ID;
  33.  
  34. /*3
  35. */
  36. select movement
  37. from player, tile, tileType
  38. where ptile_id = tile.id AND tileType_id = tileType.ID;
  39.  
  40. /*4
  41. */
  42. select object.name
  43. from object, player
  44. where owner = player.id;
  45.  
  46. /*5
  47. */
  48. select xcoordinate, ycoordinate
  49. from object, tile
  50. where object.tile = tile.id;
  51.  
  52. /*6
  53. */
  54. select enemy.name
  55. from player, enemy
  56. where ptile_id = enemy.tile;
  57.  
  58. /*7
  59. */
  60. select AVG(enemy.hp)
  61. from player, enemy
  62. where ptile_id = enemy.tile;
  63.  
  64. /*8
  65. */
  66. select COUNT(*)
  67. from enemy, enemyType
  68. where enemytype = enemyType.id AND enemyType.edescription = "Dragon";
  69.  
  70.  
  71.  
  72. /*Assignment 4
  73. Task 1
  74. 1
  75. */
  76. UPDATE enemy
  77. SET hp = hp * 0.90;
  78.  
  79. /*2
  80. */
  81. UPDATE tile
  82. SET tileType_id = (SELECT id from tileType where description = "Swamp")
  83. where tileType_id in (SELECT id from tileType where description = "Road");
  84.  
  85. /*3
  86. */
  87. DELETE
  88. FROM enemy
  89. where enemytype = (SELECT id from enemyType where edescription = "Orc");
  90.  
  91. /*4
  92. */
  93. UPDATE player
  94. SET ptile_id = ptile_id+1;
  95.  
  96. /*5
  97. */
  98. UPDATE object
  99. SET owner = (SELECT id from player where name = "avatar")
  100. where id in (SELECT id from object where name = "Shield");
  101.  
  102. /*
  103. UPDATE object
  104. SET owner = NULL
  105. where id >= 2 AND id <= 3;
  106. */
  107.  
  108. /*6
  109. */
  110. UPDATE object
  111. SET tile = (SELECT ptile_id from player where name = "avatar")
  112. where id in (SELECT id from object where name = "Sword");
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top