最新消息:觉得本站不错的话 记得收藏哦 博客内某些功能仅供测试 讨论群:135931704 快养不起小站了 各位有闲钱就打赏下把 My Email weicots#gmail.com Please replace # with @

mysql数据库的左连接,右连接,内链接 有什么区别

LINX-SQL ajiang-tuzi 8255浏览
| User | password | time              ' at line 1
mysql> +----------+-------------+------+-----+---------+-------+
    -> | Field    | Type        | Null | Key | Default | Extra |
    -> +----------+-------------+------+-----+---------+-------+
    -> | User     | varchar(10) | YES  |     | NULL    |       |
    -> | password | varchar(10) | YES  |     | NULL    |       |
    -> | time     | datetime    | YES  |     | NULL    |       |
    -> +----------+-------------+------+-----+---------+-------+
    -> 3 rows in set (0.04 sec)
    ->
    -> mysql> select * from name left join usename on name.name=usename.user;
mysql> +-----------------+----------+------------+------+----------+---------------------+
    -> | Name            | Remark   | No         | User | password | time                |
    -> +-----------------+----------+------------+------+----------+---------------------+
    -> | LIU             | likeblue |   23467588 | liu  | 124mll   | 2015-08-03 17:25:35 |
    -> | liujiang        | likeblue |   23467588 | NULL | NULL     | NULL                |
    -> | liujiang        | likered  |   45363463 | NULL | NULL     | NULL                |
    -> | xiaohong        | likeblue | 2147483647 | NULL | NULL     | NULL                |
    -> | ????±?<br />   | likeblue | 2147483647 | NULL | NULL     | NULL                |
    -> | ????±?<br />   | likeblue | 2147483647 | NULL | NULL     | NULL                |
    -> | ????±?<br />   | likeblue | 2147483647 | NULL | NULL     | NULL                |
    -> | <?php echo "ppp | likeblue | 2147483647 | NULL | NULL     | NULL                |
    "> | ficx            | likeblue | 2147483647 | NULL | NULL     | NULL                |
    "> +-----------------+----------+------------+------+----------+---------------------+
    "> 9 rows in set (0.01 sec)
    ">
    "> mysql> select * from name;
    "> +-----------------+----------+------------+
    "> | Name            | Remark   | No         |
    "> +-----------------+----------+------------+
    "> | liujiang        | likeblue |   23467588 |
    "> | liujiang        | likered  |   45363463 |
    "> | xiaohong        | likeblue | 2147483647 |
    "> | ????±?<br />   | likeblue | 2147483647 |
    "> | ????±?<br />   | likeblue | 2147483647 |
    "> | ????±?<br />   | likeblue | 2147483647 |
    "> | <?php echo "ppp | likeblue | 2147483647 |
    -> | ficx            | likeblue | 2147483647 |
    -> | LIU             | likeblue |   23467588 |
    -> +-----------------+----------+------------+
    -> 9 rows in set (0.00 sec)
    -> mysql> select * from name inner join usename on name.name=usename.user;
mysql> +------+----------+----------+------+----------+---------------------+
    -> | Name | Remark   | No       | User | password | time                |
    -> +------+----------+----------+------+----------+---------------------+
    -> | LIU  | likeblue | 23467588 | liu  | 124mll   | 2015-08-03 17:25:35 |
    -> +------+----------+----------+------+----------+---------------------+
    -> 1 row in set (0.00 sec)

转载请注明:(●--●) Hello.My Weicot » mysql数据库的左连接,右连接,内链接 有什么区别

蜀ICP备15020253号-1