• <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)  編輯 收藏 引用

            久久久久久曰本AV免费免费| 99久久99这里只有免费的精品| 国产成人精品久久亚洲| 久久夜色撩人精品国产| 一本综合久久国产二区| 亚洲精品美女久久久久99| 亚洲国产精品久久久久婷婷软件| 久久久久久毛片免费看| 久久国产精品无码一区二区三区| 久久久久免费精品国产 | 色妞色综合久久夜夜| 久久久久久狠狠丁香| 色青青草原桃花久久综合| 99久久99这里只有免费费精品| 久久精品中文字幕一区| av无码久久久久不卡免费网站| 亚洲精品成人网久久久久久| 国产亚洲精品美女久久久| 日韩电影久久久被窝网| 久久国产高清字幕中文| 天天躁日日躁狠狠久久| 久久综合视频网站| 91久久香蕉国产熟女线看| 国产精品久久国产精麻豆99网站| 久久久久久久综合狠狠综合| 久久精品成人欧美大片| 麻豆精品久久精品色综合| 精品久久久久久无码专区不卡| 欧美精品乱码99久久蜜桃| 无码任你躁久久久久久| 久久精品国产精品亚洲艾草网美妙 | 久久免费线看线看| 国产精品视频久久久| 99久久精品毛片免费播放| 久久精品国产亚洲av日韩| 97久久国产露脸精品国产| 久久精品中文无码资源站| 久久中文字幕人妻丝袜| 色婷婷综合久久久久中文一区二区 | 亚洲天堂久久精品| 精品国产青草久久久久福利|