• mysql 创建联结


    mysql> select * from user;
    +------+----------+-----------+
    | id   | name     | address   |
    +------+----------+-----------+
    |    1 | xiaoming | beijing   |
    |    2 | xiaobai  | shandong  |
    |    3 | xiaohong | suzhou    |
    |    4 | xiaohei  | changchun |
    +------+----------+-----------+
    4 rows in set (0.00 sec)
    
    
    
    mysql> select * from test;
    +----+------------+-------+-----------+
    | id | name       | score | subject   |
    +----+------------+-------+-----------+
    |  1 | xiaoming   |    89 | shuxue    |
    |  2 | xiaohong   |    89 | shuxue    |
    |  3 | xiaohong   |    80 | english   |
    |  4 | xiaohong   |    80 | physics   |
    |  5 | xiaohong   |    80 | astronaut |
    |  6 | xiaoming   |    80 | physics   |
    |  7 | xiaoming   |    80 | astronaut |
    |  8 | xiaoming   |    80 | english   |
    |  9 | xiaobai    |    80 | astronaut |
    | 10 | 1.2xiaobai |    80 | english   |
    | 11 | 2.2xiaobai |    80 | physics   |
    | 12 | 3xiaobai   |    80 | shuxue    |
    | 13 | 123xiaohei |    80 | astronaut |
    | 14 | xiaohei    |    80 | shuxue    |
    | 15 | xiaohei    |    80 | physics   |
    | 16 | .12xiaohei |    80 | english   |
    +----+------------+-------+-----------+
    16 rows in set (0.00 sec)
    
    
    
    mysql> select test.name,score,subject,address from test,user where user.name=test.name;
    +----------+-------+-----------+-----------+
    | name     | score | subject   | address   |
    +----------+-------+-----------+-----------+
    | xiaoming |    89 | shuxue    | beijing   |
    | xiaohong |    89 | shuxue    | suzhou    |
    | xiaohong |    80 | english   | suzhou    |
    | xiaohong |    80 | physics   | suzhou    |
    | xiaohong |    80 | astronaut | suzhou    |
    | xiaoming |    80 | physics   | beijing   |
    | xiaoming |    80 | astronaut | beijing   |
    | xiaoming |    80 | english   | beijing   |
    | xiaobai  |    80 | astronaut | shandong  |
    | xiaohei  |    80 | shuxue    | changchun |
    | xiaohei  |    80 | physics   | changchun |
    +----------+-------+-----------+-----------+
    11 rows in set (0.01 sec)

  • 相关阅读:
    秒杀系统核心高性能解决方案(待续)
    LeetCode字符串专题
    LeetCode哈希表专题
    LeetCode排序专题【算法】
    Login项目学习笔记【Android】
    LeetCode树专题(遍历,BST,Trie)(未完成)
    Android studio导入别人项目的艰难记录
    LeetCode树专题(递归)(未完成)
    LeetCode双指针专题【算法】(未完成)
    LeetCode数组与矩阵专题(未完成)
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11309425.html
Copyright © 2020-2023  润新知