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

Create two tables based on the E-R model shown in Figure 4-41 and the business r

ID: 3684891 • Letter: C

Question

Create two tables based on the E-R model shown in Figure 4-41 and the business rules in the following list for a work order tracking database. Include all the constraints in the CREATE TABLE statements. You should have only two CREATE TABLE statements and no ALTEE TABLE statements. Name all constraints except NOT NULLs. Figure 4-41 Workorders E-R model Use your judgment for column datatypes and sizes. Proj# and Wo# are used to uniquely identify rows in these tables. Each project added must be assigned a name, and no duplicate project names are allowed. Each work order must be assigned to a valid project when added and be assigned a description and number of hours. Each work order added must have a different description. The number of hours assigned to a work order should be greater than zero. If data is provided for the Wo_complete column, only Y or N are acceptable values. Create and execute the SQL statements needed to enforce the data relationships among these tables.

Explanation / Answer

CREATE TABLE project(p_name   varchar(10) PRIMARY KEY,p_desc varchar(20),p_budget number ,UNIQUE(p_desc,p_budget))

/*creating work order table*/

CREATE TABLE work_order(wo_desc varchar(20) PRIMARY KEY,wo_hours number CHECK ( wo_hours >0),wo_assigned varchar(10), wo_start DATE,wo_due DATE, wo_complete bit(1) UNIQUE(wo_hours,wo_assigned,wo_start,wo_due,wo_complete), FOREIGN KEY(wo_desc) REFERENCES project(p_name))

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