• MySQL中数据表的查操作


    查询数据表的全部内容

    mysql> show tables;#查看当前数据库下的全部表
    +--------------------+
    | Tables_in_ceshi_ku |
    +--------------------+
    | biao               |
    | ceshi_biao         |
    +--------------------+
    2 rows in set (0.00 sec)
    
    mysql> select * from biao;#查看该表全部的内容。*代表通配符。在这里是代表全部的列
    +------+-----------+--------+----------+--------+
    | id   | name      | gender | gongsi   | gongzi |
    +------+-----------+--------+----------+--------+
    |    1 | ma yun    | n      | tao bao  | 6000.5 |
    |    2 | xiao hong | v      | xin lang | 5000.7 |
    |    3 | xiao ming | n      | bai du   | 3000.4 |
    |    4 | li si     | n      | sou hu   | 9000.2 |
    |    5 | lao wang  | NULL   | wang yi  | 1000.5 |
    |    6 | xiao li   | NULL   | ku gou   |  700.1 |
    +------+-----------+--------+----------+--------+
    6 rows in set (0.00 sec)

    查询数据表的全部列、部分行

    mysql> select * from biao where id>4;#查询全部列,部分行,即id大于4的行
    +------+----------+--------+---------+--------+
    | id   | name     | gender | gongsi  | gongzi |
    +------+----------+--------+---------+--------+
    |    5 | lao wang | NULL   | wang yi | 1000.5 |
    |    6 | xiao li  | NULL   | ku gou  |  700.1 |
    +------+----------+--------+---------+--------+
    2 rows in set (0.02 sec)

    查询数据表的部分列、全部行

    mysql> select name,gongzi from biao;#查询部分列,即"name"和"gongzi"列,之间用","隔开。选择全部行
    +-----------+--------+
    | name      | gongzi |
    +-----------+--------+
    | ma yun    | 6000.5 |
    | xiao hong | 5000.7 |
    | xiao ming | 3000.4 |
    | li si     | 9000.2 |
    | lao wang  | 1000.5 |
    | xiao li   |  700.1 |
    +-----------+--------+
    6 rows in set (0.02 sec)

    查询数据表的部分列、部分行

    mysql> select name from biao where gongzi>3000;#选择部分列,即"name"列。也能够多个列。然后选择工资>3000的行
    +-----------+
    | name      |
    +-----------+
    | ma yun    |
    | xiao hong |
    | xiao ming |
    | li si     |
    +-----------+
    4 rows in set (0.00 sec)
  • 相关阅读:
    idea 连接 hive
    css img自适应
    测试视频文件
    ubuntu不显示ipv4地址的解决办法
    nginx path捕获
    union all两个结果集报ORA-12704: character set mismatch错误
    润乾报表试用指南
    报表工具对比之润乾报表与锐浪报表对比
    项目微管理36
    docker远程调用
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10509086.html
  • Copyright © 2020-2023  润新知