required, that is, a unique field that cannot be repeated. The primary key type can be any. Multiple fields can be sorted. Multiple fields can be sorted in their own way.
The basic SQL code for reading the second page of data, with 10 data records per page
For example, descending order:
Select * From table_test where table_id in (Select top 10 table_id from (Select top 10 table_id, table_orderid from table_test order by table_orderid DESC, table_id DESC) T order by table_orderid
) TRANSACTION:TRANSACTION 5120, ACTIVE 17 sec starting index readmysql tables in use 1, locked 1LOCK WAIT 3 lock struct(s), heap size 1136, 2 row lock(s)MySQL thread id 10, OS thread handle 123145556967424, query id 2764 localhost root updatingupdate user set name='haha' where id=4*** (1) WAITING FOR THIS LOCK TO BE GRANTED:RECORD LOCKS space id 94 page no 3 n bits 80 index PRIMARY of table `test`.`user` trx id 5120 lock_mode X locks rec but not gap waitingRecord lock, heap no 5 PHYSICAL RECORD:
about the index columns on a single table. gx_adm @ CABO3> @ idx_infoEnter value for owner: GX_ADMEnter value for table_name: CLIENT_TRADE_TBLTABLE_NAME INDEX_NAME CL_NAM CL_POS STATUS IDX_TYP DSCD certificate -------------------- -------- ----------------- ---- CLIENT_TRADE_TBL certificate ACC_NUM 1 valid normal asc limit CANCEL_DATE 1 VALI D normal asc limit CONTRACT_NUM 1 valid normal
=-1 Then ' Get all!
GetBytes = Objtextstream.read (lngsize) ' ReadAll
Else
GetBytes = Objtextstream.read (bytes)
End If
Objtextstream.close
Set objTextStream = Nothing
Set objFSO = Nothing
End Function
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
':: Functions to convert two bytes to a numeric value (long)::
'::: (both Little-endian and Big-endian):::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function Lngconvert (strtemp)
Lng
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
'::: The following is the ability to convert two bytes into a unified value::
'::: (small endian and large endian):::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function Lngconvert (strtemp)
Lngconvert = CLng (ASC (Left (strtemp, 1)) + ((ASC (Right (strtemp, 1) * 256))
End Function
function Lng
=-1 Then ' Get all!
GetBytes = Objtextstream.read (lngsize) ' ReadAll
Else
GetBytes = Objtextstream.read (bytes)
End If
Objtextstream.close
Set objTextStream = Nothing
Set objFSO = Nothing
End Function
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
':: Functions to convert two bytes to a numeric value (long)::
'::: (both Little-endian and Big-endian):::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function Lngconvert (strtemp)
Lng
"Length"ASC| DESC ")
) When you create an index, you can specify the length of the index, because different storage engines define the maximum number of indexes and the maximum index length for the table. The storage engine supported by MySQL supports at least 16 indexes per table with a total index length of at least 256 bytes. Examples are as follows: CREATE TABLE t_dept (
INT,
varchar()
,varchar (+),
INDEX index_deptno (deptno)
); To create a nor
::: ''::::: :::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::: function getbytes (flnm, offset, bytes) dim objfso dim objftemp dim objtextstream dim lngsize on error resume next set objfso = Createobject (" script ing. fileSystemObject ")
''first, we get the filesize set objftemp = objfso. getFile (flnm) lngsize = objftemp. size set objftemp = nothing fsoforreading = 1 set objtextstream = objfso. opentextfile (flnm, fsoforreading) If Offset> 0 then strbuff = objtext
=-1 Then ' Get all!
GetBytes = Objtextstream.read (lngsize) ' ReadAll
Else
GetBytes = Objtextstream.read (bytes)
End If
Objtextstream.close
Set objTextStream = Nothing
Set objFSO = Nothing
End Function
'':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
''::: :::
'::: Functions to convert two bytes to a numeric value (long)::
'::: (both Little-endian and Big-endian):::
''::: :::
'':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function Lngconvert (strtemp)
, that is, the field that appears in the GROUP BY clause.3. A federated query between the child table of the dependency and the parent table, which is the primary key or foreign key field.4. Set a field with a unique full constraint.
2. Create and view indexes:index operations include creating indexes, viewing indexes, and deleting indexes. To create an index is to index a field or multiple fields in a table, in MySQL, you can usually create indexes in three ways, create indexes when creating t
the 11 directories. The ASP file is encrypted and the encoded output file is placed in the F:\LABXW-JM directory
(2) Examples of operation
For example, to encrypt the lacl.asp file in the current directory and generate the encrypted file ulacl.asp, enter the command in DOS:
Screnc lacl.asp ulacl.asp
All in the current directory. The ASP file is encrypted and the encoded output file is placed in the F:\LABXW, then the command is used:
Screnc *.asp F:\labxw
2, the use of components to encrypt ASP
all! GetBytes = Objtextstream.read (lngsize) ' ReadAll Else GetBytes = objtextstream.read (bytes) End If Objtextstream.close Set objtextstream = Nothing Set objFSO = Nothing End Function
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'::: :::':: Functions to convert two bytes to a numeric value (long)::'::: (both Little-endian and Big-endian):::'::: :::':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::function Lngconvert (strtemp)Lngconvert = CLn
How to write SQL statements for such requirements? A sorted SQL statement
Sort by status field in reverse order
If the status = 1 time field is in positive order, if the status = 0 time field is in reverse order
The following are the expected results.
Id status time
5 1 50
6 1 51
1 0 99
10 0 1
Reply to discussion (solution)
Select * from (select * from table where status = 1 order by time) aunion allselect * from (select * from table where status = o order by time desc) B
dictionary which should retain the maximum number of rows in the database select count (*) FROM ipdatas WHERE uid = 1; return result time: 2 minutes 31 seconds 594Select count (id) FROM ipdatas WHERE uid = 1; return result time: 1 minute 29 seconds 609Select count (uid) FROM ipdatas WHERE uid = 1; return result time: 2 minutes 41 seconds 813The second query is faster. because mysql has a cache area, increasing the cache area size can solve many query optimizations, the cache is everywhere. In p
", sqldbtype.nvarchar,50),
New SqlParameter ("@OrderField", sqldbtype.nvarchar,200),
New SqlParameter ("@OrderType", sqldbtype.nvarchar,2),
New SqlParameter ("@TableName", sqldbtype.nvarchar,300),
New SqlParameter ("@strWhere", sqldbtype.nvarchar,300),
};
Parameters[0]. Direction = ParameterDirection.Output;
PARAMETERS[1]. Direction = ParameterDirection.Output;
PARAMETERS[2]. Value = pageSize;
PARAMETERS[3]. Value = CurrentPage;
PARAMETERS[4]. Value = "A.rlid,a.companyname,a.website,a.
The first scenario, the simplest, the common method:
Copy Code code as follows:
Select Top * from ARTICLE WHERE ID. (select top 45000 ID to ARTICLE order by year DESC, id DESC) Esc,id DESC
Average Enquiry 100 Time: 45s
The second option:
Copy Code code as follows:
SELECT * FROM (select top 45030 * from ARTICLE, DESC, ID DESC) F ORDER by F.year ASC, F.id DESC) s ORDER by S.year Desc,s.id DESC
Average
increase the size of the buffer can solve a lot of query optimization, is really a cache everywhere AH in the program development is also a layer of cacheQuerying data
The code is as follows
Copy Code
First start query SELECT * FROM Ipdatas ORDER by ID DESC LIMIT 1,10; 31 ms SELECT * from IP Datas LIMIT 1,10; 15MS 10,000th start query SELECT * from Ipdatas ORDER by ID ASC LIMIT 10000,10; 266 cents SEC SELEC
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.