Using the World War II database, write a transaction that -Deletes all German sh
ID: 3705567 • Letter: U
Question
Using the World War II database, write a transaction that
-Deletes all German ship in all the tables
-Add a new ship for USA
mysql> SELECT FROM Ships; name | class | launched | 1921 | 1915 | 1914 | 1943 1915 | 1913 | 1944 | 1942 I 1943 1941 | 1917 | 1916 | 1916 | 1916 | 1916 | 1916 | 1916 | 1916 | 1916 | 1920 I 1941 | 1944 | 1941 | | California | Tennessee | Kongo | Kongo | Iowa | Kongo | Kongo | Iowa | Yamato | Iowa Haruna Hiei | Iowa | Kirishima | Kongo | Missouri |Musashi |New Jersey | North Carolina North Carolina | | Ramillies |Renowrn |Renowrn |Revenge |Renowrn |Renowrn |Renowrn |Renowrn |Revenge |Revenge |Revenge Repulse Repulse | Resolutiorn |Revenge | Royal 0ak | Royal Sovereign | Revenge | Tennessee | Washington | Tennessee | North Carolina | Iowa | Yamato Wisconsin | Yamato 23 rows in set (0.00 sec) mysql>Explanation / Answer
Answer)
-- start a new transaction
BEGIN TRANSACTION;
-- Deletes all German ship in all the tables
delete from Ships where class in (select class where country='Germany');
-- Add a new ship for USA
insert into Ships values('Marines','Iowa','1944');
-- commit changes
commit;
-- get the new inserted data
select * from Ships where name='Marines';
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.