Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Help Writing SQL Statements to execute the Following Outputs -- PointType(ObjectID, POIType) INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0001','HEALTH'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0002','HEALTH'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0002','EDUCATION');

Need Help Writing SQL Statements to execute the Following Outputs

image text in transcribed

image text in transcribedimage text in transcribed
-- PointType(ObjectID, POIType) INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0001','HEALTH'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0002','HEALTH'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0002','EDUCATION'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0003','SHOP'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0003','RESTAURANT'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0003','EDUCATION'); INSERT INTO POINTTYPE(OBJECTID,POITYPE) VALUES('OB0004','RESTAURANT');
-- CoorList(ObjectID, seq, latitude, longitude) INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0001',1,-37.7165034946963,145.044463275136); INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0002',1,-37.7159485624738,145.044602254161); INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0003',1,-37.7207406054656,145.048412595785); INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0004',1,-37.7169373598005,145.042208174991); INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0005',1,-37.7249467206605,145.02859153949); INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0006',1,-37.7255486964516,145.027340728258); INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0007',1,-37.7128276457071,145.047599403033); INSERT INTO COORLIST(ObjectID,SEQ,LATITUDE,LONGITUDE) VALUES('OB0008',1,-37.7134977802475,145.048006413037);
-- Modified (admin_id, object_id, modifiedDate, reason) INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM01','OB0001','05-Nov-17','New Data'); INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM05','OB0002','05-Nov-17','New Data'); INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM03','OB0003','09-Dec-17','New Data'); INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM04','OB0004','10-Dec-17','New Data'); INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM05','OB0005','15-Dec-17','New Data'); INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM01','OB0006','02-Jan-18','New Data'); INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM03','OB0007','03-Jan-18','New Data'); INSERT INTO MODIFIED(ADMINID,OBJECTID,MODIFIEDDATE,REASON) VALUES('ADM01','OB0008','04-Jan-18','New Data');
-- Trajectory (trajID, trajDateTime, trajDuration, trajDistance, lastUpdate, contributorID) INSERT INTO TRAJECTORY(TRAJID,TRAJDATETIME,TRAJDURATION,TRAJDISTANCE,LASTUPDATE,CONTRIBUTORID) VALUES('TRJ0001','17-Jun-2018',INTERVAL '00:46:37.50' HOUR TO SECOND(2),1.84,'20-Jun-2018','C0001'); INSERT INTO TRAJECTORY(TRAJID,TRAJDATETIME,TRAJDURATION,TRAJDISTANCE,LASTUPDATE,CONTRIBUTORID) VALUES('TRJ0002','26-Aug-2018',INTERVAL '00:36:25.80' HOUR TO SECOND(2),2.39,'05-Sep-2018','C0006'); INSERT INTO TRAJECTORY(TRAJID,TRAJDATETIME,TRAJDURATION,TRAJDISTANCE,LASTUPDATE,CONTRIBUTORID) VALUES('TRJ0003','30-Aug-2018',INTERVAL '00:32:35.34' HOUR TO SECOND(2),2.34,'02-Sep-2018','C0003'); INSERT INTO TRAJECTORY(TRAJID,TRAJDATETIME,TRAJDURATION,TRAJDISTANCE,LASTUPDATE,CONTRIBUTORID) VALUES('TRJ0004','09-Sep-2018',INTERVAL '00:22:06.00' HOUR TO SECOND(2),1.2,'20-Mar-2019','C0004'); INSERT INTO TRAJECTORY(TRAJID,TRAJDATETIME,TRAJDURATION,TRAJDISTANCE,LASTUPDATE,CONTRIBUTORID) VALUES('TRJ0005','15-Dec-2018',INTERVAL '00:07:15.00' HOUR TO SECOND(2),0.92,'15-Dec-2018','C0005');
-- TrajectoryPoint(trajID, tpTIMESTAMP, latitude, longitude) INSERT INTO TRAJECTORYPOINT(TRAJID,TPTIMESTAMP,LATITUDE,LONGITUDE) VALUES('TRJ0001',TO_TIMESTAMP('17-Jun-2018 10:54:23.00','DD-Mon-YYYY HH24:MI:SS.FF'),-37.7207406054656,145.048412595785); INSERT INTO TRAJECTORYPOINT(TRAJID,TPTIMESTAMP,LATITUDE,LONGITUDE) VALUES('TRJ0001',TO_TIMESTAMP('17-Jun-2018 10:59:21.08','DD-Mon-YYYY HH24:MI:SS.FF'),-37.7210905706156,145.047197396502); INSERT INTO TRAJECTORYPOINT(TRAJID,TPTIMESTAMP,LATITUDE,LONGITUDE) VALUES('TRJ0001',TO_TIMESTAMP('17-Jun-2018 11:01:18.98','DD-Mon-YYYY HH24:MI:SS.FF'),-37.7211312581483,145.046322946861); INSERT INTO TRAJECTORYPOINT(TRAJID,TPTIMESTAMP,LATITUDE,LONGITUDE) VALUES('TRJ0001',TO_TIMESTAMP('17-Jun-2018 11:02:46.52','DD-Mon-YYYY HH24:MI:SS.FF'),-37.7220211795154,145.04638912735); INSERT INTO TRAJECTORYPOINT(TRAJID,TPTIMESTAMP,LATITUDE,LONGITUDE) VALUES('TRJ0001',TO_TIMESTAMP('17-Jun-2018 11:05:32.66','DD-Mon-YYYY HH24:MI:SS.FF'),-37.7222933886218,145.047037696137); INSERT INTO TRAJECTORYPOINT(TRAJID,TPTIMESTAMP,LATITUDE,LONGITUDE) VALUES('TRJ0001',TO_TIMESTAMP('17-Jun-2018 11:09:29.66','DD-Mon-YYYY HH24:MI:SS.FF'),-37.7222672147127,145.047964222975); INSERT INTO TRAJECTORYPOINT(TRAJID,TPTIMESTAMP,LATITUDE,LONGITUDE) VALUES('TRJ0001',TO_TIMESTAMP('17-Jun-2018 11:12:03.86','DD-Mon-YYYY HH24:MI:SS.FF'),-37.722518483858,145.048308361515);
The list of tables available for this assignment is the following: Contributor (contributorID, points) Administrator (adminID, email, name, ContributorID) Member (memberID, email, name, joinDate, ContributorID) Objects (ObjectID, ObjectType, POIName,RoadName, Length, SuburbName, Area, roadType) PointType(ObjectID, POIType) CoorList(ObjectID, seq, latitude, longitude) Trajectory (trajID, trajDateTime, trajDuration, trajDistance, lastUpdate, contributorID) TrajectoryPoint(trajID, tpTimestamp, latitude, longitude) Modified (admin_id, object_id, modifiedDate, reason) It doesn't allow me to update because it is too long.
b. Find the user who visited McDonalds during their trip [10 marks] TRAJID CONTRIBUTORID NAME 1 TRJO001 C0001 Marisa Power 2 TRJO005 C0005 Roosevelt John c. Show the ID, name and number of submitted trajectories from all contributors. Sort the result based on the number of contributions [10 marks] ID NAME CONTRIBUTORID NUM_OF_TRAJS 1 acomat Allan Smith C0002 2 rubix Persephone Perry C0003 3 rollis Kishan Joyce C0006 4 wingman Norah Boyce C0007 5 ADMO1 Marisa Power C0001 6 tracker Amy Hatfield C0004 7 ADMO4 Roosevelt John C0005 d. Display the number of trajectories that went through Plenty roads [10 marks). NUM_TRAJ 1 e. Display the firstly registered member name [10 marks]. NAME JOINDATE 1 Keegan Healy 09/MAY/18 CREATE TABLE CONTRIBUTOR CONTRIBUTORID POINTS ) CH(5) PRIMARY KEY, (5) MBER (2) CREATE TABLE ADMINISTRATOR ADMINID EMAIL NAVE CONTRIBUTORID ) CHAR(S) PRIMARY KEY, VARCHAR2(50) UNIQUE NOT NULL, VARCHAR2(20) CHAR(S) REFERENCES CONTRIBUTOR CREATE TABLE MEMBER MEMBERID EMAIL BONDATE CONTRIBUTORID ) NAVE CHAR(8) PRIMARY KEY, VARCHAR2(50) UNIQUE NOT MILL, VARCHAR(20), DATE, CHAR(5) REFERENCES CONTRIBUTOR CREATE TABLE BOECTS OBJECTID OBJECTTYPE POENAME ROADWARE LENGTH ROAD TYPE REGION NAME AREA CHAR(8) PRIMARY KEY, VARCHAR2(6) CHECK (OBJECTTYPE IN ('POINT","ROAD", "REGION")) NOT NILL, VARCHAR2(0), NYBER (6,4). VARCHAR2(25) DEOK (ROADTYPE IN ("HIGHLAY','PRIMARY', 'RESIDENTIAL', 'FOOTPATH')). VARCHAR2(5e). MBER (4,2) CREATE TABLE POINTTYPE OBJECTID POLTYPE PRIMARY KEY (OBJECTID, POTTYPE) ) CHAR(8) REFERENCES OBJECTS, VARCHAR2(15) DEOK (POI TYPE IN ('RESTAURANT, 'SHOP, "EDUCATION', 'HEALTH", "OTHERS')).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

More Books

Students also viewed these Databases questions

Question

How does salinity affect nutrient availability

Answered: 1 week ago

Question

1. What will happen in the future

Answered: 1 week ago