Mega Code Archive

 
Categories / MySQL / Insert Delete Update
 

Deleting Rows with DELETE

/* Create the table */ Drop TABLE Professor; CREATE TABLE Professor (    ProfessorID INT NOT NULL PRIMARY KEY,    Name        VARCHAR(50) NOT NULL) TYPE = InnoDB; /* Prepare the data */ INSERT INTO Professor (ProfessorID,Name) VALUES (1,'John Jones'); INSERT INTO Professor (ProfessorID,Name) VALUES (2,'Cury Butz'); INSERT INTO Professor (ProfessorID,Name) VALUES (3,'JJ Smith'); /* Real command */ DELETE FROM Professor WHERE ProfessorID > 2;