Question
Database mysql ( USE PYTHON ) After the database has been created and the data inserted, the program should show an interactive prompt. Users should
Database mysql (USE PYTHON)
After the database has been created and the data inserted, the program should show an interactive prompt. Users should see a main menu as the one displayed in the picture. Each number should perform a certain action and run appropriate queries as described below.
Write a query :
1. List all planets. After pressing number 1 followed by enter the program should list the names of all the planets. Users will need to click any key to return to the main menu. (5 points)
2. Search for planet details. After pressing number 2 followed by enter the program should ask the user to enter the name of the planet. After the user enters the data and presses enter all the details of the planet should be displayed. Users will need to click any key to return to the main menu. Users will need to click any key to return to the main menu. (10 points)
3. Search for species with height higher than given number. After pressing number 3 followed by enter the program should ask the user to enter the average height of the species. The program should list all the species fulfilling the given condition. Users will need to click any key to return to the main menu. (20 points)
4. What is the most likely desired climate of the given species? After pressing number 4 followed by enter the program should ask the user to enter the name of the species. After the user enters the data and presses enter the question should be answered. (20 points)
5. What is the average lifespan per species classification? After pressing number 5 followed by enter the program should list the names of species classification and their average lifespan. Users will need to click any key to return to the main menu. (20 points)
species.csv file contains:
name,classification,designation,average_height,skin_colors,hair_colors,eye_colors,average_lifespan,language,homeworld Hutt,gastropod,sentient,300,"green, brown, tan",NA,"yellow, red",1000,Huttese,Nal Hutta Yoda's species,mammal,sentient,66,"green, yellow","brown, white","brown, green, yellow",900,Galactic basic,NA Trandoshan,reptile,sentient,200,"brown, green",none,"yellow, orange",NA,Dosh,Trandosha Mon Calamari,amphibian,sentient,160,"red, blue, brown, magenta",none,yellow,NA,Mon Calamarian,Mon Cala Ewok,mammal,sentient,100,brown,"white, brown, black","orange, brown",NA,Ewokese,Endor Sullustan,mammal,sentient,180,pale,none,black,NA,Sullutese,Sullust Neimodian,NA,sentient,180,"grey, green",none,"red, pink",NA,Neimoidia,Cato Neimoidia Gungan,amphibian,sentient,190,"brown, green",none,orange,NA,Gungan basic,Naboo Toydarian,mammal,sentient,120,"blue, green, grey",none,yellow,91,Toydarian,Toydaria Dug,mammal,sentient,100,"brown, purple, grey, red",none,"yellow, blue",NA,Dugese,Malastare Twi'lek,mammals,sentient,200,"orange, yellow, blue, green, pink, purple, tan",none,"blue, brown, orange, pink",NA,Twi'leki,Ryloth Aleena,reptile,sentient,80,"blue, gray",none,NA,79,Aleena,Aleen Minor Vulptereen,NA,sentient,100,grey,none,yellow,NA,vulpterish,Vulpter Xexto,NA,sentient,125,"grey, yellow, purple",none,black,NA,Xextese,Troiken Toong,NA,sentient,200,"grey, green, yellow",none,orange,NA,Tundan,Tund Cerean,mammal,sentient,200,pale pink,"red, blond, black, white",hazel,NA,Cerean,Cerea Nautolan,amphibian,sentient,180,"green, blue, brown, red",none,black,70,Nautila,Glee Anselm Zabrak,mammal,sentient,180,"pale, brown, red, orange, yellow",black,"brown, orange",NA,Zabraki,Iridonia Tholothian,mammal,sentient,NA,dark,NA,"blue, indigo",NA,NA,Tholoth Iktotchi,NA,sentient,180,pink,none,orange,NA,Iktotchese,Iktotch Quermian,mammal,sentient,240,white,none,yellow,86,Quermian,Quermia Kel Dor,NA,sentient,180,"peach, orange, red",none,"black, silver",70,Kel Dor,Dorin Chagrian,amphibian,sentient,190,blue,none,blue,NA,Chagria,Champala Geonosian,insectoid,sentient,178,"green, brown",none,"green, hazel",NA,Geonosian,Geonosis Mirialan,mammal,sentient,180,"yellow, green","black, brown","blue, green, red, yellow, brown, orange",NA,Mirialan,Mirial Clawdite,reptilian,sentient,180,"green, yellow",none,yellow,70,Clawdite,Zolan Besalisk,amphibian,sentient,178,brown,none,yellow,75,besalisk,Ojom Kaminoan,amphibian,sentient,220,"grey, blue",none,black,80,Kaminoan,Kamino Skakoan,mammal,sentient,NA,"grey, green",none,NA,NA,Skakoan,Skako Muun,mammal,sentient,190,"grey, white",none,black,100,Muun,Muunilinst Togruta,mammal,sentient,180,"red, white, orange, yellow, green, blue",none,"red, orange, yellow, green, blue, black",94,Togruti,Shili Kaleesh,reptile,sentient,170,"brown, orange, tan",none,yellow,80,Kaleesh,Kalee Pau'an,mammal,sentient,190,grey,none,black,700,Utapese,Utapau Wookiee,mammal,sentient,210,gray,"black, brown","blue, green, yellow, brown, golden, red",400,Shyriiwook,Kashyyyk Droid,artificial,sentient,NA,NA,NA,NA,indefinite,NA,NA Human,mammal,sentient,180,"caucasian, black, asian, hispanic","blonde, brown, black, red","brown, blue, green, hazel, grey, amber",120,Galactic Basic,Coruscant Rodian,sentient,reptilian,170,"green, blue",NA,black,NA,Galactic Basic,Rodia
planets.csv (CSV file contains):
name,rotation_period,orbital_period,diameter,climate,gravity,terrain,surface_water,population Alderaan,24,364,12500,temperate,1 standard,"grasslands, mountains",40,2000000000 Yavin IV,24,4818,10200,"temperate, tropical",1 standard,"jungle, rainforests",8,1000 Hoth,23,549,7200,frozen,1.1 standard,"tundra, ice caves, mountain ranges",100,NA Dagobah,23,341,8900,murky,N/A,"swamp, jungles",8,NA Bespin,12,5110,118000,temperate,"1.5 (surface), 1 standard (Cloud City)",gas giant,0,6000000 Endor,18,402,4900,temperate,0.85 standard,"forests, mountains, lakes",8,30000000 Naboo,26,312,12120,temperate,1 standard,"grassy hills, swamps, forests, mountains",12,4500000000 Coruscant,24,368,12240,temperate,1 standard,"cityscape, mountains",NA,1000000000000 Kamino,27,463,19720,temperate,1 standard,ocean,100,1000000000 Geonosis,30,256,11370,"temperate, arid",0.9 standard,"rock, desert, mountain, barren",5,100000000000 Utapau,27,351,12900,"temperate, arid, windy",1 standard,"scrublands, savanna, canyons, sinkholes",0.9,95000000 Mustafar,36,412,4200,hot,1 standard,"volcanoes, lava rivers, mountains, caves",0,20000 Kashyyyk,26,381,12765,tropical,1 standard,"jungle, forests, lakes, rivers",60,45000000 Polis Massa,24,590,0,artificial temperate ,0.56 standard,airless asteroid,0,1000000 Mygeeto,12,167,10088,frigid,1 standard,"glaciers, mountains, ice canyons",NA,19000000 Felucia,34,231,9100,"hot, humid",0.75 standard,fungus forests,NA,8500000 Cato Neimoidia,25,278,0,"temperate, moist",1 standard,"mountains, fields, forests, rock arches",NA,10000000 Saleucami,26,392,14920,hot,NA,"caves, desert, mountains, volcanoes",NA,1400000000 Stewjon,NA,NA,0,temperate,1 standard,grass,NA,NA Eriadu,24,360,13490,polluted,1 standard,cityscape,NA,22000000000 Corellia,25,329,11000,temperate,1 standard,"plains, urban, hills, forests",70,3000000000 Rodia,29,305,7549,hot,1 standard,"jungles, oceans, urban, swamps",60,1300000000 Nal Hutta,87,413,12150,temperate,1 standard,"urban, oceans, swamps, bogs",NA,7000000000 Dantooine,25,378,9830,temperate,1 standard,"oceans, savannas, mountains, grasslands",NA,1000 Bestine IV,26,680,6400,temperate,NA,"rocky islands, oceans",98,62000000 Ord Mantell,26,334,14050,temperate,1 standard,"plains, seas, mesas",10,4000000000 NA,0,0,0,NA,NA,NA,NA,NA Trandosha,25,371,0,arid,0.62 standard,"mountains, seas, grasslands, deserts",NA,42000000 Socorro,20,326,0,arid,1 standard,"deserts, mountains",NA,300000000 Mon Cala,21,398,11030,temperate,1,"oceans, reefs, islands",100,27000000000 Chandrila,20,368,13500,temperate,1,"plains, forests",40,1200000000 Sullust,20,263,12780,superheated,1,"mountains, volcanoes, rocky deserts",5,18500000000 Toydaria,21,184,7900,temperate,1,"swamps, lakes",NA,11000000 Malastare,26,201,18880,"arid, temperate, tropical",1.56,"swamps, deserts, jungles, mountains",NA,2000000000 Dathomir,24,491,10480,temperate,0.9,"forests, deserts, savannas",NA,5200 Ryloth,30,305,10600,"temperate, arid, subartic",1,"mountains, valleys, deserts, tundra",5,1500000000 Aleen Minor,NA,NA,NA,NA,NA,NA,NA,NA Vulpter,22,391,14900,"temperate, artic",1,"urban, barren",NA,421000000 Troiken,NA,NA,NA,NA,NA,"desert, tundra, rainforests, mountains",NA,NA Tund,48,1770,12190,NA,NA,"barren, ash",NA,0 Haruun Kal,25,383,10120,temperate,0.98,"toxic cloudsea, plateaus, volcanoes",NA,705300 Cerea,27,386,NA,temperate,1,verdant,20,450000000 Glee Anselm,33,206,15600,"tropical, temperate",1,"lakes, islands, swamps, seas",80,500000000 Iridonia,29,413,NA,NA,NA,"rocky canyons, acid pools",NA,NA Tholoth,NA,NA,NA,NA,NA,NA,NA,NA Iktotch,22,481,NA,"arid, rocky, windy",1,rocky,NA,NA Quermia,NA,NA,NA,NA,NA,NA,NA,NA Dorin,22,409,13400,temperate,1,NA,NA,NA Champala,27,318,NA,temperate,1,"oceans, rainforests, plateaus",NA,3500000000 Mirial,NA,NA,NA,NA,NA,deserts,NA,NA Serenno,NA,NA,NA,NA,NA,"rainforests, rivers, mountains",NA,NA Concord Dawn,NA,NA,NA,NA,NA,"jungles, forests, deserts",NA,NA Zolan,NA,NA,NA,NA,NA,NA,NA,NA Ojom,NA,NA,NA,frigid,NA,"oceans, glaciers",100,500000000 Skako,27,384,NA,temperate,1,"urban, vines",NA,500000000000 Muunilinst,28,412,13800,temperate,1,"plains, forests, hills, mountains",25,5000000000 Shili,NA,NA,NA,temperate,1,"cities, savannahs, seas, plains",NA,NA Kalee,23,378,13850,"arid, temperate, tropical",1,"rainforests, cliffs, canyons, seas",NA,4000000000 Umbara,NA,NA,NA,NA,NA,NA,NA,NA Tatooine,23,304,10465,arid,1 standard,desert,1,200000 Jakku,NA,NA,NA,NA,NA,deserts,NA,NA1. List all planets. 2. Search for planet details. 3. Search for species with height higher than given number. 4. What is the most likely desired climate of the given species? 5. What is the average lifespan per species classification? Q. Quit Please choose one option
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