SQL Note

xiaoxiao2021-03-06  81

Select * from useertableORDER BY AGE DESC, USERID ASC first sorted from the age from large to small, then pressing Uerid from smaller to large. ============================================================================================================================================================================================================= ================================================ SELECT P1.PUB_ID, P2.PUB_ID, P1. PR_INFOFROM PUB_INFO AS P1 INNER JOIN PUB_INFO AS P2ON DATALENGTH (P1.PR_INFO) = DATALENGTH (P2.PR_INFO) ============================= ============================= Connection type can be divided into three: internal connections, external connections, and cross-connect. It is divided into equivalence connection, natural connection, and not waiting for three types. The external connection is divided into left-way connections (Right Outer Join or Right Join) and all-end connections (Full Outer Join) Or Full Join is three.

The following uses the equivalent connection lists Author and Publishers in the same city in the table: Select * from authors as a.city = p.city, use natural connection, delete in the selection list Authors and Publishers Table repeat column (city and state): select a. *, p.pub_id, pub_name, p.countryfrom authors as a.city = p.city

The cross-connection does not take the WHERE clause, it returns the two tables of the two tables that are connected, and the number of data lines in the result collection is equal to the number of data lines that meet the query conditions in the first table. The number of data lines that meet the query conditions in a table. In the case, there are 6 types of books in the Titles table, and 8 publishers in the Publishers table, the number of records retrieved in the following cross-connects will be equal to 6 * 8 = 48 lines. SELECT TYPE, PUB_NAMEFROM TISD JOIN PUBLISHERSORDER by Type

转载请注明原文地址:https://www.9cbs.com/read-94667.html

New Post(0)