美文网首页
MySQL delete from 删除table表的数据

MySQL delete from 删除table表的数据

作者: klisly | 来源:发表于2017-02-07 15:36 被阅读57次

    1、delete from + where 字句

    题目:删除id=4的数据

    mysql> select*from students;

    +----+----------+-----+------+

    | id | name    | sex | age  |

    +----+----------+-----+------+

    |  1 | kimi    | f  |  12 |

    |  2 | hathway  | m  |  15 |

    |  3 | tony    | f  |  15 |

    |  4 | hongkong | m  |  16 |

    |  5 | wendy    | m  |  20 |

    +----+----------+-----+------+

    5 rows in set (0.00 sec)

    mysql> delete from students where id =4;

    Query OK, 1 row affected (0.00 sec)

    mysql> select*from students;

    +----+---------+-----+------+

    | id | name    | sex | age  |

    +----+---------+-----+------+

    |  1 | kimi    | f  |  12 |

    |  2 | hathway | m  |  15 |

    |  3 | tony    | f  |  15 |

    |  5 | wendy  | m  |  20 |

    +----+---------+-----+------+

    4 rows in set (0.00 sec)

    相关文章

      网友评论

          本文标题:MySQL delete from 删除table表的数据

          本文链接:https://www.haomeiwen.com/subject/yxqmittx.html