Quellcode durchsuchen

everything except part 4(final report) done

jasamuels vor 6 Jahren
Ursprung
Commit
f2992238a0
1 geänderte Dateien mit 78 neuen und 0 gelöschten Zeilen
  1. 78
    0
      Answers.rtf

+ 78
- 0
Answers.rtf Datei anzeigen

@@ -0,0 +1,78 @@
1
+{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600
2
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3
+{\colortbl;\red255\green255\blue255;}
4
+{\*\expandedcolortbl;;}
5
+\margl1440\margr1440\vieww14220\viewh11000\viewkind0
6
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
7
+
8
+\f0\fs24 \cf0 Part 2:\
9
+\
10
+What are all the types of pokemon that a pokemon can have?\
11
+
12
+\b SELECT name FROM types;\
13
+\
14
+
15
+\b0 What is the name of the pokemon with id 45?\
16
+
17
+\b SELECT name FROM pokemons WHERE id=45;
18
+\b0 \
19
+\
20
+How many pokemon are there?\
21
+
22
+\b SELECT COUNT(id) from pokemons;
23
+\b0 \
24
+\
25
+How many types are there?\
26
+
27
+\b SELECT COUNT(id) from types;
28
+\b0 \
29
+\
30
+How many pokemon have a secondary type?\
31
+
32
+\b SELECT COUNT(secondary_type) FROM pokemons;
33
+\b0 \
34
+\
35
+\
36
+Part 3:\
37
+\
38
+What is each pokemon's primary type?\
39
+
40
+\b SELECT pokemons.name, types.name FROM pokemons INNER JOIN types ON pokemons.primary_type=types.id;
41
+\b0 \
42
+\
43
+What is Rufflet's secondary type?\
44
+
45
+\b SELECT pokemons.name, types.name FROM pokemons INNER JOIN types ON pokemons.primary_type=types.id WHERE pokemons.name='Rufflet';
46
+\b0 \
47
+\
48
+What are the names of the pokemon that belong to the trainer with trainerID 303?\
49
+
50
+\b SELECT pokemons.name FROM pokemons INNER JOIN pokemon_trainer ON pokemon_trainer.pokemon_id=pokemons.id WHERE trainerID=303;
51
+\b0 \
52
+\
53
+How many pokemon have a secondary type Poison\
54
+
55
+\b SELECT COUNT(secondary_type) FROM pokemons INNER JOIN types ON pokemons.secondary_type=types.id WHERE types.name='poison';
56
+\b0 \
57
+\
58
+What are all the primary types and how many pokemon have that type?\
59
+
60
+\b SELECT COUNT(pokemons.primary_type)  FROM pokemons JOIN types ON pokemons.primary_type=types.id GROUP BY types.name; 
61
+\b0 \
62
+[[[Can only get the counts to display in order by name, but does not display names of Types. having trouble subquerying for the names of the types]]]\
63
+\
64
+How many pokemon at level 100 does each trainer with at least one level 100 pokemone have? (Hint: your query should not display a trainer\
65
+
66
+\b SELECT COUNT(pokemon_trainer.pokelevel) FROM pokemon_trainer JOIN trainers ON pokemon_trainer.pokelevel=trainers.trainerID WHERE pokemon_trainer.pokelevel=100;\
67
+\
68
+
69
+\b0 How many pokemon only belong to one trainer and no other?
70
+\b \
71
+SELECT COUNT(DISTINCT pokemon_trainer.trainerID) FROM pokemon_trainer;\
72
+\
73
+
74
+\b0 Part 4 (Final Report)\
75
+\
76
+
77
+\b \
78
+}