`

Display Data Form MultiTables

阅读更多
 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;
 
 
分享到:
评论

相关推荐

    EhLib 9.1.038 for D7-XE-10.2

    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 ...

    SSD7 选择题。Multiple-Choice

    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 ...

    EhLib 8.0 Build 8.0.023 Pro Edition FullSource for D7-XE8

    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 ...

    EhLib 6.3 Build 6.3.176 Russian version. Full source included.

    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 ...

    rx第三方控件

    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 ...

    ehlib_vcl_src_9_3.26

    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 ...

    EhLib5.0.13 最新的ehlib源码

    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 ...

    EhLib 9.1.024

    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 ...

    FastReport.v4.9.81 for.Delphi.BCB.Full.Source企业版含ClientServer中文修正版

    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 ...

    PLSQL.Developer v11.0.0.1762 主程序+ v10中文包+keygen

    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 ...

    RxLib控件包内含RxGIF,全部源码及DEMO

    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 ...

    Visual C++ 编程资源大全(英文源码 控件)

    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...

    VB编程资源大全(英文源码 网络)

    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 ...

    微软内部资料-SQL性能优化3

    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 ...

    Delphi7.1 Update

    * 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 ...

    Bochs - The cross platform IA-32 (x86) emulator

    - 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 ...

    CE中文版-启点CE过NP中文.exe

    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...

Global site tag (gtag.js) - Google Analytics