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
First, write SQL to insert the following records into the EXPLORER table.
ExplrName
Age
FromEarth
Military
Vasco Battuta
Anders A'mundsen
Zheng Mei
Then, write a query to display these rows only after they have been inserted. Your query should produce this exact result note the column headers and values:
##Paste below: copy your SQL code out of mySQL WB screenshot of the result set displayed
SQL CODE to insert the 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
Delete the rows you just added in # Show your delete worked by afterwards running a a query that selects all columns, all records from EXPLORER, sorted by ExplrName.
##Paste below: copy your SQL code out of mySQL WB screenshot of the result set displayed
SQL CODE to both delete the specified records and display the table:
Due to an input error, the Lexington was mistakenly input as a Nebulaclass but this vessel is really of type Temocclass 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: copy your SQL code out of mySQL WB 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 NOT NULL,
Age smallint,
FromEarth tinyint,
Military tinyint,
CONSTRAINT Explorerpk PRIMARY KEYExplorerID
;
CREATE TABLE RESOURCE
ResourceID INT autoincrement,
Category varchar CHECK Category INGold'Medicine','Rare Mineral','New Weapon','Technology','Other'
DateOfMission date,
ExplorerID smallint,
CONSTRAINT ResourceIDpk PRIMARY KEYResourceID
constraint missionfk FOREIGN KEYExplorerID REFERENCES EXPLORERExplorerID ON DELETE CASCADE
;
CREATE TABLE VESSEL
VesselID SMALLINT NOT NULL,
VesselName VARCHAR
NumOfLaserCannons smallint,
VesselType varchar
CONSTRAINT Vesselpk PRIMARY KEYVesselID
;
ALTER TABLE VESSEL ADD CONSTRAINT checkVesseltype CHECK VesselType INInterceptorclass','Excelsiorclass','Galaxyclass','Defiantclass','Nebulaclass';
CREATE TABLE RESERVATION
ReservationNum INT AUTOINCREMENT,
CheckOutDate DATE,
CheckInDate DATE,
ReturnDueDate DATE,
ExplorerID smallint,
VesselNum smallint,
CONSTRAINT reservationpk PRIMARY KEYReservationNum
CONSTRAINT reservationfk FOREIGN KEY ExplorerID REFERENCES EXPLORERExplorerID ON DELETE CASCADE,
CONSTRAINT reservationfk FOREIGN KEY VesselNum REFERENCES VESSELVesselID ON DELETE CASCADE
;
##EXPLORER rows
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Chris Aldrin',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Peggy Glenn',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Buzz Armstrong',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Alan Gagarin',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Michael Hadfield',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Mae Ride',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Yuri Whitson',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'John Jemison',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Neil Shepard',;
INSERT INTO EXPLORERExplorerID ExplrName, Age,FromEarth, Military VALUES 'Sally Collins',;
##VESSEL rows
INSERT INTO VESSELVesselID VesselName, NumOfLaserCannons,VesselType VALUES 'Prometheus','Excelsiorclass';
INSERT INTO VESSELVesselID VesselName, NumOfLaserCannons,VesselType VALUES 'Exeter','Interceptorclass';
INSERT INTO VESSELVesselID VesselName, NumOfLaserCannons,VesselType VALUES 'Rotarran','Galaxyclass';
INSERT INTO VESSELVesselID VesselName, NumOfLaserCannons,VesselType VALUES 'Venture','Nebulaclass';
INSERT INTO VESSELVesselID VesselName, NumOfLaserCannons,VesselType VALUES 'Valiant','Galaxyclass';
INSERT INTO VESSELVesselID VesselName, NumOfLaserCannons,VesselType VALUES
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
