7.   In conjunction with the above question, add the Patient table:

 

      PATIENT(patid, name, address, balance_owed, physid)

 

      Where patid is the primary key. As above, name should be entered. Address is a composite attribute, the same as the physician’s address, and this time, not only can we assume that patients live in Texas, but are all from either Arlington, Dallas or Ft. Worth. Physid is a foreign key that refers to our physician table. The balance_owed can not be negative).

 

CREATE TABLE patient

   

  ( patid            CHAR(9),                              

     name             CHAR(30)  NOT NULL,

  street           CHAR(20),

  city             CHAR(20)  NOT NULL,

  state            CHAR(2),  DEFAULT ‘TX’,

  zipcode          CHAR(5),

  balance_owed     DECIMAL (9,2),

  physid           CHAR(9),

  PRIMARY KEY (patid),

  FOREIGN KEY (physid) REFERENCES physician(physid),

  CHECK (city in (‘Arlington’, ‘Dallas’, ‘Ft. Worth’)),

  CHECK (balance_owed >= 0.00));