'************************************' Getmidpageindex calculates the page index of the middle page'************************************Private Function Getmidpageindex ()Getmidpageindex = (xpagecount)-1End Function'************************************' GetPage the current page'************************************Private Function getpage (ipagecount)Dim IPageIPage = Request ("page")If ipage = "" Then xPage = "1"If not IsNumeric (ipage) Then ipage = "1"IPage = CLng (ipage)If ipage gt; Ipagecount
We know that in the SQL, you can use like this predicate (expression) for fuzzy retrieval, and support for the%,?, _ and other placeholders.
However, the function of this fuzzy search has many limitations, simply too vague.
The REGEXP keyword is provided in MySQL to support regular expressions, of course, just some simple regular.
First, we construct some test data.
?
1 2 3 4 5 6 7 8 9
--Create a table use test; DROP TABLE IF EXISTS T_regcustomer; CREATE TABLE t_regcustomer
specified in the primary key definition. When you consider a search that will be performed through a primary key in the future, determine which column should be in the front.Note that creating a composite index should contain a few columns, and these columns are often used in select queries. Having too many columns in a composite index doesn't give you too much benefit. And because it uses quite a lot of memory to store the values of the columns of a composite index, the result is memory overfl
(col1 ASC, col2 DESC, col3 ASC)
Three columns are: col1 ascending, col2 descending, col3 Ascending. Now if we execute two queries
1:select col1, col2, col3 from table1 ORDER by col1 ASC, col2 DESC, col3 ASC
Same as Index order
2:select col1, col2, col3 from table1 order by col1 DESC, col2
reduce the ordering, which SQL is not. Suppose T1 table exists index Key1 (key_part1,key_part2), Key2 (Key2)
A. sql that can be used to avoid sorting by index
SELECT * from T1 ORDER by Key_part1,key_part2;
SELECT * from t1 WHERE Key_part1 = constant ORDER by Key_part2;
SELECT * from t1 WHERE Key_part1 > Constant order by Key_part1 ASC;
SELECT * from t1 WHERE key_part1 = constant1 and Key_part2 > Constant2 order by Key_part2;
B. SQL th
1: First of allSelect Row_number () over (order by ID ASC) as ' RowNumber ', * from table1Generate a collection with an ordinal2: Re-query the 1th to 5th data of the collectionSELECT * FROM(select Row_number () over (order by ID ASC) as ' RowNumber ', * from table1) as Tempwhere RowNumber between 1 and 5The full SQL statementdeclare @pagesize int; declare @pageindex int; Set @pagesize = 3Set @pageindex = 1;
and RowNum. To put it simply, the implementation method is as follows: SELECT Column Name 1 ... Column name n from (SELECT column Name 1 ... Column name n from table name ORDER by column name 1 ... Column name N) WHERE ROWNUM ORDER by ROWNUM ASC Here is an example to illustrate briefly. Customer table Customer (Id,name) has the following data: ID NAME First Second Third Forth, Geneva Fifth Sixth Seventh Eighth Ninth Ten Tenth Last The SQL statement
RPM: http://blog.csdn.net/qiaqia609/article/details/41445233 SQL Server Database paging query has been a short board for SQL Server,The first scenario, the simplest and the most common method:The code is as follows:
Select Top article WHERE ID not in (select top 45000 ID from article ORDER C11>by Year desc, ID DESC) ORDER by year desc,id desc
Average 100 times required: 45sThe second scenario:The code is as follows:
SELECT *from (selecttop30* from (se
with 10g, the algorithm changes to:1) Oracle uses MD5 to hash the library cache object names, resulting in a 128-bit hash value.2) Oracle takes the latter 64 bits of the MD5 hash as sql_id (but it is presented as a base-32 encoding, rather than using hexadecimal or regular values).3) Oracle takes the MD5 hash value as a hash_value (that is, v$sql.hash_value).Often speaking of base-x coding, to tell the truth, I do not understand, cited some predecessors on the principle of the introduction of t
Label:1: First of all Select Row_number () over (order by ID ASC) as ' RowNumber ', * from table1 Generate a collection with an ordinal 2: Re-query the 1th to 5th data of the collection SELECT * FROM(select Row_number () over (order by ID ASC) as ' RowNumber ', * from table1) as Tempwhere RowNumber between 1 and 5 The full SQL statement declare @pagesize int; declare @pageindex int; Set @pagesize = 3 Set @p
, then you need to write paged SQL. 3. Operation procedure Take the Frdemo built-in SQLite as an example to illustrate how SQLite writes paged queries. Note: sqlserver2005 and SQLite operate the same steps. 3.1 New Data set New Data Set Ds1:select * from Order details. 3.2 Add paged Query SQL statement Click the Paging Query button in the Data query panel to edit the paging SQL statement, such as: SELECT*FROM ( SELECT* from ( SELECT* FROM Order Details ORDERBY order Idasclimit${fr_pagesize*f
I finally decided to resign today. I took half a day off for an interview! When I was doing A pen test: I encountered an SQL statement to query 31st to 40 records in table A of the database. The table has an auto-incrementing field ID, and the id is not consecutive. I wrote the following SQL: selecttop10 * from (selectTop40 * fromAorderbyIDasc) ord
I finally decided to resign today. I took half a day off for an interview! When I was doing A pen test: I encountered an SQL statement to query 31st
How to obtain the first few pieces of data in the Oracle database? It is similar to the SELECTTOPN method in SQL statements. This article will show you the answer, for example!
How to obtain the first few pieces of data in the Oracle database? It is similar to the select top n method in SQL statements. This article will show you the answer, for example!
How to obtain the first few pieces of data in the Oracle database? It is similar to the select top n method in SQL statements. This article
(character) returns the encoding of a characterChr (number) nchar (number) is opposite to asc, Return Characters Based on number encodingMid (string, N, L)Substring (string, N, L)Returns a substring of L from N characters, that is, a string between N and N + L.When guessing Chinese characters, we can also use the GetFieldValue (iUrl, TableName, FieldName, PrimaryKey, PKValue, minlen, maxlen) function to call them. However, pay attention to the follow
This article uses examples to teach you how to implement the select top n method in Oracle.
1. implement select top n in Oracle:
Since ORACLE does not support the select top statement, order by and ROWNUM are often used in ORACLE to query the select top n statement.
To put it simply, the implementation method is as follows:
Double-click all code
12345
SELECT column name 1... column name n FROM(SELECT column name 1... column name nFROM table name order by column name 1... colum
tablename (
Column1 type,
Column2 type,
....
INDEX | KEY [indexname] (columname [(length)] [ASC | DESC])
)
Use index or key to specify a field as an index.
You can specify the index length when creating an index. This is because different storage engines define the maximum number of indexes and the maximum index length.
The storage engine supported by mysql supports at least 16 indexes for each table, with a tot
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.