zoukankan      html  css  js  c++  java
  • 内连接和纯where连接

    描述

    有一个全部员工的薪水表salaries简况如下:
     
    有一个各个部门的领导表dept_manager简况如下:
     
     
    请你查找各个部门当前领导的薪水详情以及其对应部门编号dept_no,输出结果以salaries.emp_no升序排序,并且请注意输出结果里面dept_no列是最后一列,以上例子输出如下:
     
     
    方法一:内连接

    select sal.emp_no,sal.salary,sal.from_date,sal.to_date,dep.dept_no
    from salaries as sal inner join dept_manager as dep
    on sal.emp_no=dep.emp_no
    order by sal.emp_no;

    方法二:纯where连接(这里用where比内连接还快点)

    select sal.emp_no,sal.salary,sal.from_date,sal.to_date,dep.dept_no
    from salaries as sal , dept_manager as dep
    where sal.emp_no=dep.emp_no
    order by sal.emp_no;

    心之所愿,永不相忘
  • 相关阅读:
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Arctic Network POJ
    Truck History POJ
    QS Network ZOJ
  • 原文地址:https://www.cnblogs.com/zgll/p/15265232.html
Copyright © 2011-2022 走看看