One, connection query: through the connection operator can implement more than one table query.
Connection is the main feature of relational database model, and it is also a sign that distinguishes it from other types of database management system.
Common two link operators :
1.join on (left/right connection)
2.union (up and down connections) Note: You can connect only if the data type of the column is the same
Second, the variable
The SQL language, like other programming languages, has control statements such as variables, branches, loops, and so on.
In SQL language, variables are divided into local variables and global variables, and global variables are called System variables (@@).
Local variables:
Using the declare keyword to declare a variable, the syntax is simple:declare @< variable name > < variable type >
You can assign values to variables using the set keyword, and you can assign only one value to a variable at a time using the Set keyword.
We can also assign a value to this variable in a query statement.
Global variables: Also called system variables.
Operator:
Operator Precedence
If ... else..
While statement
While if nesting
SQL database Connection Query variables, if else, while