Working on a small database project, and one of the requirements is to show how to delete data using the primary key. The exact statement is
However, I can't figure out what the exact syntax for that would be. Could anyone show me a quick example?
That's a basic delete
statement . Assuming table mytable
and primary key id
:
delete from mytable where id = 1
Use the WHERE clause In the delete statement to specify the conditions used to limit the number of rows that are deleted. For example, WHERE column_name = value. If a WHERE clause is not supplied, DELETE removes all the rows from the table.
DELETE FROM table_name WHERE condition;
for example:
table name= person
DELETE FROM persons WHERE id > 3;
deleted items which had id>3 and return me:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.