Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a database creation script called marta-schema.sql that creates a database

ID: 3735830 • Letter: W

Question

Write a database creation script called marta-schema.sql that creates a database called marta with create table statements that create the following tables o routes with fields: route_id as the primary key route name - o stops with fields: - stop_id as the primary key stop_name - vehicle_id as the primary key - index as the primary key o vehicles with fields: o passenger_data with fields: date - route_id as a foreign key referencing route id in routes - direction - stop_id as a foreign key referencing stop_ id in stops on_number the number of people that got on the train (or 0 if there is no data) off_number the number of people that got off the train (or 0 if there is data) - vehicle_id as a foreign key referencing vehicle id in vehicles

Explanation / Answer

Unable to attach file, but you can copy the below sql's and create a sql file

CREATE DATABASE marta;

CREATE TABLE routes (

route_id int NOT NULL PRIMARY KEY,

route_name varchar(255)

);

CREATE TABLE stops (

stop_id int NOT NULL PRIMARY KEY,

stop_name varchar(255)

);

CREATE TABLE vehicles (

vehicle_id int NOT NULL PRIMARY KEY

);

CREATE TABLE PASSENGER_DATA (

INDEX1 INT NOT NULL PRIMARY KEY,

date1 DATE,

ROUTE_ID integer REFERENCES ROUTES(ROUTE_ID),

direction varchar(255),

STOP_ID integer REFERENCES STOPS(STOP_ID),

on_number int DEFAULT '0',

off_number int DEFAULT '0',

VEHICLE_ID integer REFERENCES VEHICLES(VEHICLE_ID)

);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote