0

嗨,我曾在 mssql 数据库上工作并编写了一个用于创建表的查询,如下所示

CREATE TABLE [dbo].[Extb_History](
    [ExtbHistoryID] [int] IDENTITY(1,1) NOT NULL,
    [SiteID] [int] NOT NULL,
    [StartTime] [datetime] NOT NULL,
    [EndTime] [datetime] NULL,
    [Count] [int] NULL,
    [ExceptionID] [int] NULL,
PRIMARY KEY CLUSTERED ([ExtbHistoryID] ASC) 
WITH 
(
  PAD_INDEX  = OFF
  , STATISTICS_NORECOMPUTE  = OFF
  , IGNORE_DUP_KEY = OFF
  , ALLOW_ROW_LOCKS  = ON
  , ALLOW_PAGE_LOCKS  = ON
) ON [PRIMARY]
) ON [PRIMARY]

如何在Mysql数据库中编写上述查询来创建表,

我尝试通过更改数据类型和语法,但在主键概念附近出现错误,任何人都可以帮助我在 mysql 中编写上述查询,这将非常有用,我真的很震惊

4

2 回答 2

0

语法在这里:

http://dev.mysql.com/doc/refman/5.1/en/create-table.html

你需要类似的东西(未经测试!):

create table extb_history
(
exthistoryb int auto_increment
, siteid int not null
, starttime date not null
, endtime datetime not null
, count int null
, exceptionid int null
, primary key(exthistoryid)
) ENGINE = InnoDB
于 2012-08-23T07:21:46.780 回答
0

像这样的东西:

CREATE TABLE Extb_History
(
    ExtbHistoryID INT NOT NULL AUTO_INCREMENT,
    SiteID INT NOT NULL,
    StartTime DATETIME NOT NULL, 
    EndTime DATETIME NULL, 
    Count INT NULL,
    ExceptionID INT NULL,
    PRIMARY KEY(ExtbHistoryID)
);
于 2012-08-23T07:22:24.603 回答