0% found this document useful (0 votes)
103 views2 pages

220CT Database SQL

The document creates databases and tables to store information about space agencies, missions to the International Space Station, equipment quantities on missions, and equipment weights. It defines the structure of the tables, provides sample data, and includes queries to retrieve mission and equipment details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views2 pages

220CT Database SQL

The document creates databases and tables to store information about space agencies, missions to the International Space Station, equipment quantities on missions, and equipment weights. It defines the structure of the tables, provides sample data, and includes queries to retrieve mission and equipment details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE DATABASE ISSEquipment;

CREATE TABLE Agency(


AgcyNo
INT
NOT NULL,
LeadAgency VARCHAR(9) NOT NULL,
Country
VARCHAR(6) NOT NULL,
PRIMARY KEY (AgcyNo)
);
CREATE TABLE Mission(
MissionNo CHAR(8)
NOT NULL,
AgcyNo
INT
NOT NULL,
MissionDate DATE
NOT NULL,
TotalWeight FLOAT
NOT NULL,
PRIMARY KEY (MissionNo),
FOREIGN KEY (AgcyNo) REFERENCES Agency(AgcyNo)
);
CREATE TABLE Quantity(
MissionNo CHAR(8)
Equipment VARCHAR(24)
Qty
PRIMARY KEY (MissionNo,
);

NOT NULL,
NOT NULL,
INT
Equipment)

NOT NULL,

CREATE TABLE EquipmentWeight(


Equipment VARCHAR(24) NOT NULL,
ItemWeight FLOAT
NOT NULL,
PRIMARY KEY (Equipment)
);
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO Agency (AgcyNo,LeadAgency,Country)


(178, 'JAXA', 'Japan');
INTO Agency (AgcyNo,LeadAgency,Country)
(526, 'ESA', 'EU');
INTO Agency (AgcyNo,LeadAgency,Country)
(167, 'NASA', 'USA');
INTO Agency (AgcyNo,LeadAgency,Country)
(032, 'Roskosmos', 'Russia');

INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO Mission
('ISS-2237',
INTO Mission
('ISS-3664',
INTO Mission
('ISS-2356',
INTO Mission
('ISS-1234',

INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT

INTO Quantity (MissionNo,Equipment,Qty)


('ISS-2237', 'Portable water dispenser', 2);
INTO Quantity (MissionNo,Equipment,Qty)
('ISS-2237', 'Flexible air duct', 6);
INTO Quantity (MissionNo,Equipment,Qty)
('ISS-2237', 'Small storage rack', 4);
INTO Quantity (MissionNo,Equipment,Qty)
('ISS-3664', 'Bio filter', 6);
INTO Quantity (MissionNo,Equipment,Qty)
('ISS-2356', 'Small storage rack', 3);
INTO Quantity (MissionNo,Equipment,Qty)

(MissionNo,AgcyNo,MissionDate,Totalweight)
178, TO_DATE('20131214', 'YYYYMMDD'), 211);
(MissionNo,AgcyNo,MissionDate,Totalweight)
526, TO_DATE('20140116', 'YYYYMMDD'), 1.2);
(MissionNo,AgcyNo,MissionDate,Totalweight)
167, TO_DATE('20140212', 'YYYYMMDD'), 69);
(MissionNo,AgcyNo,MissionDate,Totalweight)
032, TO_DATE('20140416', 'YYYYMMDD'), 2.5);

VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

('ISS-2356', 'Battery Pack', 2);


INTO Quantity (MissionNo,Equipment,Qty)
('ISS-2356', 'Urine transfer tubing', 2);
INTO Quantity (MissionNo,Equipment,Qty)
('ISS-2356', 'O2 scrubber', 1);
INTO Quantity (MissionNo,Equipment,Qty)
('ISS-1234', 'Small storage rack', 1);
INTO Quantity (MissionNo,Equipment,Qty)
('ISS-1234', 'Flexible air duct', 1);

INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO EquipmentWeight (Equipment, ItemWeight)


('Portable water dispenser', 100);
INTO EquipmentWeight (Equipment, ItemWeight)
('Flexible air duct', 0.5);
INTO EquipmentWeight (Equipment, ItemWeight)
('Small storage rack', 2);
INTO EquipmentWeight (Equipment, ItemWeight)
('Bio filter', 0.2);
INTO EquipmentWeight (Equipment, ItemWeight)
('Battery Pack', 5);
INTO EquipmentWeight (Equipment, ItemWeight)
('Urine transfer tubing', 1.5);
INTO EquipmentWeight (Equipment, ItemWeight)
('O2 scrubber', 50);

Select MissionNO as "Mission", Mission.AgcyNo as "Agency No", LeadAgency as "Age


ncy", Country as "Country", MissionDate as "Date", TotalWeight as "Weight"
From Mission, Agency
Where Mission.AgcyNo = Agency.AgcyNo

Select Mission.MissionNo, Equipment, Qty


From Mission,Quantity
Where Mission.MissionNo = Quantity.MissionNo
And Mission.MissionNo = 'ISS-2237';

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy