sql query sort order specified

2011-01-07  来源:本站原创  分类:Database  人气:49 

Activities in the oracle group where just when an oracle to see how the specified order:

select * from table order by sunxun; if sunxun there are A, B, C, D, I will press the D, B, A, C sequence of row;

Will find some information online, see a useful query subquery, but written a bit complicated sql statement. Written in the back line to find a sql statement heroes, y then the data structure in mysql table, and verify success. Because computers are not installed oracle, the oracle no verification.

select * from table order by (select case sunxun when 'A' then 3 when 'B' then 1 when 'C' then 2 when 'D' then 4 end);

相关文章
  • sql query sort order specified 2011-01-07

    Activities in the oracle group where just when an oracle to see how the specified order: select * from table order by sunxun; if sunxun there are A, B, C, D, I will press the D, B, A, C sequence of row; Will find some information online, see a useful

  • sql query execution order theory and Select (sql optimization) 2011-07-26

    This article is reproduced from csdn blog Principles and Select sql query execution order Keywords: database a sql statement execution steps 1) syntax analysis and syntax of the statement is compliant to measure the significance of the expression of

  • Principles and SQL query execution order 2011-07-06

    A, sql statements execution steps: 1) syntax analysis and syntax of the statement is compliant to measure the significance of the expression of each statement. 2) semantic analysis, check the statement that all the database objects involved in the ex

  • Principles and Select sql query execution order 2011-09-29

    Step one sql statement 1) syntax analysis and syntax of the statement is in line with specifications, measure the significance of the expression of each statement. 2) semantic analysis, check the statement that all the database objects involved in th

  • [Turn] to improve the efficiency of the SQL query where clause conditions the order of how to write SQL statements to fully optimize your 2011-07-03

    To improve the efficiency of the SQL query where clause conditions the order of how to write your SQL statement to fully optimize the Category: Database 2010-11-10 18:17 33 Read Comments (0) Add report reproduced from suyineng Final edit suyineng Not

  • Reprinted: oracle SQL query used classic 2010-06-03

    oracle SQL query used classical 1, see table space name and size select t.tablespace_name, round (sum (bytes / (1024 * 1024)), 0) ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name group by t.tablespace_name;

  • Sql statement execution order 2010-06-07

    Sql correct implementation of the order: SQL standard analytical order: (1). FROM clause, and assembly of data from different data sources (2). WHERE clause, based on specified criteria to filter the records (3). GROUP BY clause, the data is divided

  • Summary of SQL query optimization 2010-10-22

    Recent projects require a higher data processing requirements, had to optimize the look, so do a consolidation, venture to throw a few bricks, hope to stay sort of people you pass by surprise. Expectations. . SQL query optimization summary 20,101,022

  • Common DBA SQL query 2010-11-06

    1. View name and size of the table space select t.tablespace_name, round (sum (bytes / (1024 * 1024)), 0) ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name group by t.tablespace_name; 2. See the table space

  • sql statement execution order - Introduction 2010-11-13

    A, sql statements execution steps: 1) syntax analysis, syntax analysis of whether the specification statement to measure the expression of the meaning of the statement. 2) semantic analysis, check the statement concerning the existence of all the dat

  • Oracle SQL query notes merge 2010-11-14

    In Oracle sql query process, you can use the set operators UNION, UNION ALL, INTERSECT (cross), MINUS (minus). Syntax: select statement 1 [UNION | UNION ALL | INTERSECT | MINUS] select statement 2; These operators have the same set of priorities, whe

  • JPA JPQL query. Sort .....( transfer) 2010-12-30

    JPQL is a query language with a similar feature with the SQL, JPQL is fully object-oriented, with inheritance, polymorphism, and association, and hibernate HQL is very similar. Query parameters JPQL statement supports the parameter definitions in two

  • 15 SQL query optimization approach (reproduced) 2011-07-28

    15 Ways to Optimize Your SQL Queries Posted on October 27 by Clay Previous article was on 10 Ways To Destroy A SQL Database that sort of teaches you what company might make many mistakes on their Database Eventually that will lead to a Database destr

  • SQL Query Optimization Summary 2010-10-22

    Recent projects require a higher data processing requirements, had to optimize the look and therefore make an order, venture to throw a few bricks, hope to stay sort of people you pass by surprise. Expectations. . SQL query optimization summary 20,10

  • sql query data in the preceding articles, 2010-04-01

    sql query in different database several data pre- 1. ORACLE SELECT * FROM TABLE1 WHERE ROWNUM <= N HQL: from table1 t order by t.createTime desc where rownum <= n 2. INFORMIX SELECT FIRST N * FROM TABLE1 4. SQL SERVER SELECT TOP N * FROM TABLE1 5. M

  • string sql query consolidation 2010-04-13

    string sql query consolidation Whether in sql 2000, or in the sql 2005, the Du aggregate functions do not provide the string, so when we deal with the following requirements, will be more troublesome: A table tb, as follows: id value ----- ------ 1 a

  • oracle query execution order 2010-06-09

    oracle statement to improve the efficiency of the method of inquiry 1: .. where column in (select * from ... where ...); 2: ... where exists (select 'X' from ... where ...); The second format to a format than the first high efficiency. In Oracle you

  • Through v $ sqlarea, v $ sql query queries the most resource- 2010-06-28

    Through v $ sqlarea, v $ sql query queries the most resource- ----------------------- v $ sqlarea, v $ sql ----------------------- Query from V $ SQLAREA the most resource-intensive queries select b.username username, a.disk_reads reads, a.executions

  • About hibernate sql query to return the result set of pure problem (hbm.xml does not write multi-table related) 2010-07-25

    I believe the brothers would have used hibernate for complex multi-table queries, in order to return the outcome of the assembly to a VO in the endless worry. I also do not stop to worry, but after reading the hibernate the transform, feeling this wa

  • SQL: Query the first 10 records 2010-08-25

    sql query in different database several data pre- 1. ORACLE SELECT * FROM TABLE1 WHERE ROWNUM<=N HQL: from table1 t order by t.createTime desc where rownum<=n 2. INFORMIX SELECT FIRST N * FROM TABLE1 3. DB2 SELECT * ROW_NUMBER() OVER(ORDER BY COL1 D