Declare @temp table ( [id] int IDENTITY (), [Name] varchar ())--select * from @temp declare @tempId int, @temp Name varchar INSERT INTO @temp values (' a '), insert into @temp values (' B '), insert into @temp values (' C '), insert into
First, top alternative set RowCountIn traditional SQL statements prior to SQL Server 2005, the top statement was not supported for local variables. See http://www.cnblogs.com/downmoon/archive/2007/12/29/1019686.htmlYou can use set RowCount at this
For example:ID Name Value1 a pp2 a PP3 B III4 B pp5 B pp6 C pp7 C pp8 C IIIID is primary keyAsk for such a resultID Name Value1 a pp3 B III4 B pp6 C pp8 C IIIMethod 1Delete yourtablewhere [id] not in (Select MAX ([id]) from yourtableGroup BY (name +
Comparison of not in, JOIN, is null, not exists EfficiencyStatement 1: select count (*) from A where A. a not in (select a from B)Statement 2: select count (*) from A left join B on A. a = B. a where B. a is nullStatement 3: select count (*) from A
Reasons for slow query speed in Database Analysis: 1. No index or no index is used (this is the most common problem of slow query and is a defect in programming) 2. Low I/O throughput, resulting in a bottleneck effect. 3. the query is not optimized
SQL Server query statement? -- ChildID, Name is the Name of the temporary table column SELECTChildID, ValueASNameINTO # pinYinFROMdbo. SpotWebWHEREName pinyin ANDParentIdf7cf01f4-76fa-4e8d-b715-05727371f3ae? IFOBJECT_ID (tempdb .. # temp)
10 tips for writing High-Performance Web Applications
This article discusses:· General video tutorials> asp. NET performance secrets· Useful skills and tips for improving asp.net Performance· Database usage suggestions in ASP. NET· Cache and
MySQL query repeated records in the table (1)
1. Search for redundant duplicate records in the Table. Repeat records determine the select * from peoplewhere peopleId in (select peopleId from people group by peopleId having count (peopleId)> 1) 2.
Oracle cursor is familiar to everyone. The following describes common attributes of Oracle cursor in detail. If you are interested in Oracle cursor, take a look.
Common Oracle cursor attributes:
% FOUND: When the variable finally obtains the record
Cs page call code:Copy codeThe Code is as follows:Public int TotalPage = 0;Public int PageCurrent = 1;Public int PageSize = 25;Public int RowsCount = 0;String userid, username;Public DataTable dt = new DataTable ();Public string path,
Principles of database indexing1, to determine whether the operation for the table is a large number of query operations or a large number of additions and deletions to change operations.2, try to build an index to help a particular query. Check
Optimization of ms SQL Server Query
Author: xmllover 2007-11-29
There are many reasons for slow query speed.
1. No index or no index is used (this is the most common problem of slow query and is a defect in programming)2. Low I/O throughput,
I. PDO
Represents a connection between a PHP and a database.
Method: pDO-constructor to build a new PDO object
Begintransaction-start transaction
Commit-Submit a transaction
Errorcode-returns an error code from the database, if any
Errorinfo-returns
The first is the stored procedure. Only the data that I need is retrieved. If the number of pages exceeds the total number of data records, the records on the last page are automatically returned:
Program
Code Set ansi_nulls on
Set
In general, when we use the select statements, they are all for a row of records,If you want to read a multi-row record (that is, a record set) in the query analyzer, you need to use a cursor or a while loop.
Cursor type:1. Static cursor (does not
Recently, someone asked me in the forum how to quickly generate an 8-bit number that is not repeated in 1 million. There are several points to note for this question:
1. How to generate an 8-bit random number. The more random the number is, the
I. An in-depth understanding of the index structureIi. Improve SQL statements
General paging display and storage process for small data volumes and massive data
Creating a web application requires paging. This problem is very common in database
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.