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

1. Your are about to create a table and remember that one of the columns has to

ID: 3659412 • Letter: 1

Question

1. Your are about to create a table and remember that one of the columns has to include a NOT NULL constraint. Modify the following sql command so the column named colC cannot contain a NULL value, and then create the table. CREATE TABLE homework (colA NUMBER, colB Varchar2(20), colC DATE DEFAULT SYSDATE, colD VARCHAR2(2)); 2. Change the HOMEWORK table so colA and colB together are the primary key for the table. 3. Add a column to the HOMEWORK table with the name colE. This column should only be allowed to contain numeric values between 3 and 8. Name the constrain homework_colE_ck. 4. Change the HOMEWORK table so colB can only contain values that are stored in the Order# column of the ORDERS table. Make certain that after you make the change, colB is still part of the composite primary key created in Step 2. 5. Issue a SELECT statement that will allow you to view the conditions for all the CHECK constraints on the HOMEWORK table. 6. Add another column to the HOMEWORK table. This column should be named colF and be able to store dates. Although the column is not part of the primary key, it should not be allowed to contain any duplicate or NULL values. 7. Disable the constraint named homework_colE_ck. 8. You have decided that the primary key for the HOMEWORK table should only consist of colA. Make the changes needed to make the colA the only column used for the table's primary key. 9. Enable the constrain named homework_colE_ck. 10. Change the constrain on colB that references the ORDERS table so that if an order is deleted from the ORDERS table, any entries in the HOMEWORK table will automatically be deleted also.

Explanation / Answer

please rate it first with LifeSaver 1) CREATE TABLE homework ( colA number, colB varchar2(20), colC date default 'sysdate' NOT NULL, colD varchar2(2) ) 2) CREATE TABLE homework ( colA number, colB varchar2(20), colC date default 'sysdate' NOT NULL, colD varchar2(2), CONSTRAINT pK_id PRIMARY KEY(colA,colB) ) 3) colE number ( check colE>3 and colE