<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ![](https://img.kancloud.cn/41/e0/41e066af9a6c25a24868d9667253ec98_1241x333.jpg) ***** ## MySQL外鍵 在實際開發的項目中,一個健壯數據庫中的數據一定有很好的參照完整性。例如學生表和成績單兩張表,如果成績單中有張三的成績,學生表中張三的檔案卻被刪除了,這樣就會產生垃圾數據或者錯誤數據。為了保證數據的完整性,將兩張表之間的數據建立關系,因此就需要在成績表中添加外鍵約束。 班級表 ~~~ create table classes( id int(4) not null primary key, name varchar(36) ); ~~~ 學生表 ~~~ create table student( sid int(4) not null primary key, sname varchar(36), gid int(4) not null ); ~~~ 引入外鍵之后,外鍵列只能插入參照列存在的值,參照列被參照的值不能被刪除,這就保證了數據的參照完整性。 ### 添加外鍵 語法 ~~~ alert table 表名 add constraint 外鍵名字 foreign key(外鍵字段名) references 外表表名(主鍵字段名) ~~~ ### 驗證外鍵的作用 ~~~ insert into student (sid, sname, gid) values(1000, 'juran', 123); ~~~ ### 刪除外鍵約束 ~~~ alter table 表名 drop foreign key 外鍵名; ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看