Still considering the World War II database. Assume someone wants to write a que
ID: 3700025 • Letter: S
Question
Still considering the World War II database. Assume someone wants to write a query that returns for each ship the date it was launched and when it was sunk. What is the problem with the following query?
SELECT S.name, S.launched, B.date
FROM Battles AS B, Ships AS S
WHERE S.name=(SELECT ship FROM Outcomes WHERE results=’sunk’) AND
B.name=(SELECT battle FROM Outcomes WHERE results=’sunk’) ;
Write this query in MySQL , run the query and submit the screenshots of :
1. the query
2. database error message
(5) Correct the query and run it on the database. Submit the screenshot of:
1. the correct query
2. database answer
Explanation / Answer
Hi
The problem with your query is "your suplying multiple values to a uniary operator equals(=) in the where condition."
Could you please try the below query(As I don't have the World War II database with me), I'm sure that the below query will work .
SELECT S.name, S.launched, B.date
FROM Battles AS B, Ships AS S
WHERE S.name IN (SELECT ship FROM Outcomes WHERE results=’sunk’) AND
B.name IN (SELECT battle FROM Outcomes WHERE results=’sunk’) ;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.