Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi I will provide you with my sql code and I need you to help me complete this task. - Write a sql statement to
Hi I will provide you with my sql code and I need you to help me complete this task. Write a sql statement to find all characters that have been on all swamp planets. Code: CREATE TABLE Characters
cName varchar PRIMARY KEY,
cRace varchar DEFAULT NULL,
cHomeworld varchar DEFAULT NULL,
cAffiliation enum rebels 'empire', 'neutral', 'freelancer'
;
CREATE TABLE Planets
pName varchar PRIMARY KEY,
pType enum gas 'swamp', 'forest', 'handmade', 'ice', 'desert', 'temperature', 'artificial'
pAffiliation enum rebels 'empire', 'neutral'
;
CREATE TABLE TimeTable
cName varchar
pName varchar
Movie varchar
TimeofArrival int,
TimeofDeparture int,
PRIMARY KEY cName pName, Movie
Foreign Key cName references CharacterscName
Foreign key pName references Planets pName
;
INSERT INTO Characters cName cRace, cHomeworld, cAffiliation VALUES
C PO 'Droid', 'Unknown', 'rebels'
Chewbacca 'Wookie', 'Kashyyyk', 'rebels'
Darth Vader', 'Human', 'Unknown', 'empire'
Han Solo', 'Human', 'Corellia', 'rebels'
Jabba the Hutt', 'Hutt', 'Unknown', 'neutral'
Lando Calrissian', 'Human', 'Unknown', 'rebels'
Luke Skywalker', 'Human', 'Tatooine', 'rebels'
ObiWan Kanobi', 'Human', 'Tatooine', 'rebels'
Owen Lars', 'Human', 'Tatooine', 'neutral'
Princess Leia', 'Human', 'Alderaan', 'rebels'
RD 'Droid', 'Unknown', 'rebels'
Rancor 'Rancor', 'Unknown', 'neutral'
Yoda 'Unknown', 'Unknown', 'neutral';
INSERT INTO Planets pName pType, pAffiliation VALUES
Alderaan 'temperate', 'rebels'
Bespin 'gas', 'neutral'
Corellia 'temperate', 'rebels'
Dagobah 'swamp', 'neutral'
Death Star', 'artificial', 'empire'
Endor 'forest', 'neutral'
Hoth 'ice', 'rebels'
Kashyyyk 'forest', 'rebels'
Star Destroyer', 'artificial', 'empire'
Tatooine 'desert', 'neutral';
INSERT INTO TimeTable cName pName, Movie, TimeofArrival, TimeofDeparture VALUES
C PO 'Bespin',
C PO 'Hoth',
C PO 'Tatooine',
C PO 'Tatooine',
Chewbacca 'Bespin',
Chewbacca 'Endor',
Chewbacca 'Hoth',
Chewbacca 'Tatooine',
Chewbacca 'Tatooine',
Darth Vader', 'Bespin',
Darth Vader', 'Death Star',
Darth Vader', 'Death Star',
Darth Vader', 'Hoth',
Darth Vader', 'Star Destroyer',
Han Solo', 'Bespin',
Han Solo', 'Endor',
Han Solo', 'Hoth',
Han Solo', 'Star Destroyer',
Han Solo', 'Tatooine',
Han Solo', 'Tatooine',
Jabba the Hutt', 'Tatooine',
Jabba the Hutt', 'Tatooine',
Jabba the Hutt', 'Tatooine',
Lando Calrissian', 'Bespin',
Lando Calrissian', 'Endor',
Lando Calrissian', 'Tatooine',
Luke Skywalker', 'Bespin',
Luke Skywalker', 'Dagobah',
Luke Skywalker', 'Dagobah',
Luke Skywalker', 'Death Star',
Luke Skywalker', 'Death Star',
Luke Skywalker', 'Endor',
Luke Skywalker', 'Hoth',
Luke Skywalker', 'Star Destroyer',
Luke Skywalker', 'Tatooine',
Luke Skywalker', 'Tatooine',
ObiWan Kanobi', 'Star Destroyer',
ObiWan Kanobi', 'Tatooine',
Owen Lars', 'Tatooine',
Princess Leia', 'Bespin',
Princess Leia', 'Endor',
Princess Leia', 'Hoth',
Princess Leia', 'Star Destroyer',
Princess Leia', 'Tatooine',
RD 'Bespin',
RD 'Dagobah',
RD 'Dagobah',
RD 'Endor',
RD 'Hoth',
Rancor 'Tatooine',
Rancor 'Tatooine',
Rancor 'Tatooine',
Yoda 'Dagobah',
Yoda 'Dagobah',
Yoda 'Dagobah', ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started