questionnaire.sql

来自「显示投票,投票结果确认,用户查看投票结果,处理中文字符串及换行的自定义函数文件」· SQL 代码 · 共 82 行

SQL
82
字号
/*==============================================================*/
/* Database name:  PhysicalDataModel_1                          */
/* DBMS name:      Microsoft SQL Server 2000                    */
/* Created on:     2003-4-16 8:59:11                            */
/*==============================================================*/


alter table dbo.Items
   drop constraint FK_ITEMS_QUESTIONI_QUESTION
go


if exists (select 1
            from  sysobjects
           where  id = object_id('dbo.Admins')
            and   type = 'U')
   drop table dbo.Admins
go


if exists (select 1
            from  sysobjects
           where  id = object_id('dbo.Items')
            and   type = 'U')
   drop table dbo.Items
go


if exists (select 1
            from  sysobjects
           where  id = object_id('dbo.Questions')
            and   type = 'U')
   drop table dbo.Questions
go


/*==============================================================*/
/* Table: Admins                                                */
/*==============================================================*/
create table dbo.Admins (
   Admname              varchar(50)          not null,
   Admpwd               varchar(50)          not null,
   constraint PK_ADMIN primary key clustered (Admname)
)
go


/*==============================================================*/
/* Table: Items                                                 */
/*==============================================================*/
create table dbo.Items (
   ItemID               int                  identity,
   QuestionID           int                  not null,
   Item                 varchar(500)         not null,
   ItemCount            bigint               not null default 0,
   constraint PK_ITEMS primary key clustered (ItemID)
)
go


/*==============================================================*/
/* Table: Questions                                             */
/*==============================================================*/
create table dbo.Questions (
   QuestionID           int                  identity,
   Question             varchar(500)         not null,
   IsVisable            int                  not null default 0,
   Date                 varchar(50)          null,
   IsOpen               int                  null default 1,
   constraint PK_QUESTIONS primary key clustered (QuestionID)
)
go


alter table dbo.Items
   add constraint FK_ITEMS_QUESTIONI_QUESTION foreign key (QuestionID)
      references dbo.Questions (QuestionID)
go

insert into Admins values('admin','admin')
go

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?