Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I've searched for help towards this question: CMIS 320 Project 3 1) Create Oracle database tables using SQL Data Definition Language (DDL) for each table

I've searched for help towards this question: CMIS 320 Project 3

  1. 1)Create Oracle database tables using SQL Data Definition Language (DDL) for each table listed in the metadata of Project 2. You may need to use a combination of DROP TABLE, CREATE TABLE, and ALTER TABLE SQL statements. Make sure that entity and referential integrity are enforced by declaring a primary key for each table (these may be composite keys) and declaring all appropriate foreign keys. Your CREATE TABLE and ALTER TABLE statements (if desired) must show integrity constraints, as appropriate, for NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, REFERENCES, and CHECK constraints. Be sure to save your SQL script file used to create these tables with a .sql extension and your output SPOOL file with a .lst or .txt extension. You should rerun and test your SQL script file until it runs without any errors (this is why you'll want to include DROP TABLE statements). Submit your SPOOL file showing that all SQL in your SQL script file worked properly.
  2. 2)Populate each of your tables with at least five valid rows of data each and show the SQL INSERT statements as you executed them. Populate other tables in your database, as necessary, to satisfy referential integrity. Save your SQL script file and SPOOL file with the correct extensions. You should test and rerun your SQL script file until it runs without any errors. Submit your SPOOL file showing that all SQL in your SQL script file worked properly.
  3. 3)Develop an SQL script file to perform the following queries and updates. You should test your SQL script file until it runs without any errors.

o Retrieve all of your customers' names, account numbers, and addresses (street and zip code only), sorted by account number.

o Retrieve all of the videos rented in the last 30 days and sort in chronological rental date order.

o Produce a list of your distributors and all their information sorted in order by company name.

o Update a customer name to change their maiden name to a married name. You can choose which row to update. Make sure that you use the primary key column in your WHERE clause to affect only a specific row. You may want to include a ROLLBACK statement to undo data update.

o Delete a customer from the database. You can choose which row to delete. Make sure that you use the primary key column in your WHERE clause to affect only a specific row. You may want to include a ROLLBACK statement to undo data deletion.

Submit your SPOOL file(s) showing that all SQL in your SQL script file worked properly. Show the actual SQL statements executed and the results the SQL produced below the code by making sure that you have a SET ECHO STATEMENT in your SQL script file(s).

Do NOT submit your .sql SQL script files.

I found these results from someone who've answered to another student:

CREATE TABLE MOVIES ( MOVIES_ID NUMBER(7, 0) NOT NULL , DVD_ID NUMBER(7, 0) , VIDEO_ID NUMBER(7, 0) , CONSTRAINT MOVIES_PK PRIMARY KEY ( MOVIES_ID ) ENABLE );

CREATE TABLE DVD ( DVD_ID NUMBER(7, 0) NOT NULL , CUSTOMER_ID NUMBER(7, 0) , FEES_ID NUMBER(7, 0) , PRICE_ID NUMBER(7, 0) , RENTAL_ID NUMBER(7, 0) , CONSTRAINT DVD_PK PRIMARY KEY ( DVD_ID ) ENABLE );

CREATE TABLE VIDEO ( VIDEO_ID NUMBER(7, 0) NOT NULL , CUSTOMER_ID NUMBER(7, 0) , FEES_ID NUMBER(7, 0) , PRICE_ID NUMBER(7, 0) , RENTAL_ID NUMBER(7, 0) , CONSTRAINT VIDEO_PK PRIMARY KEY ( VIDEO_ID ) ENABLE );

CREATE TABLE MOVIE_COPIES ( COPIES_ID NUMBER(7, 0) NOT NULL , RENTAL_ID NUMBER(7, 0) , AVAILABLE_RENT NUMBER(7, 0) , CONSTRAINT MOVIE_COPIES_PK PRIMARY KEY ( COPIES_ID ) ENABLE );

CREATE TABLE STORE ( STORE_ID NUMBER(7, 0) NOT NULL , SUPPLIER_ID NUMBER(7, 0) , CATALOG_ID NUMBER(7, 0) , CONSTRAINT STORE_PK PRIMARY KEY ( STORE_ID ) ENABLE );

CREATE TABLE CUSTOMER ( CUSTOMER_ID NUMBER(7, 0) NOT NULL , RENTAL_ID NUMBER(7, 0) , FIRST_NAME VARCHAR2(20) , LAST_NAME VARCHAR2(20) , CONTACT_INFO VARCHAR2(200) , CONSTRAINT CUSTOMER_PK PRIMARY KEY ( CUSTOMER_ID ) ENABLE );

CREATE TABLE MOVIE_SUPPLIER ( SUPPLIER_ID NUMBER(7, 0) NOT NULL , MOVIES_ID NUMBER(7, 0) , TYPE_DISTRIBUTED VARCHAR2(20) , ELECTRONIC_CATALOG VARCHAR2(20) , CONSTRAINT MOVIE_SUPPLIER_PK PRIMARY KEY ( SUPPLIER_ID ) ENABLE );

CREATE TABLE MOVIE_RENTAL ( RENTAL_ID NUMBER(7, 0) NOT NULL , DVD_ID NUMBER(7, 0) , VIDEO_ID NUMBER(7, 0) , COPIES_ID NUMBER(7, 0) , AVAILABLE_RENT NUMBER(7, 0) , DESCRIPTION VARCHAR2(50) , TOTAL_ORDERS NUMBER(7, 0) , TOTAL_PRICE NUMBER(7, 0) , "DATE_RENTED" DATE , CONSTRAINT MOVIE_RENTAL_PK PRIMARY KEY ( RENTAL_ID ) ENABLE );

CREATE TABLE ELECTRONIC_CATALOG ( CATALOG_ID NUMBER(7, 0) NOT NULL , MOVIES_ID NUMBER(7, 0) , MOVIE_LIST VARCHAR2(20) , TYPE_DISTRIBUTED VARCHAR2(20) , CATALOG_QUANTITY NUMBER(7, 0) , CONSTRAINT ELECTRONIC_CATALOG_PK PRIMARY KEY ( CATALOG_ID ) ENABLE );

CREATE TABLE FEES ( FEES_ID NUMBER(7, 0) NOT NULL , CUSTOMER_ID NUMBER(7, 0) , LATE_FEE NUMBER(7, 0) , REWOUND_FEE NUMBER(7, 0) , TOTAL_PRICE NUMBER(7, 0) , CONSTRAINT FEES_PK PRIMARY KEY ( FEES_ID ) ENABLE );

CREATE TABLE TRANSACTION_PRICE ( PRICE_ID NUMBER(7, 0) NOT NULL , CUSTOMER_ID NUMBER(7, 0) , TOTAL_PRICE NUMBER(7, 0) , CONSTRAINT TRANSACTION_PRICE_PK PRIMARY KEY ( PRICE_ID ) ENABLE );

alter table "YOURNAME"."MOVIES" add constraint fk_dvd foreign key("DVD_ID") references "DVD"("DVD_ID")

alter table "YOURNAME"."MOVIES" add constraint fk_video foreign key("VIDEO_ID") references "VIDEO"("VIDEO_ID")

alter table "YOURNAME"."MOVIES" add constraint uk_movies_dvdid unique("DVD_ID")

alter table "YOURNAME"."DVD" add constraint fk_customer foreign key("CUSTOMER_ID") references "CUSTOMER"("CUSTOMER_ID")

alter table "YOURNAME"."DVD" add constraint fk_fees foreign key("FEES_ID") references "FEES"("FEES_ID")

alter table "YOURNAME"."DVD" add constraint fk_price foreign key("PRICE_ID") references "TRANSACTION_PRICE"("PRICE_ID")

alter table "YOURNAME"."DVD" add constraint fk_rental foreign key("RENTAL_ID") references "MOVIE_RENTAL"("RENTAL_ID")

alter table "YOURNAME"."MOVIE_COPIES" add constraint fk_movies_rental foreign key("RENTAL_ID") references "MOVIE_RENTAL"("RENTAL_ID")

alter table "YOURNAME"."STORE" add constraint fk_supplierid foreign key("SUPPLIER_ID") references "MOVIE_SUPPLIER"("SUPPLIER_ID") alter table "YOURNAME"."STORE" add constraint fk_catalogid foreign key("CATALOG_ID") references "ELECTRONIC_CATALOG"("CATALOG_ID")

alter table "YOURNAME"."CUSTOMER" add constraint fk_customer_rentalid foreign key("RENTAL_ID") references "MOVIE_RENTAL"("RENTAL_ID")

alter table "YOURNAME"."MOVIE_SUPPLIER" add constraint fk_ms_moviesid foreign key("MOVIES_ID") references "MOVIES"("MOVIES_ID")

alter table "YOURNAME"."MOVIE_RENTAL" add constraint fk_dvdid foreign key("DVD_ID") references "DVD"("DVD_ID")

alter table "YOURNAME"."MOVIE_RENTAL" add constraint fk_videoid foreign key("VIDEO_ID") references "VIDEO"("VIDEO_ID")

alter table "YOURNAME"."MOVIE_RENTAL" add constraint fk_copiesid foreign key("COPIES_ID") references "MOVIE_COPIES"("COPIES_ID")

alter table "YOURNAME"."ELECTRONIC_CATALOG" add constraint fk_movieid foreign key("MOVIES_ID") references "MOVIES"("MOVIES_ID")

alter table "YOURNAME"."FEES" add constraint fk_customerid foreign key("CUSTOMER_ID") references "CUSTOMER"("CUSTOMER_ID")

alter table "YOURNAME"."TRANSACTION_PRICE" add constraint fk_tp_customerid foreign key("CUSTOMER_ID") references "CUSTOMER"("CUSTOMER_ID").

Can I just paste this in the Oracle SQL just as is? Areas titled "YOURNAME" should I replace that with my actual name? Or is that just a default?

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

Information Technology Project Management

Authors: Kathy Schwalbe

6th Edition

978-111122175, 1133172393, 9780324786927, 1111221758, 9781133172390, 324786921, 978-1133153726

More Books

Students also viewed these General Management questions