Question: 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 distinct names of the planets visited by rebel affiliated humans.. 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', 'temperate', '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
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
