表内容
DROP TABLE IF EXISTS `login`.`t_user`;
CREATE TABLE `login`.`t_user` (
`id` int(11) NOT NULL default '0',
`username` varchar(20) default NULL,
`password` varchar(20) default NULL,
`age` varchar(2) default NULL,
`sex` varchar(2) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t_user(id,username,password,age,sex) values(1,'aaa','bbb','ccc','ddd');
往表中插入数据时提示ERROR 1064(42000);You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near '' at line 1;
这倒是什么错啊,我换着法插入数据,但还是提示这个错误。
DROP TABLE IF EXISTS `login`.`t_user`;
CREATE TABLE `login`.`t_user` (
`id` int(11) NOT NULL default '0',
`username` varchar(20) default NULL,
`password` varchar(20) default NULL,
`age` varchar(2) default NULL,
`sex` varchar(2) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t_user(id,username,password,age,sex) values(1,'aaa','bbb','ccc','ddd');
往表中插入数据时提示ERROR 1064(42000);You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near '' at line 1;
这倒是什么错啊,我换着法插入数据,但还是提示这个错误。
values(1,'aaa','bbb','ccc','ddd');
1、数据库中的表在MYSQL中不能创建,提示ERROR 1064错误
2、在MYECLIPSE中,有个包报错
请大家帮忙看看,怎么才能正常运行,多谢多谢
package com.itstar.util;import java.io.IOException;import javax.security.sasl.SaslException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;public class FilterTest<FilterConfig, FilterChain> implements Filter
{
private FilterConfig config;
public void destroy()
{
this.config = null;
} public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
{
try
{
Object config;
String encod = ((Object) config).getInitParameter("encod");
request.setCharacterEncoding(encod);
response.setContentType("text/html;charset="+encod);
chain.doFilter(request, response);
} catch (IOException e)
{
e.printStackTrace();
}
} public void init(FilterConfig config)
{
this.config = config;
}}create database forum
GO
use forum
GO
create table BBSUser
(
UserId int identity(1,1) not null primary key, --用户编号
UserName varchar(16) not null, --username
UserPassword varchar(10) not null, --密码
UserNName varchar(15) not null, --昵称
UserImage image , --头像
UserSex bit not null, --性别
UserEmail varchar(100) not null, --邮件
UserRegDate datetime not null default (getDate()) , --注册日期
UserClass int default(1), --级别(几星级)
UserPoint int default(20) --积分(点数))insert into BBSUser(UserName,UserPassword,UserNName,UserSex,UserEmail) values('wqang','HYXS007','可卡因',1,'[email protected]')select * from BbsUsercreate table BBSSection
(
SectionId int identity(1,1) primary key, --版块编号
SectionName varchar(30) not null, --版块名称
SectionMasterID int not null, --版主ID,外键;引用用户BbsUsers的UserId
SectionProfile varchar(50), --版面简介
SectionTopicCount int default(0), --总帖数
SectionState bit default(0) , --是否为隐藏状态
foreign key (SectionMasterID) references bbsUser(UserID)
)insert into BBSSection(Sectionname,SectionmasterID,Sectionprofile)
values('Java技术',1,'包含框架,J2SE')
select * from BbsSection
create table BBSTopic
(
TopicId int identity(1,1) not null primary key, --帖子编号
TopicSectionId int not null, --版块编号;外键,引用bbsSection表的主键SectionId
TopicUserId int not null, --发帖人ID;外键,引用bbsUsers表的主键UserId
TopicReplyCount int default(0), --回复数量
TopicTopic varchar(200) not null, --标题
TopicContent varchar(1000) not null, --发帖内容
TopicTime datetime default (getDate()), --发帖时间
TopicState bit default(0), --状态,是否为精华帖子
foreign key (TopicSectionId) references BbsSection(SectionId),
foreign key (TopicUserId) references bbsUser(UserId))insert into BBSTopic (TopicSectionId ,TopicUserId,TopicTopic,TopicContent)
values(1,1,'JSP中...','jsp遇到不少的问题')select * from BbsTopiccreate table BBSReply
(
ReplyID int not null identity(1,1) primary key, --回复编号
ReplyTopicId int not null, --帖子编号
ReplyUserId int not null, --用户编号
ReplyContent varchar(200) not null,--回复内容
ReplyTime datetime not null default (getDate()) , --回复时间foreign key (ReplyTopicId) references BbsTopic(TopicId),
foreign key (ReplyUserId) references bbsUser(UserId),)insert into BBSReply(ReplyTopicId,ReplyUserId,ReplyContent)
values(1,1,'完成,到些sql创建完毕')
select * from BbsReply
create table BBSManager
(
ManagerID int not null identity(1,1) primary key, --管理员Id
ManagerName varchar(30) not null, --管理员姓名
ManagerPassword varchar(30) not null --管理员密码
)insert into BBSManager(ManagerName,ManagerPassword)
values('wang','123456')
insert into BBSManager(ManagerName,ManagerPassword)
values('meng','123456')
select * from BbsManager