Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- - nasa.sql - - - - - - This database describes the United States space program, prior to the - - space shuttle. -

-- nasa.sql
--
--
-- This database describes the United States space program, prior to the
-- space shuttle.
--
-- If you are concerned that NASA history is not relevant
-- to a Business-oriented student, you are wrong: Forom a business perspective
-- these are just projects, and the astronauts are "just" workers assigned to
-- one or more tasks (ie. missions).
--
-- Prior to the shuttle, NASA ran five different "manned" space projects:
--
-- Project Mercury (1961-63): The six missions of this project carried a
-- single astronaut, the 'pilot'. The first two missions were sub-orbital
--(missionType ='SO') and four missions that took the astronauts into
-- Earth orbit (missionType ='EO').
--
-- Project Gemini (1965-66): Each of the 10 manned missions of this
-- program carried two astronauts, the 'Commander' and 'Pilot', into Earth
-- orbit (missionType ='EO').(The first manned mission was number 3, the
-- first two were unmanned tests.)
--
-- Project Apollo (1967-1972): Each of these missions carried three
-- astronauts, the 'Commander', 'Command Module Pilot', and 'Lunar Module
-- Pilot. Most missions used two spacecraft, the 'Command Service Module'
--(craftType='CSM') and the 'Lunar Module' (craftType='LM'). In most
-- missions (missionType ='LL'), the Command Module Pilot would stay in
-- lunar orbit in the CSM, while the Commander and Lunar Module Pilot
-- descended in the LM. Apollo 11 was the first mission to land on the
-- moon. Earlier missions were test flights. Apollo 1 did not fly
--(hence the missionType of this mission has been left null). The crew of
-- Apollo 1 was killed while testing the spacecraft on the launch pad.
-- The first manned Apollo mission was Apollo 7. It tested a CSM in earth
-- orbit (missionType ='EO') and did not have a lunar module. Apollo 8
-- tested a CSM in lunar orbit (missionType ='LO') and also did not have
-- a lunar module. Apollo 9 tested a LM in Earth orbit, and Apollo 10
-- tested a LM in lunar orbit. From Apollo 11 onward, all missions landed
-- on the moon (missionType ='LL'), with one exception, Apollo 13, which
-- aborted its mission on the way to the moon, and looped round the moon
-- without entering orbit (a "Fly By", missionType='LF').
--
-- Project Skylab (1973): Skylab 1 was the launch of the first US space
-- station, in Earth orbit. Each of Skylab missions 2 to 4 took a
-- three-man crew to the Skylab station in an Apollo CSM. The third member
-- of each crew was called the scientist (not Lunar Module Pilot).
--
-- Project Apollo-Soyuz (1975): A three-man crew in an Apollo CSM docked
-- with a Russian Soyuz spacecraft in Earth orbit. The third member of
-- that crew was called the Docking Module Pilot (not Lunar Module Pilot).
DROP table NASA_Assigned;
DROP table NASA_SpaceCraft;
DROP table NASA_Mission;
DROP table NASA_Astronaut;
DROP table NASA_Project;
Create table NASA_Project
(
projectName char(15),
CONSTRAINT NASA_ProjectsPK PRIMARY KEY (projectName)
);
Create table NASA_Astronaut
(
astroNo integer,
astroName char(25),
birth integer,
death integer,
CONSTRAINT NASA_AstronautPK PRIMARY KEY (astroNo)
);
Create table NASA_Mission
(
projectName char(15),
missionNo integer,
missionType char(2),
launchYear integer,
launchMonth integer,
launchDay integer,
days integer,
hours integer,
minutes integer,
description char(80),
CONSTRAINT NASA_MissionPK PRIMARY KEY (projectName, missionNo),
CONSTRAINT NASA_MissionFK FOREIGN KEY (projectName) REFERENCES NASA_Project
);
Create table NASA_Assigned
(
projectName char(15),
missionNo integer,
astroNo integer,
role char(25),
CONSTRAINT NASA_AssignedPK PRIMARY KEY (projectName, missionNo, astroNo),
CONSTRAINT NASA_AssignedFK_Mission FOREIGN KEY
(projectName, missionNo) REFERENCES NASA_Mission,
CONSTRAINT NASA_AssignedFK_Astronaut FOREIGN KEY
(astroNo) REFERENCES NASA_Astronaut
);
Create table NASA_SpaceCraft
(
projectName char(15),
missionNo integer,
craftType char(10),
craftName char(20),
CONSTRAINT NASA_SpaceCraftPK PRIMARY KEY (projectName, missionNo, craftType),
CONSTRAINT NASA_SpaceCraftFK FOREIGN KEY
(projectName, missionNo) REFERENCES NASA_Mission
);
INSERT INTO NASA_Project VALUES('Mercury');
INSERT INTO NASA_Project VALUES('Gemini');
INSERT INTO NASA_Project VALUES('Apollo');
INSERT INTO NASA_Project VALUES('Skylab');
INSERT INTO NASA_Project VALUES('Apollo-Soyuz');
Insert into NASA_Astronaut VALUES(1,'Aldrin, Buzz',1930,NULL);
Insert into NASA_Astronaut VALUES(2,'Anders, William',

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Accounting

Authors: Joe Hoyle, Thomas Schaefer, Timothy Doupnik

10th edition

0-07-794127-6, 978-0-07-79412, 978-0077431808

Students also viewed these Databases questions