Total members 11895 |It is currently Sat Dec 28, 2024 1:29 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     -  
 jar files commands     -  
 SQL AND OR in WHERE query Commands     -  
 Execute System Commands     -  
 Graphics commands list in C++     -  
 Delete directory in php     -  
 Delete a file in php     -  
 delete file in asp     -  
 Delete file     -  
 Delete session variable     -  



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