Deleting Rows with DELETE : Delete « Insert Delete Update « SQL / MySQL






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;
           
         
    
    
    
  








Related examples in the same category

1.Using DELETE LOW_PRIORITY command
2.Delete by JOIN
3.Delete with JOIN 2
4.Using the 'from join delete' Alternative to Delete Data
5.Delete row with condition
6.Delete statement with subquery (ERROR 1093 (HY000): You can't specify target table 'EmployeeS' for update in FROM clause)
7.DELETE statement using the alternative.
8.Joining Tables in a DELETE Statement
9.Delete with where clause
10.Delete ignore
11.Adding Subqueries to Your DELETE Statements
12.Delete All Threads Except the Last 500
13.Delete rows from multiple tables