Click here to Skip to main content
15,890,282 members
Home / Discussions / Database
   

Database

 
QuestionDetecting SQL Server Activity Pin
cjb11011-Dec-09 0:34
cjb11011-Dec-09 0:34 
AnswerRe: Detecting SQL Server Activity Pin
Garth J Lancaster11-Dec-09 1:03
professionalGarth J Lancaster11-Dec-09 1:03 
QuestionHow to delete data from database Pin
sarang_k10-Dec-09 17:25
sarang_k10-Dec-09 17:25 
AnswerRe: How to delete data from database Pin
dan!sh 10-Dec-09 17:55
professional dan!sh 10-Dec-09 17:55 
GeneralRe: How to delete data from database Pin
sarang_k10-Dec-09 18:05
sarang_k10-Dec-09 18:05 
GeneralRe: How to delete data from database Pin
dan!sh 10-Dec-09 18:22
professional dan!sh 10-Dec-09 18:22 
AnswerRe: How to delete data from database Pin
Ashfield10-Dec-09 20:57
Ashfield10-Dec-09 20:57 
AnswerRe: How to delete data from database Pin
Niladri_Biswas10-Dec-09 23:10
Niladri_Biswas10-Dec-09 23:10 
I don't know your specific requirement, but I am giving certain situations. Let me know in case of any concern

General syntax:

DELETE FROM
{table name | view name}
[WHERE search_conditions]


Note: Where clause is optional

Case 1: Delete all rows from the table

Delete from tablename


Case 2: Delete based on a condition(Suppose I want to delete those employees from Employee table whose salaries are more than 50k)

Delete from Employees
where Salaries > 50000


Case 3: If you want to drop your table issue

DROP TABLE table_name


Case 4: Though you have not asked, but if incase you need to truncate your table issue :

Truncate Table table_name


Case 5: If you want to delete duplicate records like

Input:

id	name
1	name1
10	name1
2	name2
3	name3
11	name3
4	name4


Output:
id	name
1	name1
2	name2
3	name3
4	name4


Query:

delete from tblname where id in
(
	select id 
	from(select ROW_NUMBER() over(partition by name  order by name) rn,
				Id, name from tblname)X
	where rn <> 1
)


But your question title is
sarang_k wrote:
delete the data from the database


Case 6:
If that is suppose to be the case, the I presume you want to drop the database
(:(don't know why?)

However, the command is
Drop DataBase database_name


For more information please look into Deleting Data from an SQL Table

Hope this helps
Smile | :)

Niladri Biswas

JokeRe: How to delete data from database Pin
Mycroft Holmes11-Dec-09 23:29
professionalMycroft Holmes11-Dec-09 23:29 
GeneralRe: How to delete data from database Pin
Jörgen Andersson12-Dec-09 10:38
professionalJörgen Andersson12-Dec-09 10:38 
Questionremote mysql server connection problem? Pin
hande5410-Dec-09 8:05
hande5410-Dec-09 8:05 
AnswerRe: remote mysql server connection problem? Pin
Blue_Boy10-Dec-09 9:08
Blue_Boy10-Dec-09 9:08 
GeneralRe: remote mysql server connection problem? Pin
hande5410-Dec-09 9:18
hande5410-Dec-09 9:18 
QuestionRe: remote mysql server connection problem? Pin
Eddy Vluggen10-Dec-09 10:30
professionalEddy Vluggen10-Dec-09 10:30 
AnswerRe: remote mysql server connection problem? Pin
hande5411-Dec-09 0:10
hande5411-Dec-09 0:10 
GeneralRe: remote mysql server connection problem? Pin
Eddy Vluggen11-Dec-09 2:07
professionalEddy Vluggen11-Dec-09 2:07 
QuestionHow to update records of a table automatically based on date Pin
Krishhhhhhhhhhhhhh10-Dec-09 7:05
Krishhhhhhhhhhhhhh10-Dec-09 7:05 
AnswerRe: How to update records of a table automatically based on date Pin
Bassam Saoud10-Dec-09 8:37
Bassam Saoud10-Dec-09 8:37 
QuestionHow to send an auto mail Pin
Krishhhhhhhhhhhhhh10-Dec-09 7:00
Krishhhhhhhhhhhhhh10-Dec-09 7:00 
AnswerRe: How to send an auto mail - [ REPOST ] Pin
Richard MacCutchan10-Dec-09 7:22
mveRichard MacCutchan10-Dec-09 7:22 
GeneralRe: How to send an auto mail - [ REPOST ] Pin
Krishhhhhhhhhhhhhh10-Dec-09 7:28
Krishhhhhhhhhhhhhh10-Dec-09 7:28 
GeneralRe: How to send an auto mail - [ REPOST ] Pin
Richard MacCutchan10-Dec-09 7:34
mveRichard MacCutchan10-Dec-09 7:34 
GeneralRe: How to send an auto mail - [ REPOST ] Pin
Krishhhhhhhhhhhhhh10-Dec-09 7:43
Krishhhhhhhhhhhhhh10-Dec-09 7:43 
GeneralRe: How to send an auto mail - [ REPOST ] Pin
Richard MacCutchan10-Dec-09 7:53
mveRichard MacCutchan10-Dec-09 7:53 
GeneralRe: How to send an auto mail - [ REPOST ] Pin
Krishhhhhhhhhhhhhh10-Dec-09 7:59
Krishhhhhhhhhhhhhh10-Dec-09 7:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.