Total members 11890 |It is currently Tue Apr 16, 2024 10:22 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka






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




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  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 file in asp     -  
 Delete file     -  
 Delete directory in php     -  
 Delete a file in php     -  
 How can I delete inactive friends?     -  



cron






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com