ALTER   TABLE   Order_Items   
        ADD   CONSTRAINT   Order_Items_Product_ID_FK   
              FOREIGN   KEY   (Product_Id)   
                      REFERENCES   Product_Information   
                      ON   DELETE   CASCADE;

为表order_items(Product_id)添加一个外键Order_Items_Product_ID_FK   
  级联product_Information(product_id),加上ON   DELETE   CASCADE后,如果主表order_items删除   一条记录,那么product_Information中对应的关联   的数据也跟着删除  

 

相关文章:

  • 2021-07-02
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-25
  • 2021-06-24
  • 2021-05-21
  • 2021-05-15
相关资源
相似解决方案