pytanie,SQL: 4 Warunki połączone lub
Ustalić nazwy wszystkich statkach na statkach tabeli, odpowiadających kombinację co najmniej czterech kryteriów, z poniższej listy: numGuns = 8 otworu = 15 przemieszczenia = 32000 type = bb launch = 1915 class = Kraj Kongo = USA.
Znalazłem odpowiedź na to ćwiczenie.
Odpowiedź brzmi
SELECT s.name from ship s,classes c
WHERE s.class=c.class AND
((numGuns = 8 AND bore = 15 AND displacement = 32000 AND type = 'bb')
OR (numGuns = 8 AND bore = 15 AND displacement = 32000 AND launched = 1915)
OR (numGuns = 8 AND bore = 15 AND displacement = 32000 AND c.class = 'Kongo')
OR (numGuns = 8 AND bore = 15 AND displacement = 32000 AND country = 'USA')
OR (numGuns = 8 AND bore = 15 AND type = 'bb' AND launched = 1915)
OR (numGuns = 8 AND bore = 15 AND type = 'bb' AND c.class = 'kongo')
OR (numGuns = 8 AND bore = 15 AND type = 'bb' AND country = 'USA')
OR (numGuns = 8 AND bore = 15 AND launched = 1915 AND c.class = 'Kongo')
OR (numGuns = 8 AND bore = 15 AND launched = 1915 AND country = 'USA')
OR (numGuns = 8 AND bore = 15 AND c.class = 'Kongo' AND country = 'USA')
OR (numGuns = 8 AND displacement = 32000 AND type = 'bb' AND launched = 1915)
OR (numGuns = 8 AND displacement = 32000 AND type = 'bb' AND c.class = 'kongo')
OR (numGuns = 8 AND displacement = 32000 AND type = 'bb' AND country = 'USA')
OR (numGuns = 8 AND displacement = 32000 AND launched = 1915 AND c.class = 'Kongo')
OR (numGuns = 8 AND displacement = 32000 AND launched = 1915 AND country = 'USA') O
Moje pytanie brzmi,
Czy istnieje inny prosty sposób sprawdzić warunki.
proszę dać sensowne tytuł. –
Tak, po prostu poruszaj się wokół klauzul "WHERE", aby je uprościć. – Ruslan
@Ruslan Co oznacza? –