Join 常用类型:
自然连接(Natural joins)
NATURAL JOIN 从句 自动将两张表相同列名的相同值且数据类型相同进行连接。
SELECT employee_id,last_name,salary,dept_id FROM employee NATURAL JOIN dept;
dept_id是两张表相同的列,那么基于此列且值和数据类型相同进行连接。注意 还不能使用别名作为表前缀。而且 如果名字相同但是数据类型不一致,就会出错。
此时可以使用Using 从句。而且如果有多列相同,就会以多列进行join.
USING 从句
SELECT employee_id,last_name,salary,dept_id FROM employee JOIN dept USING (dept_id);
可以指定单独的一列进行连接在有多例相同的情况下。
ON 从句
列名不一样都可以连接
SELECT employee_id,last_name,salary,dept_id FROM employee e JOIN dept d on
e.fk_deptid = d.dept_id;
内连接:只返回相匹配的数据。
外连接(Outer Join)除了相匹配的数据返回还返回一些其余的数据。
LEFT OUTER JOIN
RIGHT OUTER JOIN
FULL OUTER JOIN 没有任何关联的数据也显示处来。
笛卡尔集(cross join)
NonEqul join
SELECT e.last_name , e.salary, j.grade_level FROM employee e JOIN job_grade j
ON e.salary BETWEEN j.lowest_salary AND j.highest_salary;
分享到:
相关推荐
To display the editing area, a linear or multi-line to change the field of data or use as a purely demo. TDBDateTimeEditEh: To display the editing of the date or time on a line so that it can edit ...
Attributes can be multi-valued. Attributes can be composite. (a) Both I and II (b) II only (c) Neither I nor II (d) I only Correct answer is (c) 1. In an ER model, what is a recursive ...
returns default PrinterPreview object and shows data in default preview form. TDBEditEh component represents a single or multi-line edit control that can display and edit a field in a dataset or ...
returns default PrinterPreview object and shows data in default preview form. TDBEditEh component represents a single or multi-line edit control that can display and edit a field in a dataset or ...
users with an easy means of changing the current display order of data being retrieved from an indexed table. When the user selects the TDBIndexCombo component, it's drop-down selection list is ...
returns default PrinterPreview object and shows data in default preview form. TDBEditEh component represents a single or multi-line edit control that can display and edit a field in a dataset or ...
returns default PrinterPreview object and shows data in default preview form. TDBEditEh component represents a single or multi-line edit control that can display and edit a field in a dataset or ...
returns default PrinterPreview object and shows data in default preview form. TDBEditEh component represents a single or multi-line edit control that can display and edit a field in a dataset or ...
Multi-functional "Text" object can display one or more text lines. That may contain text mixed with variables or dataset fields or expressions. It supports simple HTML tags (b,i,u,strike,sub,sup,font ...
For multi-monitor configurations the form positions will now be stored and restored per monitor Crash recovery and desktop files now saved in the user's Application Data directory instead of the Temp ...
users with an easy means of changing the current display order of data being retrieved from an indexed table. When the user selects the TDBIndexCombo component, it's drop-down selection list is ...
ListEditor.zip This article shows you how you can navigate through a multi-column, editable list view(42KB)<END><br>85,LogControl_src.zip Learn how to use printf-like functionality to debug your...
The application may not be sold in any shape or form. So 下载 the code and get involved with the News Group, help us to help you.<END><br>4 , urllink.zip User control to launch web browser and ...
It is up to the application to define what consistency means, and isolation in some form is needed to achieve consistent results. SQL Server uses locking to achieve isolation. Definition of ...
* Using a TDBLookupComboBox to display a list of data given by a detail TQuery results in the error "Field ‘‘ not found" (Quality Central 5384 and 4823). * TDBRadioGroup maintains its ...
- Updated Bochs TESTFORM to version 0.5 - SF patches applied [2864402] outstanding x2apic patches by Stanislav [2960379] Fix build with -Wformat -Werror=format-security by Per Oyvind Karlsen ...
dissect structures form can now show a list of known structures (pdb, mono, ...) Added a "revert to saved scan" option (lets you undo changes) Added a "forgot scan" option (in case you forgot what you...