Today, I read a typical index interview question in the garden and asked the question "getting the highest score from 1 million records ". When we see this question, our usual practice is:
select top 1 * from student order by score descBut in this
From: http://hi.baidu.com/anson7722/blog/item/dd0f5c02357f5b024afb51ba.html
Explain is a keyword used by MySQL to explain select queries and can be easily used for debugging.Syntax format:Explain tbl_nameOr:Explain select select_optionsThe explain
If (despise using SQL statements and disdain Oracle){Break;} People often ask about{tagshow(event)}">DataDatabase End{tagshow(event)}">PagingThere are many problems, including using stored procedures. Today I try to use a simpler method to
Select... into statement
Create tabulation search.Syntax
Select field1 [, field2 [,...] into new table [in external database]From Source
The Select... into statement can be divided into the following parts:The name of the field to be copied to the
MySQL database optimization summary, mysql database Summary
I. Considerations for MySQL database Optimization
1. Database Design (rational table design) Three Paradigm (Standard Model)
The three paradigms include:
Paradigm 1: 1NF is a constraint on
MySQL common index, unique index, primary index, foreign key index, composite index, full-text index usage, mysql full-text index1. Common Index The only task of a common INDEX (INDEX defined by the KEY or INDEX keyword) is to speed up data access.
The execution sequence of select queries.
Some SQL statements that do not know why an error occurs are often because you do not know the execution sequence.
Select distinct top n [percent] column name
From table name
Where condition
Group by...
1. Basic query statement, special symbol |. Specifies the column alias AS, which uniquely identifies distinct.
1. Character connector "|" and "+"
Oracle: select column name | '123' from Table NameSQL: select column name + '000000' from table name T
2
The following articles mainly introduce the disadvantages of MySQL indexes and the actual operations of MySQL indexes, which deserves our attention, we may not know that using indexes too much will cause abuse. Therefore, MySQL indexes also have
Simple oracle query, simple oracle
Data Query uses the SELECT command to extract information from the database table.
Syntax structure: simple query
SELECT * | column name | expression FROM table name WHERE condition order by column name
Syntax
Which of the following SQL statement types can I ask? the prototype of the SQL statement is;
1. Select column list from table list name/View list name where condition.
2. Select column list from table list name/View list name where condition group
Syntax: row_number () over (partition by column order by column)
In short, row_number () starts from 1 and returns a number for each group record. row_number () over (order by xlh DESC) first orders the xlh column in descending order, return a
Today, we optimized a paging SQL statement. Although we have optimized thousands of SQL statements in the past, they are all OLAP statements. Although there are OLTP statements, we have never done paging optimization, so record it here.
The SQL and
On this page, we list all the syntaxes that list SQL commands on this website. For more detailed instructions, click the command name.
The purpose of this page is to provide a concise SQL syntax for your reference. We recommend that you press
For rownum, it is the number of the row returned from the query that is sequentially allocated by the Oracle system. The first row is allocated 1, and the second row is 2, this pseudo field can be used to limit the total number of rows returned by
Database Operation languageTags: command is case-insensitive but cannot use Chinese space punctuation, etc.ClassificationData Query Language DQLData Definition Language DDLData Manipulation Language DMLKnowledge of database theoryrelational
Simple query:First, query table name and column nameSelect *from Table NameSelect column 1, column 2 From table nameSelect DISTINCT column name from table name de-weight can only be a columnSecond, screeningSelect top three rows from table name
1.DISTINCT DISTINCT This keyword is used to filter out redundant duplicate records to keep only one, but it is often used only to return the number of distinct records, rather than using it to return all values that are not re-recorded. The reason
Reproduced1. String functionsFunction Name Parameter Example descriptionASCII (string expression)Select ASCII (' ABC ') returns 97Returns the ASCII code of the leftmost character in the string.Char (An integer expression)Select char (100) returns
1. The relationship between indexing and sortingAfter many attempts, I found that the direct select * from table is sorted by the clustered index by default.So if order by column has a nonclustered index in column, is the index used for sorting? The
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.