Do My Homework / Homework Help Answers / Data Science Homework Help / Convert ER Diagram to Relational Database

Convert ER Diagram to Relational Database

Need help with this question or any other Data Science assignment help task?

Convert ER Diagram to Relational Database, below is my answer, please help me check. thank you CREATE SCHEMA "cs220p_hw"; CREATE TYPE "kinds" AS ENUM ( 'mobile', 'home', 'work' ); CREATE TYPE "frequencies" AS ENUM ( 'once', 'daily', 'weekly', 'monthly', 'quarterly', 'yearly' ); CREATE TYPE "formats" AS ENUM ( 'png', 'jpeg', 'mp4' ); CREATE TABLE "cs220p_hw"."Users" ( "user_id" integer PRIMARY KEY, "email" text UNIQUE NOT NULL, "joined_date" date NOT NULL, "address_street" text NOT NULL, "address_city" text NOT NULL, "address_state" text NOT NULL, "address_zip" text NOT NULL, "categories" text[] NOT NULL, "name_firstname" text NOT NULL, "name_lastname" text NOT NULL ); CREATE TABLE "cs220p_hw"."Users_categories" ( "user_id" integer NOT NULL, "categories" text[] NOT NULL, PRIMARY KEY ("user_id", "categories") ); CREATE TABLE "cs220p_hw"."Users_phone" ( "user_id" integer, "phone_kind" text, "phone_number" text, PRIMARY KEY ("user_id", "phone_number") ); CREATE TABLE "cs220p_hw"."Seller" ( "seller_id" integer PRIMARY KEY NOT NULL, "website" text NOT NULL ); CREATE TABLE "cs220p_hw"."Buyer" ( "buyer_id" integer PRIMARY KEY NOT NULL ); CREATE TABLE "cs220p_hw"."Ad" ( "ad_id" integer PRIMARY KEY, "plan" text NOT NULL, "content" text, "seller_id" integer, "item_id" integer, "pic_id" integer, "placed_date" date ); CREATE TABLE "cs220p_hw"."Picture" ( "pic_id" integer, "pic_num" integer, "format" formats NOT NULL, "url" text NOT NULL, "item_id" integer, PRIMARY KEY ("pic_id", "pic_num") ); CREATE TABLE "cs220p_hw"."Item" ( "item_id" integer PRIMARY KEY, "list_date" date, "purchase_date" date, "name" char(20) NOT NULL, "price" integer NOT NULL, "category" char(20) NOT NULL, "description" text, "service_id" integer, "good_id" integer ); CREATE TABLE "cs220p_hw"."Good" ( "good_id" integer PRIMARY KEY NOT NULL ); CREATE TABLE "cs220p_hw"."Service" ( "frequency" frequencies NOT NULL, "service_id" integer PRIMARY KEY NOT NULL ); CREATE TABLE "cs220p_hw"."ratings" ( "buyer_id" integer, "seller_id" integer, "quality" integer, "price" integer NOT NULL, "delivery" text, "rating_date" date, PRIMARY KEY ("buyer_id", "seller_id") ); ALTER TABLE "cs220p_hw"."Users" ADD FOREIGN KEY ("categories") REFERENCES "cs220p_hw"."Users_categories" ("categories") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."Users_categories" ADD FOREIGN KEY ("user_id") REFERENCES "cs220p_hw"."Users" ("user_id") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."Users_phone" ADD FOREIGN KEY ("user_id") REFERENCES "cs220p_hw"."Users" ("user_id") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."Seller" ADD FOREIGN KEY ("seller_id") REFERENCES "cs220p_hw"."Users" ("user_id") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."Buyer" ADD FOREIGN KEY ("buyer_id") REFERENCES "cs220p_hw"."Users" ("user_id") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."Ad" ADD FOREIGN KEY ("seller_id") REFERENCES "cs220p_hw"."Seller" ("seller_id"); ALTER TABLE "cs220p_hw"."Ad" ADD FOREIGN KEY ("item_id") REFERENCES "cs220p_hw"."Item" ("item_id"); ALTER TABLE "cs220p_hw"."Ad" ADD FOREIGN KEY ("pic_id") REFERENCES "cs220p_hw"."Picture" ("pic_id"); ALTER TABLE "cs220p_hw"."Picture" ADD FOREIGN KEY ("item_id") REFERENCES "cs220p_hw"."Item" ("item_id") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."Item" ADD FOREIGN KEY ("service_id") REFERENCES "cs220p_hw"."Service" ("service_id"); ALTER TABLE "cs220p_hw"."Item" ADD FOREIGN KEY ("good_id") REFERENCES "cs220p_hw"."Good" ("good_id"); ALTER TABLE "cs220p_hw"."Good" ADD FOREIGN KEY ("good_id") REFERENCES "cs220p_hw"."Item" ("item_id") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."Service" ADD FOREIGN KEY ("service_id") REFERENCES "cs220p_hw"."Item" ("item_id") ON DELETE CASCADE; ALTER TABLE "cs220p_hw"."ratings" ADD FOREIGN KEY ("buyer_id") REFERENCES "cs220p_hw"."Buyer" ("buyer_id"); ALTER TABLE "cs220p_hw"."ratings" ADD FOREIGN KEY ("seller_id") REFERENCES "cs220p_hw"."Seller" ("seller_id");
Additional Instructions:
User SellerBuyer Item ServiceGood Ad Picture user_id email phone number kind address street city state zip categories joined_date ad_id plan item_id price description frequency name category name first last rating website Frequencies: once, daily, weekly, monthly, quarterly, yearly Phone kinds: mobile, home, work Picture formats: png, jpeg, mp4, … pic_num format url content User SellerBuyer IsA not disjoint covering Item ServiceGood IsA NM Ratings N1 Sells N 1 Buys Ad 1 N About Placed 1 N Picture View 1 N Use 1N purchase_date quality pricing delivery placed_date ratee disjoint covering rater rating_date list_date
There are no answers to this question.
Login to buy an answer or post yours. You can also vote on other others

Get Help With a similar task to - Convert ER Diagram to Relational Database

Related Questions

Similar orders to Convert ER Diagram to Relational Database
Popular Services
Tutlance Experts offer help in a wide range of topics. Here are some of our top services: