CREATE TABLE badges
(
    Id     INTEGER          not null
        primary key,
    UserId INTEGER          null,
    Name   TEXT null,
    Date   DATETIME     null,
        foreign key (UserId) references users (Id)
            on update cascade on delete cascade
);
badges
CREATE TABLE comments
(
    Id              INTEGER          not null
        primary key,
    PostId          INTEGER          null,
    Score           INTEGER          null,
    Text            TEXT     null,
    CreationDate    DATETIME     null,
    UserId          INTEGER          null,
    UserDisplayName TEXT null,
        foreign key (PostId) references posts (Id)
            on update cascade on delete cascade,
        foreign key (UserId) references users (Id)
            on update cascade on delete cascade
);
comments
CREATE TABLE postHistory
(
    Id                INTEGER          not null UNIQUE
        primary key,
    PostHistoryTypeId INTEGER          null,
    PostId            INTEGER          null,
    RevisionGUID      TEXT null,
    CreationDate      DATETIME     null,
    UserId            INTEGER          null,
    Text              TEXT     null,
    Comment           TEXT         null,
    UserDisplayName   TEXT null,
        foreign key (PostId) references posts (Id)
            on update cascade on delete cascade,
        foreign key (UserId) references users (Id)
            on update cascade on delete cascade
);
postHistory
CREATE TABLE postLinks
(
    Id            INTEGER      not null
        primary key,
    CreationDate  DATETIME null,
    PostId        INTEGER      null,
    RelatedPostId INTEGER      null,
    LinkTypeId    INTEGER      null,
        foreign key (PostId) references posts (Id)
            on update cascade on delete cascade,
        foreign key (RelatedPostId) references posts (Id)
            on update cascade on delete cascade
);
postLinks
CREATE TABLE posts
(
    Id                    INTEGER          not null UNIQUE
        primary key,
    PostTypeId            INTEGER          null,
    AcceptedAnswerId      INTEGER          null,
    CreaionDate           DATETIME     null,
    Score                 INTEGER          null,
    ViewCount             INTEGER          null,
    Body                  TEXT     null,
    OwnerUserId           INTEGER          null,
    LasActivityDate       DATETIME     null,
    Title                 TEXT null,
    Tags                  TEXT null,
    AnswerCount           INTEGER          null,
    CommentCount          INTEGER          null,
    FavoriteCount         INTEGER          null,
    LastEditorUserId      INTEGER          null,
    LastEditDate          DATETIME     null,
    CommunityOwnedDate    DATETIME    null,
    ParentId              INTEGER          null,
    ClosedDate            DATETIME     null,
    OwnerDisplayName      TEXT null,
    LastEditorDisplayName TEXT null,
        foreign key (LastEditorUserId) references users (Id)
            on update cascade on delete cascade,
        foreign key (OwnerUserId) references users (Id)
            on update cascade on delete cascade,
        foreign key (ParentId) references posts (Id)
            on update cascade on delete cascade
);
posts
CREATE TABLE tags
(
    Id            INTEGER          not null
        primary key,
    TagName       TEXT null,
    Count         INTEGER          null,
    ExcerptPostId INTEGER          null,
    WikiPostId    INTEGER          null,
    foreign key (ExcerptPostId) references posts (Id)
        on update cascade on delete cascade
);
tags
CREATE TABLE users
(
    Id              INTEGER          not null UNIQUE
        primary key,
    Reputation      INTEGER          null,
    CreationDate    DATETIME     null,
    DisplayName     TEXT null,
    LastAccessDate  DATETIME     null,
    WebsiteUrl      TEXT null,
    Location        TEXT null,
    AboutMe         TEXT     null,
    Views           INTEGER          null,
    UpVotes         INTEGER          null,
    DownVotes       INTEGER          null,
    AccountId       INTEGER          null,
    Age             INTEGER          null,
    ProfileImageUrl TEXT null
);
users
CREATE TABLE votes
(
    Id           INTEGER  not null
        primary key,
    PostId       INTEGER  null,
    VoteTypeId   INTEGER  null,
    CreationDate DATE null,
    UserId       INTEGER  null,
    BountyAmount INTEGER  null,
        foreign key (PostId) references posts (Id)
            on update cascade on delete cascade,
        foreign key (UserId) references users (Id)
            on update cascade on delete cascade
);
votes
original_column_name,column_name,column_description,data_format,value_description
Id,,the post link id,integer,
CreationDate,Creation Date,the creation date of the post link,datetime,
PostId,Post Id,the post id,integer,
RelatedPostId,Related Post Id,the id of the related post,integer,
LinkTypeId,Link Type Id,the id of the link type,integer,
postLinks
original_column_name,column_name,column_description,data_format,value_description
Id,,the comment Id,integer,
PostId,Post Id,the unique id of the post,integer,
Score,,rating score,integer,"commonsense evidence:
The score is from 0 to 100. The score more than 60 refers that the comment is a positive comment. The score less than 60 refers that the comment is a negative comment. "
Text,,the detailed content of the comment,text,
CreationDate,Creation Date,the creation date of the comment,datetime,
UserId,User Id,the id of the user who post the comment,integer,
UserDisplayName,User Display Name,user's display name,text,
comments
original_column_name,column_name,column_description,data_format,value_description
Id,,the tag id,integer,
TagName,Tag Name,the name of the tag,text,
Count,,the count of posts that contain this tag,integer,more counts --> this tag is more popular
ExcerptPostId,Excerpt Post Id,the excerpt post id of the tag,integer,
WikiPostId,Wiki Post Id,the wiki post id of the tag,text,
tags
original_column_name,column_name,column_description,data_format,value_description
Id,,the user id,integer,
Reputation,,the user's reputation,integer,"commonsense evidence:
The user with higher reputation has more influence. "
CreationDate,Creation Date,the creation date of the user account,datetime,
DisplayName,Display Name,the user's display name,text,
LastAccessDate,Last Access Date,the last access date of the user account,datetime,
WebsiteUrl,Website Url,the website url of the user account,text,
Location,,user's location,text,
AboutMe,About Me,the self introduction of the user,text,
Views,,the number of views ,integer,
UpVotes,,the number of upvotes,integer,
DownVotes,,the number of downvotes,integer,
AccountId,Account Id,the unique id of the account,integer,
Age,,user's age,integer," teenager: 13-18
 adult: 19-65
 elder: > 65"
ProfileImageUrl,Profile Image Url,the profile image url,text,
users
original_column_name,column_name,column_description,data_format,value_description
Id,,the badge id,integer,
UserId,User Id,the unique id of the user,integer,
Name,,the badge name the user obtained,text,
Date,,the date that the user obtained the badge,datetime,
badges
original_column_name,column_name,column_description,data_format,value_description
Id,,the post history id,integer,
PostHistoryTypeId,Post History Type Id,the id of the post history type,integer,
PostId,Post Id,the unique id of the post,integer,
RevisionGUID,Revision GUID,the revision globally unique id of the post,integer,
CreationDate,Creation Date,the creation date of the post,datetime,
UserId,User Id,the user who post the post,integer,
Text,,the detailed content of the post,text,
Comment,,comments of the post,text,
UserDisplayName,User Display Name,user's display name,text,
postHistory
original_column_name,column_name,column_description,data_format,value_description
Id,,the post id,integer,
PostTypeId,Post Type Id,the id of the post type,integer,
AcceptedAnswerId,Accepted Answer Id,the accepted answer id of the post ,integer,
CreaionDate,Creation Date,the creation date of the post,datetime,
Score,,the score of the post,integer,
ViewCount,View Count,the view count of the post,integer,"commonsense evidence:
Higher view count means the post has higher popularity"
Body,,the body of the post,text,
OwnerUserId,Owner User Id,the id of the owner user,integer,
LasActivityDate,Last Activity Date,the last activity date,datetime,
Title,,the title of the post,text,
Tags,,the tag of the post,text,
AnswerCount,Answer Count,the total number of answers of the post,integer,
CommentCount,Comment Count,the total number of comments of the post,integer,
FavoriteCount,Favorite Count,the total number of favorites of the post,integer,"commonsense evidence:
more favorite count refers to more valuable posts. "
LastEditorUserId,Last Editor User Id,the id of the last editor,integer,
LastEditDate,Last Edit Date,the last edit date,datetime,
CommunityOwnedDate,Community Owned Date,the community owned date,datetime,
ParentId,ParentId,the id of the parent post,integer,"commonsense evidence:
If the parent id is null, the post is the root post. Otherwise, the post is the child post of other post. "
ClosedDate,Closed Date,the closed date of the post,data_format,"commonsense evidence:
if ClosedDate is null or empty, it means this post is not well-finished
if CloseDate is not null or empty, it means this post has well-finished."
OwnerDisplayName,Owner Display Name,the display name of the post owner,text,
LastEditorDisplayName,Last Editor Display Name,the display name of the last editor,text,
posts
original_column_name,column_name,column_description,data_format,value_description
Id,,the vote id,integer,
PostId,Post Id,the id of the post that is voted,integer,
VoteTypeId,Vote Type Id,the id of the vote type,integer,
CreationDate,Creation Date,the creation date of the vote,datetime,
UserId,User Id,the id of the voter,integer,
BountyAmount,Bounty Amount,the amount of bounty,integer,
votes