" /> " />
PDF Note Note

Синтаксис SQL

1
2
DELETE FROM table_name
WHERE some_column=some_value

Note:

Пример SQL

There is a table "Persons":

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob Sandnes

For this we use this query:

1
2
DELETE FROM Persons
WHERE LastName='Tjessem' AND FirstName='Jakob'

Query Result:

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger

1
2
3
DELETE FROM table_name
or
DELETE * FROM table_name

Note:

Comments

 
-1 #1 Шелест Константин 2010-10-28 21:52 So, we want to delete the entries "Tjessem, Jakob" in the table "Persons". - Who wrote it? Delete a row (tuple of attributes ... finally) where the record "Tjessem, Jakob" in the table "Persons". ! Quote
 
 
+3 #2 Monarh 2011-02-25 12:48 I agree with the rustle of Constantine!
Quote:
So, we want to delete records "Tjessem, Jakob" in the table "Persons".

That sounds ill!
Wash better way:
So, we want to remove from the table "Persons" all the rows where (in which) LastName = 'Tjessem' and FirstName = 'Jakob'.
or in a notation
So, we want
Persons removed from the table
all rows WHERE LastName = 'Tjessem' and FirstName = 'Jakob'.


Sincerely,
Monarch.
Quote
 
 
+4 #3 JohnnySuperb 2011-05-14 15:50 Well, this is a standard option to delete records, and you can put the script remove when you want to raise a few tables.
For example, there are two tables - one with data about people, and another - of the city. And you have to delete all entries from the list of people whose city starts with the letter "F".
So I always remember the rules for constructing such a request.
Quote
 
 
+6 #4 JohnnySuperb 2011-05-23 14:32 Something I did not understand - "who's guided cons ?"!!! People told the truth. If this blog is intended for programmers, article information must be presented correctly. And they offered only realistic options for the novice programmers to correctly understand the meaning of written material. Quote
 
 
0 #5 Сергей 2012-03-27 15:54
Quote
 
 
+1 #6 Сергей 2012-03-27 18:43 Quote
 

Authorization

Nice Ajax Poll

Which one of my extensions is the best?

Statistics

Advertisement