Label:SQL Server Replication Replication is a combination of technologies that you can use to replicate data and database objects from one database to another. The copy of the English is replication, repeating the meaning, not copy. The core function of replication is to store and forward, repeat this action to other databases after adding, deleting, and changing in the source database. Reasons for using replication 1. Load balancing: Reduce the load on the current server by replicating data to
operators to compare the column values of the concatenated columns. There are three types of internal connections:1. Equivalent connection: Use the equals sign (=) operator in the join condition to compare the column values of the joined columns, and the query results list all the columns in the joined table, including the repeating columns.2, unequal connections: Use a comparison operator other than the equals operator in the join condition to compare the column values of the connected columns
INNER JOIN query operation lists the rows of data that match the join criteria, which compares the column values of the connected columns using comparison operators. The inner connection is divided into three kinds:1. Equivalent connection: Use the equals sign (=) operator in the join condition to compare the column values of the connected columns, whose query results list all the columns in the connected table, including the repeating columns.2. Unequal connection: The column values of the con
from each of the two tables implements this. The only purpose of the third table is to establish a relationship between the fields of the other two tables. It does not itself contain any additional numbers
According
Notice how the field name is written in this example. To distinguish the same field name au_id in table authors and table titles, precede each field name with the table name before
Suffix and a period. Fields named author.au_id belong to table authors, and fields named titleauthor.
of the other two tables. It does not itself contain any additional data.
Notice how the field name is written in this example. To distinguish between table authors and the same field name au_id in table titles, precede each field name with a table name prefix and a period. Fields named author.au_id belong to table authors, and fields named titleauthor.au_id belong to table titleauthor and are not confused.
By using the third table, you can establish various types of relationships between the tw
1. SELECT statement
Basic syntax:
SELECT[ALL|DISTINCT] Field List
[Into table name]
[From table name]
[where-condition expression]
[GROUP by [All] field list]
[Having filter expression]
[Order By field List [Asc|desc]]
[Compute aggregate Function list [by field List]]
NOTE: The clauses in the SELECT statement must be used in the order described above. In other words, if the statement includes a GROUP BY clause and an ORDER BY clause where,group BY clause must be placed before the ORDER
a correlated subquery. Correlated subqueries can be introduced with in, not in, EXISTS, not EXISTS. For related subqueries, it should be noted that: (1) A, not in, not EXISTS related subquery can use the left join instead of the notation. For example: Select Pub_name from publishers where pub_id not in (select pub_id from TITLES WHERE TYPE = ' business ') can be rewritten as: Select A.pub_name from Publishers
example, the following uses equijoin to list authors and publishers in the same city in the authors and publishers tables:
SELECT *
FROM authors AS a inner join publishers AS p
ON a. city = p. city
If you use a natural connection, delete the duplicate columns (city and state) in the authors and publishers tabl
table, including duplicate columns, are listed in the query results.
2. unequal join: Use a comparison operator other than the equal operator to compare the column values of the connected columns. These operators include >,>=,
.
3. Natural join: Use the equal to (=) operator in the connection condition to compare the column values in the connected column. However, it uses the selection list to indicate the columns included in the query result set, delete duplicate columns in the connectio
subqueries. Note the following for related subqueries:
(1)
For subqueries related to a, not in, and not exists, you can use left join instead. For example, SELECT PUB_NAME from publishers where PUB_ID not in (SELECT PUB_ID from titles where type = 'business') can be rewritten to: select. PUB_NAME from publishers a left join titles B on B. TYPE = 'business' and. PUB_ID = B. PUB_ID where B. PUB_ID IS NULL
use IN, not in, EXISTS, and not exists to introduce related subqueries. Note the following for related subqueries:
(1) for subqueries not in and not exists, use left join instead. For example:
SELECT PUB_NAME from publishers where PUB_ID NOTIN (SELECT PUB_ID from titles where type = 'business ')
It can be rewritten:
Select a. PUB_NAME from publishers a leftjoin titles B on B. TYPE = 'business' and a. PUB_I
be blocked and cannot receive Google notification emails. Now Gmail has opened free registration. If you do not have a Gmail account, you 'd better register a Gmail mailbox before applying for a Google Adsense account. If you are not using a Google email address, you may try to use your application account (email address) even though you have not received an email notification after applying for a few days) log on to Google Adsense. If you can log on, the application is successful.
(7) cheris
operation lists the data rows that match the connection condition. It uses the comparison operator to compare the column values of the connected columns. Internal Connection scoreThree types:1. equijoin: Use the equal sign (=) operator in the connection condition to compare the column values in the connected column. The joined column values are listed in the query results.All columns in the table, including duplicate columns.2. Unequal join: Use a comparison operator other than the equal operat
occurs during connection. Generally, you can specify the field sorting rule database_default when creating a temporary table in create table to avoid the above problems.
5. subquery usage
A subquery is a SELECT query nested in select, insert, update, delete statements, or other subqueries. Subqueries can be used wherever expressions are allowed.
Subqueries allow for flexible programming and can be used to implement some special functions. However, in terms of performance, an inappropriate
connection table are deleted.For example, the following uses equijoin to list authors and publishers in the same city in the authors and publishers tables:Select *From authors as a inner join publishers as POn a. City = P. City
If you use a natural connection, delete the duplicate columns (city and state) in the authors and
. CNO, AVG (Y. Degree) as "average score"From student X, score yWhere X. Class = ''95033'' and X. Sno = Y. Sno group by Y. CNO(3) query student and score table information of all students:Select X. *, Y. * from student X, score y Where X. Sno = Y. SnOUse equijoin to list authors and publishers in the same city in the authors and publishers tables:Select * from authors as a inner join
. Internal Connection scoreThree types:1. equijoin: Use the equal sign (=) operator in the connection condition to compare the column values in the connected column. The joined column values are listed in the query results.All columns in the table, including duplicate columns.2. Unequal join: Use a comparison operator other than the equal operator to compare the column values of the connected columns. TheseOperators include >,>=, 3. Natural join: Use the equal to (=) operator in the connection c
(i) Internal connectionsSQL INNER JOIN keywordWhen there is at least one match in the table, the INNER JOIN keyword returns a row.The INNER JOIN query operation lists the rows of data that match the join criteria, which compares the columns of the connected column with the comparison operator.The column value. The inner connection is divided into three kinds:1. Equivalent connection: Use the equals sign (=) operator in the join condition to compare the column values of the connected columns, who
condition. These operators include >, >=,
3. Natural connection: Use the Equals (=) operator in the join condition to compare the column values of the connected columns, but it uses a select list to indicate the columns included in the query result collection, and deletes the duplicate columns from the attached table.
For example, the following uses an equivalent connection to list authors and publishers in the same city in the authors and
notation. For example: Select Pub_name from publishers where pub_id not in (select pub_id from TITLES WHERE TYPE = ' business ') can be rewritten as: Select A.pub_name from Publishers A, left JOIN, TITLES B on b.type = "Business" and a.pub_id=b. pub_id WHERE b.pub_id is NULL (2)
SELECT TITLE from TITLES
WHERE not EXISTS
(SELECT title_id from SALES
WHERE title_id = TITLES. title_id)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.