• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            tqsheng

            go.....
            隨筆 - 366, 文章 - 18, 評論 - 101, 引用 - 0
            數據加載中……

            mysql創建表

            1
            2
            3
            4
            5
            6
            7
            8
            9
            10
            11
            12
            13
            14
            15
            16
            17
            18
            19
            20
            21
            22
            23
            24
            25
            26
            27
            28
            29
            30
            31
            32
            33
            34
            35
            36
            37
            38
            39
            40
            41
            42
            43
            44
            45
            46
            47
            48
            49
            50
            51
            52
            53
            54
            55
            56
            57
            58
            59
            60
            61
            62
            63
            64
            65
            66
            67
            68
            69
            70
            71
            72
            73
            74
            75
            76
            77
            78
            79
            80
            81
            82
            83
            84
            85
            86
            87
            88
            89
            90
            91
            92
            93
            94
            說明:此文件包含了blog數據庫中建立所有的表的Mysql語句.
             
            在sql語句中注意“約束的概念":
            1.實體完整性約束(主鍵--唯一且非空) primary key()
                違約處理:No action(拒絕執行)
             
            2.參照完整性約束(外鍵約束)foregin key() references tableName(filedName) [on delete|update casecade | no action]
              違約處理:級聯更新或拒絕執行
             
            3.用戶自定義完整性約束(not null,unique,check短語)
                  違約處理:拒絕執行
             
            //添加列語法
            //【alter table blog_article add columName type constraint
            //添加約束例子
            //【alter table blog_article add CONSTRAINT foreign key(category_Name) references blog_category(category_Name) on delete cascade on update cascade
             
             
            問題:如何讓相冊,相片,文章公用一個評論表?
             
            create database blog;
             
            create table blog_user
            (
              user_Name char(15) not null check(user_Name !=''),
              user_Password char(15) not null,
              user_emial varchar(20) not null unique,
              primary key(user_Name)         
             
            )engine=innodb default charset=utf8 auto_increment=1;
             
             
             
             
            create table blog_category
            (
             category_Name char(18) not null check(category_Name!=''),
             category_Date datetime not null,
             primary key(category_Name)
            )engine=innod default charset=utf8 auto_increment=1;
             
             
             
             
            create table blog_article
            (
              article_Id int unsigned not null  auto_increment,
              article_title varchar(20) not null unique,
              article_content longtext not null,
              article_date datetime not null,
              article_readTime int unsigned not null default 0,
              user_Name char(15) not null,
              category_Name char(18) not null,
              primary key(article_Id),
              foreign key(user_Name) references blog_user(user_Name) on delete cascade on update cascade,
              foreign key(category_Name) references blog_category(category_Name) on delete cascade on update cascade
            )engine=innodb default charset=utf8 auto_increment=1;
             
             
             
             
             
             
            CREATE TABLE blog_comment (
              comment_Id int(10) unsigned NOT NULL AUTO_INCREMENT,
              comment_Content varchar(90) NOT NULL,
              comment_Date datetime NOT NULL,
              article_Id int(10) unsigned NOT NULL,
              user_Name char(15) NOT NULL,
              PRIMARY KEY (comment_Id),
              foreign key(article_Id) references blog_article(article_Id) on delete cascade on update cascade,
              foreign key(user_Name) references blog_user(user_Name) on delete cascade on update cascade
            )engine=innodb default charset=utf8 auto_increment=1;
             
             
             
            create table blog_photoAlbum
            (
              photoAlbum_Name char(20) not null check(photoAlbum_Name!=''),
              photoAlbum_Date datetime not null,
              primary key(photoAlbum_Name)
            )engine=innodb default charset=utf8;
             
             
             
             
            create table blog_photograph
            (
              photograph_Name varchar(20) not null check(photograph_Name!=''),
              photograph_Date datetime not null,
              photoAlbum_Name char(20)  not null,
              photoURL varchar(90) not null,
              foreign key(photoAlbum_Name) references blog_photoAlbum(photoAlbum_Name) on delete cascade on update cascade
            )engine=innodb default charset=utf8;

            posted on 2014-06-13 11:41 tqsheng 閱讀(848) 評論(0)  編輯 收藏 引用

            亚洲国产成人久久综合一区77| 久久国产乱子伦免费精品| 国产精品久久久天天影视| …久久精品99久久香蕉国产| 国产精品美女久久久久AV福利| 久久久久久狠狠丁香| 精品国产综合区久久久久久| 波多野结衣久久精品| segui久久国产精品| 亚洲国产精品高清久久久| 久久99精品久久久久久不卡| 国产精品中文久久久久久久 | 久久精品国产秦先生| 久久国产精品二国产精品| 精品久久久久久成人AV| 久久午夜无码鲁丝片午夜精品| 亚洲AV无码久久精品蜜桃| 久久国产成人午夜AV影院| 97久久精品国产精品青草| 久久九九兔免费精品6| 九九久久精品无码专区| 色综合久久综精品| 久久久久久久亚洲Av无码| 久久久久久久综合狠狠综合| 综合久久精品色| 99久久综合国产精品二区| 青青草原综合久久| 久久久国产视频| 久久精品国产WWW456C0M| 久久97久久97精品免视看秋霞| 久久精品人成免费| 久久久久亚洲av无码专区导航| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 国产成人久久精品区一区二区| 亚洲欧美日韩中文久久| 久久精品一区二区三区AV| 久久精品国产2020| 亚洲va久久久噜噜噜久久| 无码国内精品久久人妻蜜桃 | 91视频国产91久久久| 2021精品国产综合久久|