Take a look at the paging SQL of a single SQL statement first.
Method 1:
Applies to SQL Server 2000/2005
Select Top Page Size * FROM table1 WHERE ID: (SELECT top Page Size * (page-1) ID from table1 ORDER by ID
Method 2:
Applies to
$id =isset ($_get[' id ')? $_get[' id ']: ';if (!is_numeric ($id)) {Exit ("Sorry, the user you visited ");}else{
$sql = "SELECT * from Wk_member where id= ' $id '";MySQL tutorial _query ("Update wk_member set m_hit=m_hit+1 where id= ' $id '");
The code is as follows
Copy Code
SELECT keyword, COUNT (*) as CountFrom Article_keywordGROUP by keywordOrder BY Count DESCLIMIT 20
This query statement returns 20 records with the most keyword repeat count (count) in the
It is useful to query all records for this quarter based on the current date.
Here are two SQL statements for access quarterly query records for your reference.
1, querying all records for the current quarterSELECT * FROM news where DATEPART (' Q ',
Turn from: http://tong7858-126-com.iteye.com/blog/829323
1. In versions above Oracle8, you can use the following statements to index names and queries that create INDEX statements.SELECT index_name,dbms_metadata.get_ddl (' INDEX ',
Select T.table_name,t.num_rows from User_tables t
If the above SQL is not found, execute the following script:>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>Create or Replace function count_rows (table_name in VARCHAR2,Owner in varchar2
The average person may use list.size or list==null to make judgments. The type returned when there is no return value is "[]" and it is not empty and has no elements, so using ==null and if (List.size () >0) {//Business logic} is unsuccessful.So
Today encountered a problem is to bulk update the value of a field in the database, you need to find out which table contains this field, organized the following statement to facilitate querySELECT
But the official website does not use the tutorial, oneself groped out, has the wrong time everybody points out to Oh, the common progress ~First is the configuration: modules\database\config\database.phpMultiple database configurations can be
Method One:
Select ' Name ' from Mysql.proc where db = ' your_db_name ' and ' type ' = ' PROCEDURE '//stored procedure
Select ' Name ' from Mysql.proc where db = ' your_db_name ' and ' type ' = ' function '//function
Method Two:
Show procedure
This article illustrates the method of Php+mysqli database query using preprocessing technology. Share to everyone for your reference. Specifically as follows:
The code has some difficulty, needs the basic knowledge to be able to understand better,
Title: Identify the employee's name, salary, department number, and average wage in the department above the average wage in the department
The structure of the table (table name is Sqltest)1, first find out the average wage of each department
※ The relationship between table and table 1, a one-to-one need of two tables. Of course, in order to save space for the project, usually only a table, if you want to achieve one-to-one query, you can build two views.
The example is as follows: 1
Whether a table config exists in the query in Sqlite3:
Select COUNT (*) from ' sqlite_master ' where type = ' table ' and tbl_name = ' config ';If the table exists, the return result is greater than 0, and if it does not exist, the return result
Reference: Click to open link
1. Group BY & Order BY & Q
Aggregation + ordering, the corresponding SQL statement is:
Select Currentpid, COUNT (*) from stats_x
where type=3 and (status =1 or Status=0)
GROUP BY Currentpid
ORDER BY currentpid
User table is usually we write "XX Management system" project must be used, in some cases the classification of people belong to the tree structure, that is, in addition to the highest level and the lowest layer, the middle layer has a relative
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.