Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

คำสั่ง MySQL DELETE ใช้สำหรับอะไร?


คำสั่ง MySQL DELETE ใช้เพื่อลบแถว/วินาทีออกจากตาราง ใช้กับคำสั่ง WHERE

ไวยากรณ์

DELETE From Table_name WHERE Condition;

ตัวอย่าง

ในตัวอย่างด้านล่าง เราได้ลบแถวออกจากตาราง 'employee' โดยที่ id>=100

mysql> select * from employee;
+------+--------+
| Id   | name   |
+------+--------+
| 100  | Ram    |
| 200  | Gaurav |
| 300  | MOHAN  |
+------+--------+
3 rows in set (0.00 sec)

mysql> delete from employee where id >=100;
Query OK, 3 rows affected (0.06 sec)

mysql> select * from employee;
Empty set (0.00 sec)