什么是连接-复杂查询技术-连接

时间:2024-05-15 15:58:09
【文件属性】:

文件名称:什么是连接-复杂查询技术-连接

文件大小:671KB

文件格式:PPT

更新时间:2024-05-15 15:58:09

sql

什么是连接 连接可以用来从多个表中查询数据 语法 SELECT column_name, column_name [,column_name] FROM table_name [CROSS|INNER|[LEFT | RIGHT]OUTER] JOIN table_name [ON table_name.ref_column_name join_operator table_name.ref_column_name] [WHERE search_condition] * Defining Joins When data from more than one table in the database is required, a join condition is used. Rows in one table can be joined to rows in another table according to common values existing in corresponding columns, that is, usually primary and foreign key columns. To display data from two or more related tables, write a simple join condition in the WHERE clause. In the syntax: table1.column denotes the table and column from which data is retrieved table1.column1 = is the condition that joins (or relates) the tables together table2.column2 Guidelines When writing a SELECT statement that joins tables, precede the column name with the table name for clarity and to enhance database access. If the same column name appears in more than one table, the column name must be prefixed with the table name. To join n tables together, you need a minimum of (n-1) join conditions. Therefore, to join four tables, a minimum of three joins are required. This rule may not apply if your table has a concatenated primary key, in which case more than one column is required to uniquely identify each row. For more information, see Oracle Server SQL Reference Manual, Release 8, “SELECT.”


网友评论