Copy codeThe Code is as follows:Declare @ TotalCount intDeclare @ TotalPageCount intExec P_viewPage_A 'type1', '*', 'id', ', 'Id asc', @ TotalCount output, @ TotalPageCount outputSelect * from type1Create PROC P_viewPage_A/*Nzperfect [no_mIss] efficient and common paging Stored Procedure (bidirectional retrieval) 2007.5.7 QQ: 34813284Tip: Applicable to tables or views with a single primary key or a unique value columnPs: the SQL statement is 8000 byte
page, and an error (greater than 6 and less than or equal to 7) is returned when you guessed 7, the column length is 7. Because "top 1" means to extract the first record, it should be used if you want to guess the second record:
Select top 1 len (column name) from Table Name
Where column name not in (select top 1 column name from table name)
2. ASCII code analysis method to guess the user and password
ASC () and Mid Functions
Example: mid (column n
into TB values ('zhang san', 93)
Insert into TB values ('Lee 4', 94)
Go
-- SQL Server 2000 static SQL.
Select * from
(
Select name, course = 'China', score = Chinese from TB
Union all
Select name, course = 'mat', score = mathematics from TB
Union all
Select name, course = 'physical ', score = physical from TB
) T
Order by name, Case course when 'China' then 1 when' math 'then 2 when' then 3 end
-- SQL Server 2000 dynamic SQL.
-- Call the dynamic ecosystem of the syste
into TB values ('zhang san', 93)
Insert into TB values ('Lee 4', 94)
Go
-- SQL Server 2000 static SQL.
Select * from
(
Select name, course = 'China', score = Chinese from TB
Union all
Select name, course = 'mat', score = mathematics from TB
Union all
Select name, course = 'physical ', score = physical from TB
) T
Order by name, Case course when 'China' then 1 when' math 'then 2 when' then 3 end
-- SQL Server 2000 dynamic SQL.
-- Call the dynamic ecosystem of the syste
How to sort JavaScript Object arrays by specified attributes and sorting directions? javascript Array
Introduction
In a data-centric Information System, it is common to present data in the form of tables. Sorting data is essential. Sorting can be divided into sorting by a single field and sorting by multiple fields in different sorting directions. Single-field sorting has many limitations and cannot meet users' requirements for changing data concerns. Multi-field sorting can make up for this def
SQL-92 syntax. Use left Outer Join Assume that the authors table and the publishers table are joined in the city column. The results only show the author of the publisher's city (Abraham Bennet and Cheryl Carson in this example ). To include all authors in the results, regardless of whether the publisher lives in the same city, use the SQL-92 to connect left out. The following are the query results of the left Outer Join of transact-SQL: Use pubs Select a. au_fname, A. au_lname, P. pub_nam
the SQL-92 syntax.
Use left Outer JoinAssume that the authors table and the publishers table are joined in the city column. The results only show the author of the publisher's city (Abraham Bennet and Cheryl Carson in this example ).
To include all authors in the results, regardless of whether the publisher lives in the same city, use the SQL-92 to connect left out. The following are the query results of the left Outer Join of transact-SQL:
Use pubsSelect a. au_fname, A. au_lname, P. pub_
Copy codeThe Code is as follows: declare @ TotalCount int
Declare @ TotalPageCount int
Exec P_viewPage_A 'type1', '*', 'id', ', 'Id asc', @ TotalCount output, @ TotalPageCount output
Select * from type1
Create PROC P_viewPage_A/*Nzperfect [no_mIss] efficient and common paging Stored Procedure (bidirectional retrieval) 2007.5.7 QQ: 34813284Tip: Applicable to tables or views with a single primary key or a unique value columnPs: the SQL statement is 800
After SQL optimization, the query speed can be greatly improved.
The code is as follows:
/**
* @ Filename: page. SQL. class. php
* @ CreatTime: 2009-01-06
* @ Descrition: This class is an SQL statement processing class.
* @ UpdateTime-1: null
* @ Version: jswweb1.0.0
* @ Author: fkedwgwy
* @ Dome:
$ SQL // SQL statement
$ Allcount // total number of records
$ Pagesize // number of records displayed on the page
$ Page // current page
$ Sqlc = new sqlpage ($ SQL, $ allcount, $ pagesize, $ page )
The so-called subquery is the embedding of several small queries within a query.
Grammar:Select "Distinct" * | column name "Alias", Column name "Alias" ... | Statistical functions, (select "DISTINCT" *| column name "Alias", Column name "Alias" ... | Statistical functionsFrom data table "alias", Data table "Alias" ..."Where condition (s)""Group by Group field, Group field, ...""Having group after filter""Order By Field" Asc|desc ", Field"
Copy CodeThe code is as follows:
/**
* @Filename:p age.sql.class.php
* @CreatTime: 2009-01-06
* @Descrition: This class handles classes for SQL statements.
* @UpdateTime-1: null
* @Version: jswweb1.0.0
* @Author: Fkedwgwy
* @Dome:
$sql//sql Statements
$allcount//Total Record Count
$pagesize//page shows the number of record bars
$page//Current page
$SQLC = new Sqlpage ($sql, $allcount, $pagesize, $page);
$sql = $SQLC->getsql ();
The optimized statement:
SELECT * FROM (select top of LSH,ZTM,DYZRS
As we all know, Mysql paging requires the use of Limit for paging. When the data size is small, the Limit performance can be imagined. For example: {code...} the preceding SQL statement has no performance problems. However, if the offset is too low, a performance bottleneck may occur. For example, {code... as we all know, Mysql uses Limit for paging. When the data volume/Page Shard is small, the Limit performance can be imagined. For example:
SELECT pid,author,hash,dateline FROM posts WHERE pid
beginning of the program, in the following infection function section, you can use it to delete the main program body of the software. Pigs can think of problems, do not need me to say again. Because my net name is also called "pig", these must rob in the anti-virus software before running up to achieve the goal.
(2). The virus should use the deformation function as much as possible, use the new encryption algorithm, of course, the script encryption algorithm is very simple, at this point new h
greater than 1 InStr InStr (string1,string2 [, compare]) Returns the position of the first occurrence of the string1 string in the string2 string Split Split (String1,delimiter[,count[,start]) splits the string into a one-dimensional array based on delimiter. Where delimiter is used to identify substring bounds. If omitted, a space ("") is used as the delimiter. Count returns the number of substrings,-1 indicates that all substrings are returned. Start performs a text comparison for 1, or bin
data whose role_id is 1 to 10, but the result is unexpected.
SELECT * FROM `tbl` ORDER BY `role_sort` DESC , `role_id` DESC
Can I change an SQL statement once when this problem occurs?
Desc is in descending order. it is arranged in descending order. of course 10 is placed in front of 1, and the role_id uses asc.
There is a lot of content in a table. we need to put some self-considered important content through human intervention, so that
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.