首页 小组 文章 相册 留言本 用户 搜索 我的社区 在线学堂 商城 购物车 支付钱包

[分享]闫志东,多表查询

2024-04-16 15:04:45
0
183

SELECT e.employee_id,d.department_name

FROM employees AS e,departments AS d

WHERE e.department_id = d.department_id(+);


-- sql99

SELECT e.employee_id,d.department_name,l.city

    FROM employees AS e 

        INNER JOIN departments AS d ON e.department_id = d.department_id

            INNER JOIN locations AS l ON l.location_id = d.location_id;

            

SELECT e.employee_id,d.department_name-- ,l.city

    FROM employees AS e 

        RIGHT OUTER JOIN departments AS d ON e.department_id = d.department_id

            -- RIGHT OUTER JOIN locations AS l ON l.location_id = d.location_id;

评论
意见反馈