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

Can anyone help me with coding this? This course is about Database Systems using

ID: 3890951 • Letter: C

Question

Can anyone help me with coding this?

This course is about Database Systems using Oracle SQL developer

Table Name: Order Details Column Name Order id Prod ID Data Type Varchar2 (10) Varchar2(30) Constraints 7. Add foreign references to Order_Details table. a. Order id reference order table's order id column. b. Prod_id reference product table's product_id column 8. Add order_id and Prod_id as composite primary key to order_Details table. Drop constraint created on cty column in Customer table 10. Confirm constrains created on all tables created above. (use USER_CONS COLUMNS view)

Explanation / Answer

Hi,
Given Order_Details table has 2 fields with no constraints.
7. we can add foreign key constraint by alter table command,
command is like this,
alter table table1 add foregin key(desired column name) references table2(same column name)
alter table Order_Details add foreign key(Order_id) references Order(Order_id) ;
alter table Order_Details add foreign key(Product_id) references Product(Product_id) ;
8. to add primary key we can again use the alter command like below
ALTER TABLE Order_Details  ADD PRIMARY KEY(Order_id,Product_id);
9.Customer table definition is not given, but in a general form , you can follow the same syntax as below,
ALTER TABLE Customer DROP CONSTRAINT *constraint_name*;
10. this is a table part of data dictionary where we can see all constraints on all tables,
to get consraints of only desired tables we can filter them out like below,
SELECT * FROM user_cons_columns WHERE table_name = 'Order_Details';
Thumbs up if this was helpful, otherwise let me know in comments.

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