Home > Net >  ')' IS NOT VALID AT THIS POSITION EXPECTING AN IDENTIFIER
')' IS NOT VALID AT THIS POSITION EXPECTING AN IDENTIFIER

Time:03-17

CREATE DATABASE Lab101;
CREATE TABLE STUDENTS(
StudentID varchar(50),
Name varchar(50),
Gender varchar(50),
DOB date ,
Address varchar(50)
)
INSERT INTO STUDENTS (StudentID, Name, Gender, DOB, Address)
VALUES ('S01','Ali','Male','2 Feb 1996','Kuala Lumpur');
INSERT INTO STUDENTS (StudentID, Name, Gender, DOB, Address)
VALUES ('S02','Nancy','Female','16 May 1997','Bukit Jalil');
INSERT INTO STUDENTS (StudentID, Name, Gender, DOB, Address)
VALUES ('S03','Melvin','Male','20 Nov 1998','NULL');
INSERT INTO STUDENTS (StudentID, Name, Gender, DOB, Address)
VALUES ('S04','Angeline','Female','30 Dec 1995','Sri Petaling');

I have an ERROR in the first INSERT statement now. It says INSERT is not valid at the position

CodePudding user response:

You have an extra comma at

Address varchar(50),

It should be

CREATE TABLE STUDENTSS(
StudentID varchar(50),
Name varchar(50),
Gender varchar(50),
DOB date ,
Address varchar(50)
)

CodePudding user response:

Your table name's STUDENTSS, when you're trying to insert into STUDENTS

  • Related