Tags: here Select traffic Results Isolation LEVEL SEL level size catIn general, database optimization can be divided into 4 aspects from the hardware level:CPU: That is, reduce the computational complexity, such as reducing the various types of SQL aggregation functions, window functions, case when and so on.IO: (Less access to data during query result set.) Data optimization from here to a great extentNetwork: Less query result set size, eliminate un
Practice a bit,Take your time and watch it slowly.SHOW WARNINGS;SELECT from String_tbl;SELECT CONCAT ('Danke sch'CHAR(148'n');SELECT ASCII ('o');SELECT from String_tbl;SELECT POSITION ("is" in from String_tbl;SELECT (PNS* (8*6));SELECT MOD (10,4); select POW (2 , 10 ) kilobyte, POW (2 , 20 ) megabyte, -> POW (2 , 30 ) gigabyte, POW (2 , 40 ) terabyte; SELECT ROUND (72.09091ROUND(72.09092ROUND(72.09093) ;SELECT Sign ABS (avail_balance) - from Account;SELECT @ @global @ @session. T
' uq__testtable__023d5a04 'INSERT into TestTable (id,uniqueid,number,nonnull) VALUES (2,1,1,10);Change UniqueID from 1 to 2, continue inserting, prompt for Nsert statement conflict with CHECK constraint "Ck__testtable__numbe__03317e3d"INSERT into TestTable (id,uniqueid,number,nonnull) VALUES (2,2,1,10);Change number from 1 to 11, insert OKINSERT into TestTable (id,uniqueid,number,nonnull) VALUES (2,2,11,10);Note that the trigger is executed only after successful execution, and if a link fails,
The database is set up with the self-add column , sometimes need to clear the database from the new input data .sql statement " Delete indicates the name ", But when you insert the data again , you'll find that the self-increment column starts with the next value of the last deleted data's maximum value. ,1. is there a feeling , feeling quite distressed Now there is a simple brute force method that lets you delete data , and when you insert the
Label:Select
a.name as constraint name,
object_name (b.parent_object_id) as foreign key table,
D.name as foreign key column,
object_name ( b.referenced_object_id) as Master, c.name as
primary key column from
Sys.foreign_keys A
inner JOIN Sys.foreign_key_columns B On a.object_id=b.constraint_object_id
INNER join sys.columns C on b.parent_object_id=c.object_id and B.parent_ column_id=c.column_id
INNER JOIN sys.columns D on b.referenced_object_id=d.object_id and b.referenced_column_id= d.column_id
For SQL Server2000, open the SQL Server client ready to connect, and when the list of servers is pulled out, all SQL Server servers are listed for the entire LAN. So I found out that this UDP packet was broadcast from 1434 Port (192.168.0.255) on my own Machine (192.168.0.1), and then the
(sys.objects)The view is well known and is often used, mainly: Displays the UNION of all schema-scoped user-defined objects and system objectsMain field: 1. Name: Object Name 2. OBJECT_ID: Object identification number, which is unique in the data 3. PRINCIPAL_ID: Schema owner ID 4. PARENT_OBJECT_ID: id,0 = is not a sub-object 5 of the object to which this object belongs. Type: Object type, common type has, AF = aggregate function P =
The purpose of the SQL Union All directive is to merge the results of the two SQL statements together. The difference between SQL union All and SQL Union is that SQL Union
In the query analyzer, perform the following three steps in sequence, where databasename is your database file name
1. Clear logs: dump transaction databasename WITH NO_LOG
2. truncate transaction logs: backup log databasename WITH NO_LOG
3. shrink the database: dbcc shrinkdatabase (databasename)
--/////////////////////////////////////// ///////////////////////////
SQL Server Log clearing methodOne method: Clear logs.1. Open the query analyzer and en
SQL Server dynamically generates all table INSERT statements for a database2014-10-31 10:27 by listening to the wind blowing rain, 2757 reading, 2 reviews, Favorites, compilation I. BACKGROUNDSQL Server, what do we usually do if we need to put all of the table data for database A into database B? I will use the import and export function of SSMs, the import and e
SELECT from XX where (the benefit of this approach is that data records, fields can be controlled), but how can you quickly generate these statements for all the tables in the entire database?If you need to batch generate the following SQL, I think this article can help you:650) this.width=650; "src=" Http://common.cnblogs.com/images/copycode.gif "alt=" Copy Code "style=" Border:none RGB ( 221,221,221); Ba
SQL UNION operator
The UNION operator is used to merge the result sets of two or more SELECT statements.
Note that the SELECT statement inside the UNION must haveSame quantity. Columns must also haveSimilar data types. In additionSequenceMust be the same.
SQL UNION syntaxSELECT column_name (s) FROM table_name1UNIONSELECT column_name (s) FROM table_name2
Note: by default, the UNION operator selects different
Tags: delete demo allow data type result color Aggregate bin operationThis article was reproduced from: http://www.cnblogs.com/chaobaojun/archive/2009/12/24/1631508.html In Ms-sql If you combine the results of two or more queries into a single result set that contains all the rows of all queries in a union query, the common methods are as follows: I. using the U
actually very shivering, and in this particular case, we can use a simpler mathematical approach to avoid a divisor of 0 errors: SELECT Coll, col2
from dbo. Tl
WHERE Coll0and>2* The sample code explains the unique and important concept of "simultaneous operation" of SQL, and the fact that SQL Server can ensure that the When clause in a case expression is processed in the same order.
What if we want to get the number of all tables in the database? Let's look at several of the most common methods:-- Method 1 The code is as follows:Copy code Select B. name as tablename,C. row_count as datacountFrom sys. indexes,Sys. objects B,Sys. dm_db_partition_stats cWhere a. [object_id] = B. [object_id]AND B. [object_id] = c. [object_id]AND a. index_id = c. index_idAND a. index_id AND B. is_ms_shipped = 0 -- Method 2 The code is as fol
')
Select how many weeks of the year =datename (week, ' 2004-10-15 ')
, today is the week =datename (weekday, ' 2004-10-15 ')
function parameters/Functions
GetDate () returns the current date and time of the system
DateDiff (INTERVAL,DATE1,DATE2) returns the difference between Date2 and date1 two dates, as specified by interval date2-date1
DATEADD (interval,number,date) in the manner specified by interval, plus the date after number
DatePart (interval,date) returns the integer value of the spec
SQL Server Audit-record all operational recordsWhen it comes to auditing, it is believed that as an Enterprise Manager, as an ad administrator, it is generally possible to turn on auditing through policy and record some custom transaction logs. Auditing is the same for SQL Server, where the SQL Server audit object coll
Is there any simple way to prevent SQL injection once and for all? I searched it just now and it seems complicated.
Let me talk about my thoughts:
First of all, I don't know if MySQL can add single quotation marks for all types of data. I just tried to add single quotation marks around the integer.
If it is true tha
) dec_corrpay, sum (dec_qty) Dec_qty, sum (case WHE N flag_dedu = ' 1 ' then Dec_deduamt ELSE 0 END) dec_dedu AMT, SUM (case if flag_dedu = ' 1 ' then Dec_deduqty ELSE 0 END) Dec_deduqty from dfeepay_03 GROUP by dfeesum _no) b on a.dfeesum_no = B.dfeesum_noThere are 1433891 rows in the returned result set, whereSELECT COUNT (*) from dfeepay_03--1103914SELECT COUNT (*) from ctlm8686--1131586SELECT COUNT (*) from dfeeapp_03--302305In the
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.