Question: 1 . First, write SQL to insert the following records into the EXPLORER table. ExplrName Age FromEarth Military Vasco Battuta 3 7 0 1 Anders

1. First, write SQL to insert the following records into the EXPLORER table.
ExplrName
Age
FromEarth
Military
Vasco Battuta
37
0
1
Anders A'mundsen
33
1
1
Zheng Mei
31
1
0
Then, write a query to display these 3 rows only after they have been inserted. Your query should produce this exact result (note the column headers and values):
##Paste below: 1) copy your SQL code out of mySQL WB2) screenshot of the result set displayed
SQL CODE (to insert the 3 specified rows):
SQL QUERY CODE (to display the inserted rows, showing Yes or No values, per above):
YOUR RESULT SET SCREENSHOT:
#Screenshot is provided above but still paste your own screenshot here to confirm you got it right
2. Delete the 3 rows you just added in #1. Show your delete worked by afterwards running a a query that selects all columns, all records from EXPLORER, sorted by ExplrName.
##Paste below:1) copy your SQL code out of mySQL WB2) screenshot of the result set displayed
SQL CODE (to both delete the specified records and display the table):
3. Due to an input error, the Lexington was mistakenly input as a Nebula-class, but this vessel is really of type Temoc-class. Write the required DDL commands to first update the VesselType domain constraint, then write a single SQL command to fix the input error. Once everything is fixed, write a query to show all columns for all vessels - sort by VesselID.
##Paste below:1) copy your SQL code out of mySQL WB2) screenshot of the result set displayed
SQL DDL CODE (to update the domain integrity):
SQL DML CODE (to fix the input error):
SQL QUERY CODE (to display the result set after the fixes):
RESULT SET SCREENSHOT:
CREATE TABLE EXPLORER(
ExplorerID smallint not null,
ExplrName VARCHAR(30) NOT NULL,
Age smallint,
FromEarth tinyint,
Military tinyint,
CONSTRAINT Explorer_pk PRIMARY KEY(ExplorerID)
);
CREATE TABLE RESOURCE(
ResourceID INT auto_increment,
Category varchar(20) CHECK (Category IN('Gold','Medicine','Rare Mineral','New Weapon','Technology','Other')),
DateOfMission date,
ExplorerID smallint,
CONSTRAINT ResourceID_pk PRIMARY KEY(ResourceID),
constraint mission_fk FOREIGN KEY(ExplorerID) REFERENCES EXPLORER(ExplorerID) ON DELETE CASCADE
);
CREATE TABLE VESSEL(
VesselID SMALLINT NOT NULL,
VesselName VARCHAR(30),
NumOfLaserCannons smallint,
VesselType varchar(20),
CONSTRAINT Vessel_pk PRIMARY KEY(VesselID)
);
ALTER TABLE VESSEL ADD CONSTRAINT check_Vessel_type CHECK (VesselType IN('Interceptor-class','Excelsior-class','Galaxy-class','Defiant-class','Nebula-class'));
CREATE TABLE RESERVATION(
ReservationNum INT AUTO_INCREMENT,
CheckOutDate DATE,
CheckInDate DATE,
ReturnDueDate DATE,
ExplorerID smallint,
VesselNum smallint,
CONSTRAINT reservation_pk PRIMARY KEY(ReservationNum),
CONSTRAINT reservation_fk1 FOREIGN KEY (ExplorerID) REFERENCES EXPLORER(ExplorerID) ON DELETE CASCADE,
CONSTRAINT reservation_fk2 FOREIGN KEY (VesselNum) REFERENCES VESSEL(VesselID) ON DELETE CASCADE
) ;
##EXPLORER rows
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (1,'Chris Aldrin',41,0,0);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (2,'Peggy Glenn',30,0,0);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (3,'Buzz Armstrong',38,1,1);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (4,'Alan Gagarin',24,0,0);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (5,'Michael Hadfield',40,0,1);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (6,'Mae Ride',37,1,0);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (7,'Yuri Whitson',51,0,0);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (8,'John Jemison',43,0,0);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (9,'Neil Shepard',26,1,0);
INSERT INTO EXPLORER(ExplorerID, ExplrName, Age,FromEarth, Military) VALUES (10,'Sally Collins',34,1,1);
##VESSEL rows
INSERT INTO VESSEL(VesselID, VesselName, NumOfLaserCannons,VesselType) VALUES (1000,'Prometheus',18,'Excelsior-class');
INSERT INTO VESSEL(VesselID, VesselName, NumOfLaserCannons,VesselType) VALUES (1001,'Exeter',36,'Interceptor-class');
INSERT INTO VESSEL(VesselID, VesselName, NumOfLaserCannons,VesselType) VALUES (1002,'Rotarran',34,'Galaxy-class');
INSERT INTO VESSEL(VesselID, VesselName, NumOfLaserCannons,VesselType) VALUES (1003,'Venture',40,'Nebula-class');
INSERT INTO VESSEL(VesselID, VesselName, NumOfLaserCannons,VesselType) VALUES (1004,'Valiant',46,'Galaxy-class');
INSERT INTO VESSEL(VesselID, VesselName, NumOfLaserCannons,VesselType) VALUES (1005

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!