我们可以使用DELETE语句和WHERE子句,来删除MySQL表中的特定行。
mysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 4 | Aarav | | 5 | Ram | +------+-----------+ 5 rows in set (0.00 sec) mysql> DELETE from names where id = 4; Query OK, 1 row affected (0.07 sec)
上面的查询将从表 ‘names’ 中删除一个id = 4的行。
mysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 5 | Ram | +------+-----------+ 4 rows in set (0.00 sec)
以上是我们如何从MySQL表中删除单行数据?的详细内容。更多信息请关注PHP中文网其他相关文章!