帮我上传资料库 [英] help me upload data base

查看:56
本文介绍了帮我上传资料库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在数据库中创建一个表,但是出现错误

我的代码有什么问题

代码

I want to create a table in the data base but the error

what''s wrong with my code

code

CREATE TABLE ad_banners (
  aid           int(11)  DEFAULT ''0'' NOT NULL auto_increment,
  name          tinytext, 
  description   tinytext, 
  size          varchar(7), 
  file_type     varchar(4),
  status        varchar(1), 
  date          datetime, 
  url           tinytext, 
  PRIMARY KEY (aid)
);


CREATE TABLE ad_errors (
  date            datetime,
  cid             int(11),
  aid             int(11),
  pid             int(11),
  http_referer    tinytext,
  remote_addr     varchar(15),
  http_user_agent tinytext,
  error           text,
  request_uri     tinytext
);


CREATE TABLE ad_groups (
  gid          char(16)  DEFAULT '''' NOT NULL,
  aid          int(11)   DEFAULT ''0'' NOT NULL,
  date         int(11),
  nweight_lb   double(6,4),
  nweight_ub   double(6,4),
  KEY gid (gid)
);


CREATE TABLE ad_partners (
  pid           int(11)  DEFAULT ''0'' NOT NULL auto_increment,
  status        char(16), 
  gid           char(16), 
  expire_date   int(11)  DEFAULT ''0'' NOT NULL,
  PRIMARY KEY (pid)
);


CREATE TABLE ad_summary (
  pid        int(11)  DEFAULT ''0'' NOT NULL,
  aid        int(11)  DEFAULT ''0'' NOT NULL,
  date       int(11)  DEFAULT ''0'' NOT NULL,
  date_year  int(6)   DEFAULT ''0'' NOT NULL,
  date_month tinyint(4)  DEFAULT ''0'' NOT NULL,
  date_mday  tinyint(4)  DEFAULT ''0'' NOT NULL,
  date_wday  tinyint(4)  DEFAULT ''0'' NOT NULL,
  date_hour  tinyint(4)  DEFAULT ''0'' NOT NULL,
  hits       int(11), 
  clicks     int(11), 
  mid        tinyint(4),  
  KEY pid (pid),
  KEY aid (aid),
  KEY date (date)
);


CREATE TABLE clients_1 (
  cid             int(11)     DEFAULT ''0'' NOT NULL auto_increment,
  remote_addr     varchar(15) DEFAULT '''' NOT NULL,
  http_user_agent tinytext,
  mid             tinyint(4)  DEFAULT ''0'' NOT NULL,
  PRIMARY KEY (cid)
);


CREATE TABLE hits_1 (
  cid                 int(11)  DEFAULT ''0'' NOT NULL,
  sid                 int(11)  DEFAULT ''0'' NOT NULL,
  pid                 int(11)  DEFAULT ''0'' NOT NULL,
  aid                 int(11)  DEFAULT ''0'' NOT NULL,
  date                int(11), 
  remote_addr         varchar(15)   DEFAULT '''' NOT NULL,
  http_referer_host   tinytext, 
  http_referer_query  tinytext, 
  http_user_agent     tinytext, 
  mid                 tinyint(4)  DEFAULT ''0'' NOT NULL
);


CREATE TABLE tracking_sites (
  sid   int(11) DEFAULT ''0'' NOT NULL auto_increment,
  name  tinytext,
  PRIMARY KEY (sid)
);


CREATE TABLE tracking_summary (
  sid        int(11)  DEFAULT ''0'' NOT NULL,
  date       int(11)  DEFAULT ''0'' NOT NULL,
  date_year  int(6)  DEFAULT ''0'' NOT NULL,
  date_month tinyint(4) DEFAULT ''0'' NOT NULL,
  date_mday  tinyint(4) DEFAULT ''0'' NOT NULL,
  date_wday  tinyint(4) DEFAULT ''0'' NOT NULL,
  date_hour  tinyint(4) DEFAULT ''0'' NOT NULL,
  hits       int(11),
  clicks     int(11),
  mid        tinyint(4) DEFAULT ''0'',
  KEY sid (sid),
  KEY date (date)
);



错误
#1067-''aid''
的默认值无效 :confused :: confused:




Error
#1067 - Invalid default value for ''aid''
:confused::confused:


CREATE TABLE ad_banners(
aid int( 11 ) DEFAULT ''0'' NOT NULL AUTO_INCREMENT ,
name tinytext,
description tinytext,
size varchar( 7 ) ,
file_type varchar( 4 ) ,
STATUS varchar( 1 ) ,
date datetime,
url tinytext,
PRIMARY KEY ( aid )
);


#1067-''aid''
的默认值无效
您能帮我吗?


#1067 - Invalid default value for ''aid''

Can you help me

推荐答案

我建​​议购买一本有关SQL的基本书.引号中的任何内容都是字符串.您的int类型应该具有默认值0,而不是"0"
I suggest buying a basic book on SQL. Anything in quotes is a string. Your int type should have a default value of 0, not ''0''


我已将"0"更改为0,但仍然存在相同的错误

您能提供更多我还在学习的细节吗?

:confused :: confused::doh:
I''ve changed ''0 '' to 0 but still the same error

Can you provide more detail I am still learning

:confused::confused: :doh:


int不允许大小.

因此您不应该指定int(11).

int doesnt allow size.

so you shouldnt be specifying int(11).

CREATE TABLE ad_banners(
aid int DEFAULT '0' NOT NULL ...



这是您指定的...
; P



This is what you specify...
;P


这篇关于帮我上传资料库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆