Find repetitions in the same table
1.Select * from corp WHERE Enterprise Name in (SELECT Enterprise Name from corp Gropu BY company name Where count> 1)
Multi-condition branching in SQL
2
SELECT FLAG =
Case Enterprise Name When 'China Peking University' Ten '1'
WHEN 'Peking University Philosophy' Then '1'
WHEN 'North University Philosurium' Ten '1'
ELSE Enterprise Name '2' end,
Enterprise name, number of employees, corporate funds, corporate leadership
INTO #TEMP
From corp
SELECT company name, number of employees, corporate funds, corporate leadership
From #Temp
WHERE FLAG in (SELECT FLAGWHERE COUNT (FLAG)> 1)
Judgment using CASE in SQL
SELECT JYID,
Case
Calculate the list of conditions and return one of multiple possible results expressions.
Case has two formats:
The simple case function compares an expression with a set of simple expressions to determine the result. The CASE search function calculates a set of Boolean expressions to determine the result.
Both formats support optional ELSE parameters.
grammar
Simple case function:
Case INPUT_EXPRESSION WHEN WHEN_EXPRESSION THEN RESULT_EXPIPRESSION [... N] [ELSE ELSE_RESULT_EXPRESSION END
CASE search function:
Case when boolean_expression dam_expression [... n] [else else_result_expression end
parameter
Trigger use
When defined for a table or view, INSERT DELETE is defined for a table or view
Update's INSTEAD OF type trigger and executes the corresponding operation, although the trigger is triggered but
The corresponding operation is not performed and is only the trigger SQL statement itself.
The main advantage of the INSTEAD OF trip is that the view that cannot be modified can support modification.
Update operations include two parts, first remove the updated content and insert the new value into
Therefore, a table defining the update type trigger is stored in the delete table when the report will update the operation.
Value new value in the insert table
SQL Server
A number of extended stored procedures that can access the system registry
.
But in fact these extended stored processes are undisclosed
,
From
SQL Server 7.0
There is
,
in
SQL Server 2000
Still reserved
,
They may be deleted later
.
But these stored procedures are provided in current
SQL Server
The ability to access the system registry in the version
,
And many people use
SQL Server
When attacking the system
,
It is often used in these extended stored procedures.
.
So the best
SQL Server
Disable them
.