Switch to full style
Include SQL commands
Post a reply

DELETE Commands

Sun Jul 15, 2012 10:34 pm

To delete all the records from a table in mysql we can use TRUNCATE :

Code:

TRUNCATE 
'Department'
 



You can delete a specific parts of records from database using DELETE command with where clause :

Code:

DELETE FROM Department WHERE NumOfStudents
< 5



To delete an entire table from the database we use DROP command :

Code:

DROP TABLE Department


We can also add if exists to it :
Code:

DROP TABLE 
IF EXISTS 'Department';
 


You can also delete multiable tables in one sentence :

Code:

DROP TABLE 
'Department''Student''Course';
 



You can use DROP command to delete an index from a table :
Code:

ALTER TABLE 
'Department' DROP INDEX 'index_cat_id'
 



You can use DROP command to delete an database :
Code:

DROP DATABASE myDB




Post a reply
  Related Posts  to : DELETE Commands
 FTP commands     -  
 SQL AND OR in WHERE query Commands     -  
 jar files commands     -  
 Execute System Commands     -  
 Graphics commands list in C++     -  
 Delete directory in php     -  
 Delete a file in php     -  
 delete file in asp     -  
 Delete file     -  
 Cannot Delete Computer group     -