Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6015783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:53:09+00:00 2026-05-23T02:53:09+00:00

Does anyone know what is wrong with the following SQL query? CREATE TABLE IF

  • 0

Does anyone know what is wrong with the following SQL query?

CREATE TABLE IF NOT EXISTS PrWorlds (                     # World table
 worldid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
 worldname VARCHAR(32) NOT NULL UNIQUE                    # Name of world
);

CREATE TABLE IF NOT EXISTS PrEntries (                    # User/Group table
 entryid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
 name VARCHAR(32) NOT NULL,                               # Name of user/group
 worldid INTEGER NOT NULL,                                # ID of the world the     user/group belongs to
 type TINYINT NOT NULL,                                   # Type denotes the entry type.     0 for a user, 1 for a group
 CONSTRAINT NameWorld UNIQUE (name, worldid, type),
 ENTRYINDEX
 FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE IF NOT EXISTS PrPermissions (                             # Table of     permission nodes
 permid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 permstring VARCHAR(64) NOT NULL,                                      # Permission node
 entryid INTEGER NOT NULL,                                             # Entry whom this     node belongs to
 CONSTRAINT PrEntryPerm UNIQUE (entryid, permstring),
 FOREIGN KEY(entryid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE IF NOT EXISTS PrInheritance (                  # Table of parent-child     relationships
 uinheritid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 childid INTEGER NOT NULL,                                  # Child entry
 parentid INTEGER NOT NULL,                                 # Parent entry
 parentorder INTEGER NOT NULL,                              # Denotes order of     inheritance. 
                                                            # Groups override other     groups' permissions/data 
                                                            # below them in the results
 CONSTRAINT PrParent UNIQUE (childid, parentid),
 CONSTRAINT PrOrderedInheritance UNIQUE (childid, parentorder),
 CONSTRAINT PrNoSelfInherit CHECK (childid <> parentid),
 FOREIGN KEY(childid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE,
 FOREIGN KEY(parentid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE IF NOT EXISTS PrWorldBase (      # Table of the default groups in that world
 worldid INTEGER NOT NULL,
 defaultid INTEGER,                           # Default group
 FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE,
 FOREIGN KEY(defaultid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE IF NOT EXISTS PrData (
 dataid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 entryid INTEGER NOT NULL ,                  # ID entry whom this data node belongs to
 path VARCHAR(64) NOT NULL,                  # Path to data node (e.g. "prefix", "build")
 data VARCHAR(64) NOT NULL,                  # Data node in string form (o.toString())
 CONSTRAINT PrDataUnique UNIQUE (entryid, path),
 FOREIGN KEY(entryid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE IF NOT EXISTS PrTracks (
 trackid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 trackname VARCHAR(64) NOT NULL UNIQUE,                      # Track name
 worldid INTEGER NOT NULL,                                   # ID of world track belongs             to
     CONSTRAINT TracksUnique UNIQUE (trackid, worldid),
 FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE IF NOT EXISTS PrTrackGroups (
 trackgroupid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 trackid INTEGER NOT NULL,                                          # ID of track
 gid INTEGER NOT NULL,                                              # ID of group in     track
 groupOrder INTEGER NOT NULL,                                       # Denotes position of     the group in the track
 CONSTRAINT TrackGroupsUnique UNIQUE (trackid, gid),
 FOREIGN KEY(trackid) REFERENCES PrTracks(trackid) ON DELETE CASCADE ON UPDATE CASCADE,
 FOREIGN KEY(gid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
);

It throws this error when run in the newest version of phpMyAdmin:

#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 'FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CA' at line 8 

Running the newest available MySQL server via yum, PHP version is 5.3 with php-mysql added via yum as well.
All of this is running on CentOS 5.5 64bit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:53:10+00:00Added an answer on May 23, 2026 at 2:53 am

    Remove ENTRYINDEX and change AUTOINCREMENT to AUTO_INCREMENT.

    Correct code would be this:

    CREATE TABLE IF NOT EXISTS PrWorlds (                     # World table
     worldid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
     worldname VARCHAR(32) NOT NULL UNIQUE                    # Name of world
    );
    
    CREATE TABLE IF NOT EXISTS PrEntries (                    # User/Group table
     entryid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
     name VARCHAR(32) NOT NULL,                               # Name of user/group
     worldid INTEGER NOT NULL,                                # ID of the world the     user/group belongs to
     type TINYINT NOT NULL,                                   # Type denotes the entry type.     0 for a user, 1 for a group
     CONSTRAINT NameWorld UNIQUE (name, worldid, type),
     FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    CREATE TABLE IF NOT EXISTS PrPermissions (                             # Table of     permission nodes
     permid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
     permstring VARCHAR(64) NOT NULL,                                      # Permission node
     entryid INTEGER NOT NULL,                                             # Entry whom this     node belongs to
     CONSTRAINT PrEntryPerm UNIQUE (entryid, permstring),
     FOREIGN KEY(entryid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    
    CREATE TABLE IF NOT EXISTS PrInheritance (                  # Table of parent-child     relationships
     uinheritid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
     childid INTEGER NOT NULL,                                  # Child entry
     parentid INTEGER NOT NULL,                                 # Parent entry
     parentorder INTEGER NOT NULL,                              # Denotes order of     inheritance. 
                                                                # Groups override other     groups' permissions/data 
                                                                # below them in the results
     CONSTRAINT PrParent UNIQUE (childid, parentid),
     CONSTRAINT PrOrderedInheritance UNIQUE (childid, parentorder),
     CONSTRAINT PrNoSelfInherit CHECK (childid <> parentid),
     FOREIGN KEY(childid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE,
     FOREIGN KEY(parentid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    CREATE TABLE IF NOT EXISTS PrWorldBase (      # Table of the default groups in that world
     worldid INTEGER NOT NULL,
     defaultid INTEGER,                           # Default group
     FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE,
     FOREIGN KEY(defaultid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    CREATE TABLE IF NOT EXISTS PrData (
     dataid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
     entryid INTEGER NOT NULL ,                  # ID entry whom this data node belongs to
     path VARCHAR(64) NOT NULL,                  # Path to data node (e.g. "prefix", "build")
     data VARCHAR(64) NOT NULL,                  # Data node in string form (o.toString())
     CONSTRAINT PrDataUnique UNIQUE (entryid, path),
     FOREIGN KEY(entryid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    CREATE TABLE IF NOT EXISTS PrTracks (
     trackid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
     trackname VARCHAR(64) NOT NULL UNIQUE,                      # Track name
     worldid INTEGER NOT NULL,                                   # ID of world track belongs             to
         CONSTRAINT TracksUnique UNIQUE (trackid, worldid),
     FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    CREATE TABLE IF NOT EXISTS PrTrackGroups (
     trackgroupid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
     trackid INTEGER NOT NULL,                                          # ID of track
     gid INTEGER NOT NULL,                                              # ID of group in     track
     groupOrder INTEGER NOT NULL,                                       # Denotes position of     the group in the track
     CONSTRAINT TrackGroupsUnique UNIQUE (trackid, gid),
     FOREIGN KEY(trackid) REFERENCES PrTracks(trackid) ON DELETE CASCADE ON UPDATE CASCADE,
     FOREIGN KEY(gid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know what is wrong with this query? SELECT DISTINCT c.CN as ClaimNumber,
Does anyone know the proper way to query azure table storage for a null
Does anyone know what's wrong with this code block. CREATE FUNCTION [dbo].[udfGetPoint] ( @UserID
Hi I have the following error when trying to import MySQLdb. Does anyone know
Does anyone know how to get IntelliSense to work reliably when working in C/C++
Does anyone know how to transform a enum value to a human readable value?
Does anyone know of a good Command Prompt replacement? I've tried bash/Cygwin, but that
Does anyone know of a FOSS Python lib for generating Identicons ? I've looked,
Does anyone know of any existing packages or libraries that can be used to
Does anyone know a good Java lib that will hook into SVN so I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.