美文网首页
mysql基础

mysql基础

作者: 二棉酷 | 来源:发表于2017-12-28 15:18 被阅读0次

    mysql基础知识

    1.创建数据库
    mysql> CREATE DATABASE IF NOT EXISTS homestead DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
    mysql> CREATE DATABASE IF NOT EXISTS abc DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
    
    
    2.连接查询
    1.内连接(INNER JOIN)
    等值连接
            SELECT A.*, B.*  
            FROM student_info A inner join student_score B  
            ON A.student_id = B.student_id   
    非等值连接
            SELECT A.*, B.*  
            FROM student_info A inner join student_score B  
            ON A.student_id > B.student_id
    
    
    2.左外连接(LEFT OUTER JOIN)
    SELECT A.*, B.*  
    FROM student_info A left join student_score B  
    ON A.student_id = B.student_id 
    
    
    3.右外连接(RIGHT OUTER JOIN)
    SELECT A.*, B.*  
    FROM student_info A right join student_score B  
    ON A.student_id = B.student_id  
    

    相关文章

      网友评论

          本文标题:mysql基础

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