2012-09-22 2 views
-2

여기에 우리가 다시 간다. MySQL은이 오류를 throw합니다 : #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tinytext not null, FirstName varchar(50) not null, LastName varchar(50) nu' at line 5다시 MySQL 오류 # 1064

이 문법의 문 제는 무엇입니까?

CREATE TABLE posts (
     ID int unsigned not null auto_increment, 
     Type enum('article', 'link') not null, 
     Title text null, 
     Link text null, 
     BodyOrig longtext null, 
     BodyProc longtext not null, 
     URL tinytext not null, 
     ShortURL tinytext not null, 
     Status enum('drafted', 'published') not null, 
     DateEdited timestamp null, 
     DatePublished timestamp null, 
     Topic enum('') null, 

     primary key (ID, URL(255), ShortURL(10)) 
    ); 
    CREATE TABLE pages (
     ID int unsigned not null auto_increment, 
     Name varchar(25) not null, 
     Title text not null, 
     BodyOrig longtext null, 
     BodyProc longtext not null, 
     URL tinytext not null, 
     Hero text null, 
     Status enum('drafted', 'published') not null, 

     primary key (ID, Name, URL(255)) 
    ); 
    CREATE TABLE users (
     ID int unsigned not null auto_increment, 
     Username varchar(25) not null, 
     Password text not null, 
     Key tinytext not null, 
     FirstName varchar(50) not null, 
     LastName varchar(50) null, 
     DisplayName tinytext not null, 
     Email tinytext not null, 

     primary key (ID, Username, Key(255)); 
    ); 
    CREATE TABLE settings (
     Version varchar(10) not null, 
     SiteName tinytext not null, 
     Description tinytext not null, 
     ColorScheme char(6) not null 
    ); 

하나 내 눈을 그냥 자신의 팁 탑 모양, 또는 무언가 (특정 형식?) 내가 놓친 거지가 :

여기에 코드입니다. 당신의 도움을 주셔서 대단히 감사합니다!

+0

[MySQL에서 예약어를 테이블 또는 열 이름으로 사용하기 때문에 구문 오류가 발생할 수 있습니다.] (http://stackoverflow.com/questions/23446377/syntax-error-due-to-using-a-reserved -word-as-a-table-or-column-name-in-mysql) –

답변

4

reserved keyword 인 "키"라는 열을 만들려고합니다.

+0

고마워. 그것은 조금 더 잘 작동했습니다. 이제 알았어. '# 1064 - SQL 구문에 오류가 있습니다. 올바른 구문을 보려면 MySQL 서버 버전에 해당하는 설명서를 확인하십시오. 'at line 11'근처에서 사용하십시오. –

+1

모든 엔티티 -'tableName','field' 이름을 이스케이프 처리하십시오. – adatapost

+0

즉? (죄송합니다, 여기 멍청한 녀석입니다.) –