zoukankan      html  css  js  c++  java
  • MySQL 向表中插入、删除数据

    一、向表中插入一条信息

    1、查看表中的数据

    mysql> SELECT * FROM user;
    +----+---------+----------+
    | id | account | password |
    +----+---------+----------+
    |  1 | mk      | 123      |
    |  2 | seven   | 456      |
    +----+---------+----------+
    2 rows in set (0.00 sec)

    2、插入数据

    mysql> INSERT INTO user (account, password) VALUES('brk', '789');
    Query OK, 1 row affected (0.56 sec)

    3、再次查看表中的数据

    mysql> SELECT * FROM user;
    +----+---------+----------+
    | id | account | password |
    +----+---------+----------+
    |  1 | mk      | 123      |
    |  2 | seven   | 456      |
    |  3 | brk     | 789      |
    +----+---------+----------+
    3 rows in set (0.00 sec)

    二、从表中删除一条信息

    1、查看表中的数据

    mysql> SELECT * FROM user;
    +----+---------+----------+
    | id | account | password |
    +----+---------+----------+
    |  1 | mk      | 123      |
    |  2 | seven   | 456      |
    |  3 | brk     | 789      |
    +----+---------+----------+
    3 rows in set (0.00 sec)

    2、删除数据

    mysql> DELETE FROM user WHERE account='brk';
    Query OK, 1 row affected (0.57 sec)

    3、再次查看表中的数据

    mysql> SELECT * FROM user;
    +----+---------+----------+
    | id | account | password |
    +----+---------+----------+
    |  1 | mk      | 123      |
    |  2 | seven   | 456      |
    +----+---------+----------+
    2 rows in set (0.00 sec)
  • 相关阅读:
    mysql 练习
    linux 常用软件安装-目录
    Python 三大神器
    Mysql 数据库安装配置
    Mysql数据库入门
    maven的安装与基本使用
    分布式事务
    分布式锁
    springcloud学习笔记
    springboot入门使用
  • 原文地址:https://www.cnblogs.com/Satu/p/10652242.html
Copyright © 2011-2022 走看看