title: Problem with Constraint or Index SQL when Creating a Table
body: <p>I'm currently working on an assignment and have run into an issue.</p>
  
  <p>I get an error:</p>
  
  <blockquote>
    <p>Msg 8135, Level 16, State 0, Line 41<br>
    Table level constraint or index does not specify column list, table 'Sessions'.</p>
  </blockquote>
  
  <p>I've run through it a million times, but I cannot find out where the issue arises. I believe I AM specifying the columns in both table-level statements, so I am at a loss.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>CREATE TABLE Class
  (
      -- Column specifications and constraints--
      ClassID NCHAR(6) NOT NULL,  
      ClassDescription NVARCHAR(50) NOT NULL,
  
      --Table constraints--
      CONSTRAINT pk_Class_ClassID 
          PRIMARY KEY (ClassID)   --ClassID is the primary key in the Class table, done as a table constraint
  )
  
  CREATE TABLE Riders
  (
      -- Column specifications and constraints--
      RiderID INT NOT NULL IDENTITY(10, 1)    --RiderID auto-fills in the value, starting at 10, incrementing by 1
          CONSTRAINT pk_Riders_RiderID PRIMARY KEY,   --RiderID is the primary key in the Riders table
      [Name] NVARCHAR(50) NOT NULL
          CONSTRAINT chk_Riders_Name CHECK (LEN([Name]) &gt; 4), --Name must be longer than 4 letters
      ClassID NCHAR(6) NULL,
  
      --Table constraints--
      CONSTRAINT fk_Riders_Class 
          FOREIGN KEY (ClassID) REFERENCES Class (ClassID)
  )
  
  CREATE TABLE [Sessions]
  (
      -- Column specifications and constraints--
      RiderID INT NOT NULL,
      BikeID NCHAR(6) NOT NULL,
      SessionDate DATETIME NOT NULL
          CONSTRAINT chk_Sessions_SessionDate CHECK (SessionDate &gt; '1 Sep 2017'), --SessionDate must be AFTER September 1, 2017
      Laps INT NULL,
  
      -- Table constraints--
      CONSTRAINT pk_Sessions_RiderID_BikeID_SessionDate 
          PRIMARY KEY (RiderID, BikeID, SessionDate), --RiderID, BikeID, SessionDate is the composite primary key for the Sessions table
      INDEX CI_Sessions_RiderID_BikeID ON [Sessions] (RiderID, BikeID)    --Index RiderID and BikeID
  )
  
  CREATE TABLE Bikes
  (
      -- Column specifications and constraints--
      BikeID NCHAR(6) NOT NULL
          CONSTRAINT chk_Bikes_BikeID CHECK (BikeID LIKE '[0-9][0-9][0-9][HYS]-[AP]') --BikeID in format ###X-A # = 0 - 9, X = H(Honda), Y(Yamaha), S(Suzuki), A = A(AM), P(PM)
          CONSTRAINT pk_Bikes_BikeID PRIMARY KEY, --BikeID is the primary key in the Bikes table
      StableDate DATE NOT NULL
          CONSTRAINT def_Bikes_StableDate DEFAULT GETDATE()
  )
  
  ALTER TABLE [Sessions] 
      ADD CONSTRAINT chk_Sessions_Laps CHECK (Laps &gt;= 10)
  
  ALTER TABLE [Sessions] 
      ADD CONSTRAINT fk_Sessions_Riders 
          FOREIGN KEY (RiderID) REFERENCES Riders (RiderID)
  
  ALTER TABLE [Sessions] 
      ADD CONSTRAINT fk_Sessions_Bikes 
          FOREIGN KEY (BikeID) REFERENCES Bikes (BikeID)
  </code></pre>
  
  <p>Any help is appreciated!!</p>