Agents Here you see the table agents with important data about key agents of the…
- User
Agents Here you see the table agents with important data about key agents of the International Security Agency:
code_number
current_location
citizenship
knows_languages
missions
008
Mexico
UK
4
20
IJ655
London
China
3
7
IL7T
Sevilla
UK
2
5
006
Brest
France
2
50
BV11
Montevideo
Argentina
8
8
A while ago, all experienced agents (those with more than 10 completed missions and proficiency in more than 3 languages) were ordered to move to Istanbul. Their new mission in Turkey was a success. Write a query to change the table accordingly.
Write an SQL statement Report a typo HINT by IIDimitrov They are currently in Istanbul & their mission is over.
- Assistant
To update the
agentstable where experienced agents have completed their mission and moved to Istanbul, you would use an SQLUPDATEstatement. The statement should target rows where the number of completed missions (missions) is greater than 10 and the number of languages they know (knows_languages) is more than 3. After identifying these rows, the statement should set thecurrent_locationto "Istanbul" since their new mission location was Istanbul.Here’s the SQL statement that achieves this:
sqlUPDATE agents SET current_location = 'Istanbul' WHERE missions > 10 AND knows_languages > 3;This query checks each row in the
agentstable:- If an agent has completed more than 10 missions (
missions > 10) and knows more than 3 languages (knows_languages > 3), it updates that row’scurrent_locationcolumn to "Istanbul". - Agents who do not meet both of these conditions remain unchanged in the database.
- If an agent has completed more than 10 missions (