我有 2 个表 coursemaster 和 course subject 在 course master 我有 2 列 course code 和 course name 在 course subject 我有 course code 和 subject code。我的目标是如果我删除 course master 中的课程代码它不应该删除,如果我更新它应该得到更新并反映在课程主题中。请告诉我如何为此编写查询。
我的课程主表结构
# Name Type Collation Attributes Null Default Extra Action
1 id int(11) No None Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Fulltext Fulltext
2 course_code varchar(255) latin1_swedish_ci No None Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Fulltext Fulltext
3 course_name varchar(255) latin1_swedish_ci No None Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Fulltext Fulltext
课程科目结构
Name Type Collation Attributes Null Default Extra Action
1 id int(11) No None AUTO_INCREMENT Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Show more actions More
2 course_code varchar(255) latin1_swedish_ci No None Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Show more actions More
3 subject_code varchar(255) latin1_swedish_ci No None Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Show more actions More