9SQL 中LEFT JOIN的含义是__,如果 tbl_user记录了学生的姓名(name)和学号(ID), tbl_score记录了学生(有的学生
解析:自然左外连接</br>create database phpinterview;</br>use phpinterview</br>create table tbl_user</br>(</br>ID int not null,</br>name varchar(50) not null,</br>primary key (ID)</br>);</br>create table tbl_score</br>(</br>ID int not null,</br>score dec(6,2) not null,</br>subject varchar(20) not null</br>);</br>insert into tbl_user (ID, name) values (1, ’beimu’);</br>insert into tbl_user (ID, name) values (2, ’aihui’);</br>insert into tbl_score (ID, score, subject) values (1, 90, ’语文’);</br>insert into tbl_score (ID, score, subject) values (1, 80, ’数学’);</br>insert into tbl_score (ID, score, subject) values (2, 86, ’数学’);</br>insert into tbl_score (ID, score, subject) values (2, 96, ’语文’);</br>select 选项:id,sum(B.score) as sumscore</br>from tbl_user A left join tbl_score B</br>on 选项:ID=B.ID</br>group by 选项:id
点击加载更多评论>>