Equivalent Analytical SQL equivalent

DB version: 10Gr2
Is there any analytical SQL equivalent of the below ANSI SQL
select schemaname, count(*)
from v$session
group by schemaname
order by count(*) desc

Hi,
Sure.
It's less efficient than GROUP BY, but here's one way to do it:
SELECT DISTINCT     schemaname
,          COUNT (*) OVER (PARTITION BY schemaname)     AS cnt
FROM          v$session
GROUP BY     schemaname
ORDER BY     cnt          DESC
;"GROUP BY scemaname" produces one row per value of schemaname; without GROUP BY, you need SELECT DISTINCT .
Almost all the aggregate functions (like COUNT) have analytic versions.
PARTITION BY is the analytic counterpart to the aggregate GROUP BY.

Similar Messages

  • Analytic sql question

    Dear All,
    I have the following problem of getting the output table from the input table below.
    Do you have any idea of doing this with the help of analytic sql?
    p.s. I have done this by using pure plsql block which is too slow to run with high amount of data. Below data is just a sample, in real I have millions rows of data.
    Input table:
    TIME     USER     VALUE     
    1     A     X
    2     A     X
    3     B     Y
    4     B     Y
    5     A     X
    5     B     X
    6     A     Y
    7     B     Y
    7     A     Y
    Output table:
    START_TIME     END_TIME     USER     VALUE
    1          2          A     X
    5          5          A     X
    6          7          A     Y
    3          4          B     Y
    5          5          B     X
    7          7          B     Y

    I feel sure I've over-complicated things here, and that there's an easier way of doing it, but here's one solution:
    with my_tab as (select 1 col1, 'A' col2, 'X' col3 from dual union all
                    select 2 col1, 'A' col2, 'Y' col3 from dual union all
                    select 3 col1, 'B' col2, 'Y' col3 from dual union all
                    select 4 col1, 'B' col2, 'X' col3 from dual union all
                    select 5 col1, 'A' col2, 'X' col3 from dual union all
                    select 5 col1, 'B' col2, 'X' col3 from dual union all
                    select 6 col1, 'A' col2, 'Y' col3 from dual union all
                    select 7 col1, 'B' col2, 'Y' col3 from dual union all
                    select 7 col1, 'A' col2, 'Y' col3 from dual)
    select distinct start_col1,
                    end_col1,
                    first_value(col2) over (partition by col2, start_col1, end_col1 order by col1, start_col1, end_col1) col2,
                    first_value(col3) over (partition by col2, start_col1, end_col1 order by col1, start_col1, end_col1) col3
    from   (select col1,
                   col2,
                   col3,
                   last_value(start_col1 ignore nulls) over (order by col1, col2) start_col1,
                   last_value(end_col1 ignore nulls) over (order by col1 desc, col2 desc) end_col1
            from   (select col1,
                           col2,
                           col3,
                           case when lag(col2, 1, '{NULL}') over (order by col1, col2) <> col2
                                     then col1
                           end start_col1,
                           case when lead(col2, 1, '{NULL}') over (order by col1, col2) <> col2
                                     then col1
                           end end_col1
                    from   my_tab))
    order by col2,
             start_col1,
             end_col1;
    START_COL1   END_COL1 C C
             1          2 A X
             5          5 A X
             6          7 A Y
             3          4 B Y
             5          5 B X
             7          7 B Y

  • An issue for analytical sql?

    Hi all,
    I am on the OracleXE 11gR2 and have the following requirements for the output of the select statement:
    Tables:
    GARAGE
    ======
    ID GARAGE_NAME
      1    GARAGE_1
      2    GARAGE_2
    PERSONS
    =======
    ID GARAGE_ID NAME
      1         1 NAME1_1
      2         1 NAME1_2
      3         1 NAME1_3
      4         1 NAME1_4
      5         1 NAME1_5
      6         1 NAME1_6
      7         2 NAME2_1
      8         2 NAME2_2
      9         2 NAME2_3
    10         2 NAME2_4
    CARS
    ====
    ID GARAGE_ID CAR
      1         1 CAR1_1
      2         1 CAR1_2
      3         1 CAR1_3
      4         1 CAR1_4
      5         2 CAR2_1
      6         1 CAR2_2
      7         1 CAR2_3
      8         1 CAR2_4
      9         1 CAR2_5
    10         1 CAR2_6
    The required output is:
    GARAGE_ID GARAGE_NAME CAR    PERSON
            1    GARAGE_1 CAR1_1 NAME1_1
            1    GARAGE_1 CAR1_2 NAME1_2
            1    GARAGE_1 CAR1_3 NAME1_3
            1    GARAGE_1 CAR1_4 NAME1_4
            1    GARAGE_1        NAME1_5
            1    GARAGE_1        NAME1_6
            2    GARAGE_2 CAR2_1 NAME2_1
            2    GARAGE_2 CAR2_2 NAME2_2
            2    GARAGE_2 CAR2_3 NAME2_3
            2    GARAGE_2 CAR2_4 NAME2_4
            2    GARAGE_2 CAR2_5
            2    GARAGE_2 CAR2_6 How can I achieve this output?
    Is it an issue for analytical SQL?
    Dear community, I need your help!
    Kind regards

    Looks like just an outer join..
    But how are you jining cars and persons -- based on name?
    Or Something like this?
    with c as
      select c.garage_id,c.car,g.garage_name g_name,
             row_number() over(partition by c.garage_id order by c.id) rn
      from cars c,garage g
      where c.garage_id = g.id
    p as
      select p.garage_id,p.name p_name,g.garage_name g_name,
             row_number() over(partition by p.garage_id order by p.id) rn
      from persons p,garage g
      where p.garage_id = g.id
    select nvl(p.garage_id,c.garage_id) garage_id,
           nvl(p.g_name,c.g_name) garage_name,
           car,p_name person
    from c
         full outer join p on
          (c.garage_id = p.garage_id and c.rn = p.rn);
    GARAGE_ID GARAGE_NAME CAR    PERSON
            1 GARAGE_1    CAR1_1 NAME1_1
            1 GARAGE_1    CAR1_2 NAME1_2
            1 GARAGE_1    CAR1_3 NAME1_3
            1 GARAGE_1    CAR1_4 NAME1_4
            1 GARAGE_1           NAME1_5
            1 GARAGE_1           NAME1_6
            2 GARAGE_2    CAR2_1 NAME2_1
            2 GARAGE_2    CAR2_2 NAME2_2
            2 GARAGE_2    CAR2_3 NAME2_3
            2 GARAGE_2    CAR2_4 NAME2_4
            2 GARAGE_2    CAR2_5        
            2 GARAGE_2    CAR2_6        
    12 rows selected If this is not what you want, please explain the logic to reach at your output..
    Edited by: jeneesh on Nov 17, 2012 3:15 PM

  • Which Oracle version for analytic sql?

    Can anyone tell me from which Oracle version on there exists the "analytic sql"?
    Thanks!

    Hi,
    Mark1970 wrote:
    Can anyone tell me from which Oracle version on there exists the "analytic sql"?
    Thanks!Analytic functions (that is, functions using the OVER keyword, such as
    RANK () OVER (ORDER BY hiredate)) were introduced in Oracle 8.1
    (It's no coincidence that in-line views were introduced around the same time, since so many uses of anaytic functions require sub-queries.
    In-line views were first documented in Oracle 8.1, but they worked in Oracle 8.0.)

  • Need analytical sql queries

    I want to learn about analytical sql quries...if anyone knows about analytical queries..please help me..[email protected]

    http://download.oracle.com/docs/cd/B28359_01/server.111/b28313/analysis.htm#i1007779
    http://www.orafaq.com/node/1874
    http://www.gplivna.eu/papers/using_analytic_functions_in_reports.htm

  • JDBC Oracle driver and Analytic sql support

    I get the following error when trying to issue an update using a prepared statement in JDBC.
    ORA-01006 : BIND Variable does not exist.
    The statement in question is:
    UPDATE TABLE_A SET A_COL = ? WHERE ID = (SELECT ID FROM (SELECT ID, ANO, REP_PERIOD, ROW_NUMBER() OVER ( PARTITION BY ANO ORDER BY REP_PERIOD DESC NULLS LAST) rn FROM TABLE_A WHERE rn = 1 AND ANO = '?')
    If for instance, I substitute a hard value for "ANO = ?" - for e.g. ... ANO = 'ABC' the JDBC Update statement works fine.
    Oracle ver. is 8.1.7, driver is the thin driver - both 8.1.7 and 9.0.2.0.1 tried.
    Does Oracle's JDBC driver support analytic queries?
    cheers
    Aj

    You don't want to have the quotes around the latter question mark. Right now, you're instructing the query to look for rows where ANO is the literal '?'. Remove the quotes and JDBC will recognize it as a bind variable.
    Justin

  • Urgent SQL question : how to flip vertical row values to horizontal ?

    Hello, Oracle people !
    I have an urgent SQL question : (simple for you)
    using SELECT statement, how to convert vertical row values to horizontal ?
    For example :
    (Given result-set)
    MANAGER COLUMN1 COLUMN2 COLUMN3
    K. Smith ......1
    K. Smith ...............1
    K. Smith ........................1
    (Needed result-set)
    MANAGER COLUMN1 COLUMN2 COLUMN3
    K. Smith ......1 .......1 .......1
    I know you can, just don't remeber how and can't find exactly answer I'm looking for. Probably using some analytic SQL function (CAST OVER, PARTITION BY, etc.)
    Please Help !!!
    Thanx !
    Steve.

    scott@ORA92> column vice_president format a30
    scott@ORA92> SELECT f.VICE_PRESIDENT, A.DAYS_5, B.DAYS_10, C.DAYS_20, D.DAYS_30, E.DAYS_40
      2  FROM   (select t2.*,
      3                row_number () over
      4                  (partition by vice_president
      5                   order by days_5, days_10, days_20, days_30, days_40) rn
      6            from   t2) f,
      7           (SELECT T2.*,
      8                row_number () over (partition by vice_president order by days_5) RN
      9            FROM   T2 WHERE DAYS_5 IS NOT NULL) A,
    10           (SELECT T2.*,
    11                row_number () over (partition by vice_president order by days_10) RN
    12            FROM   T2 WHERE DAYS_10 IS NOT NULL) B,
    13           (SELECT T2.*,
    14                row_number () over (partition by vice_president order by days_20) RN
    15            FROM   T2 WHERE DAYS_20 IS NOT NULL) C,
    16           (SELECT T2.*,
    17                row_number () over (partition by vice_president order by days_30) RN
    18            FROM   T2 WHERE DAYS_30 IS NOT NULL) D,
    19           (SELECT T2.*,
    20                row_number () over (partition by vice_president order by days_40) RN
    21            FROM   T2 WHERE DAYS_40 IS NOT NULL) E
    22  WHERE  f.VICE_PRESIDENT = A.VICE_PRESIDENT (+)
    23  AND    f.VICE_PRESIDENT = B.VICE_PRESIDENT (+)
    24  AND    f.VICE_PRESIDENT = C.VICE_PRESIDENT (+)
    25  AND    f.VICE_PRESIDENT = D.VICE_PRESIDENT (+)
    26  AND    f.VICE_PRESIDENT = E.VICE_PRESIDENT (+)
    27  AND    f.RN = A.RN (+)
    28  AND    f.RN = B.RN (+)
    29  AND    f.RN = C.RN (+)
    30  AND    f.RN = D.RN (+)
    31  AND    f.RN = E.RN (+)
    32  and    (a.days_5 is not null
    33            or b.days_10 is not null
    34            or c.days_20 is not null
    35            or d.days_30 is not null
    36            or e.days_40 is not null)
    37  /
    VICE_PRESIDENT                     DAYS_5    DAYS_10    DAYS_20    DAYS_30    DAYS_40
    Fedele Mark                                                          35473      35209
    Fedele Mark                                                          35479      35258
    Schultz Christine                              35700
    South John                                                                      35253
    Stack Kevin                                    35701      35604      35402      35115
    Stack Kevin                                    35705      35635      35415      35156
    Stack Kevin                                    35706      35642      35472      35295
    Stack Kevin                                    35707      35666      35477
    Stack Kevin                                               35667      35480
    Stack Kevin                                               35686
    Unknown                             35817      35698      35596      35363      35006
    Unknown                                        35702      35597      35365      35149
    Unknown                                        35724      35599      35370      35155
    Unknown                                                   35600      35413      35344
    Unknown                                                   35601      35451      35345
    Unknown                                                   35602      35467
    Unknown                                                   35603      35468
    Unknown                                                   35607      35475
    Unknown                                                   35643      35508
    Unknown                                                   35644
    Unknown                                                   35669
    Unknown                                                   35684
    Walmsley Brian                                 35725      35598
    23 rows selected.

  • Are analytic functions usefull only for data warehouses?

    Hi,
    I deal with reporting queries on Oracle databases but I don't work on Data Warehouses, thus I'd like to know if learning to use analytic functions (sql for anaylis such as rollup, cube, grouping, ...) might be usefull in helping me to develop better reports or if analytic functions are usually usefull only for data warehouses queries. I mean are rollup, cube, grouping, ... usefull also on operational database or do they make sense only on DWH?
    Thanks!

    Mark1970 wrote:
    thus does it worth learning them for improving report queries also not on DHW but on common operational databases?Why pigeonhole report queries as "+operational+" or "+data warehouse+"?
    Do you tell a user/manager that "<i>No, this report cannot be done as it looks like a data warehouse report and we have an operational database!</i>"?
    Data processing and data reporting requirements not not care what label you assign to your database.
    Simple real world example of using analytical queries on a non warehouse. We supply data to an external system via XML. They require that we limit the number of parent entities per XML file we supply. E.g. 100 customer elements (together with all their child elements) per file. Analytical SQL enables this to be done by creating "buckets" that can only contain 100 parent elements at a time. Complete process is SQL driven - no slow-by-slow row by row processing in PL/SQL using nested cursor loops and silly approaches like that.
    Analytical SQL is a tool in the developer toolbox. It would be unwise to remove it from the toolbox, thinking that it is not applicable and won't be needed for the work that's to be done.

  • Anybody can help with this SQL?

    The table is simple, only 2 columns:
    create table personpay(
    id integer primary key,
    pay number(8,2) not null);
    So the original talbe looks like this:
    ID PAY
    1 800
    2 400
    3 1200
    4 500
    5 600
    6 1900
    The requirement is to use one single query(no pl/sql) to show something lile the following, in other words, for each ID, the pay is the sum of all before itself and itself. So the query result looks like this:
    ID PAY
    1 800
    2 1200
    3 2400
    4 2900
    5 3500
    6 5400
    Again, just use one sql. No pl/sql. Anybody can help with this? I really appreciate that.
    thanks,

    Eh, people are so "analytically minded" that can't even notice a simple join?
    Counting Ordered Rows
    Let’s start with a basic counting problem. Suppose we are given a list of integers, for example:
    x
    2
    3
    4
    6
    9
    and want to enumerate all of them sequentially like this:
    x      #
    2      1
    3      2
    4      3
    6      4
    9      5
    Enumerating rows in the increasing order is the same as counting how many rows precede a given row.
    SQL enjoys success unparalleled by any rival query language. Not the last reason for such popularity might be credited to its proximity to English . Let examine the informal idea
    Enumerating rows in increasing order is counting how many rows precede a given row.
    carefully. Perhaps the most important is that we referred to the rows in the source table twice: first, to a given row, second, to a preceding row. Therefore, we need to join our number list with itself (fig 1.1).
    Cartesian Product
    Surprisingly, not many basic SQL tutorials, which are so abundant on the web today, mention Cartesian product. Cartesian product is a join operator with no join condition
    select A.*, B.* from A, B
    Figure 1.1: Cartesian product of the set A = {2,3,4,6,9} by itself. Counting all the elements x that are no greater than y produces the sequence number of y in the set A.
    Carrying over this idea into formal SQL query is straightforward. As it is our first query in this book, let’s do it step by step. The Cartesian product itself is
    select t.x x, tt.x y
    from T t, T tt
    Next, the triangle area below the main diagonal is
    select t.x x, tt.x y
    from T t, T tt
    where tt.x <= t.x
    Finally, we need only one column – t.x – which we group the previous result by and count
    select t.x, count(*) seqNum
    from T t, T tt
    where tt.x <= t.x
    group by t.x
    What if we modify the problem slightly and ask for a list of pairs where each number is coupled with its predecessor?
    x      predecessor
    2      
    3      2
    4      3
    6      4
    9      6
    Let me provide a typical mathematician’s answer, first -- it is remarkable in a certain way. Given that we already know how to number list elements successively, it might be tempted to reduce the current problem to the previous one:
    Enumerate all the numbers in the increasing order and match each sequence number seq# with predecessor seq#-1. Next!
    This attitude is, undoubtedly, the most economical way of thinking, although not necessarily producing the most efficient SQL. Therefore, let’s revisit our original approach, as illustrated on fig 1.2.
    Figure 1.2: Cartesian product of the set A = {2,3,4,6,9} by itself. The predecessor of y is the maximal number in a set of x that are less than y. There is no predecessor for y = 2.
    This translates into the following SQL query
    select t.x, max(tt.x) predecessor
    from T t, T tt
    where tt.x < t.x
    group by t.x
    Both solutions are expressed in standard SQL leveraging join and grouping with aggregation. Alternatively, instead of joining and grouping why don’t we calculate the count or max just in place as a correlated scalar subquery:
    select t.x,
    (select count(*) from T tt where tt.x <= t.x) seq#
    from T t
    group by t.x
    The subquery always returns a single value; this is why it is called scalar. The tt.x <= t.x predicate connects it to the outer query; this is why it is called correlated. Arguably, leveraging correlated scalar subqueries is one the most intuitive techniques to write SQL queries.
    How about counting rows that are not necessarily distinct? This is where our method breaks. It is challenging to distinguish duplicate rows by purely logical means, so that various less “pure” counting methods were devised. They all, however, require extending the SQL syntactically, which was the beginning of slipping along the ever increasing language complexity slope.
    Here is how analytic SQL extension counts rows
    select x, rank() over(order by x) seq# from T; -- first problem
    select x, lag() over(order by x) seq# from T; -- second problem
    Many people suggest that it’s not only more efficient, but more intuitive. The idea that “analytics rocks” can be challenged in many ways. The syntactic clarity has its cost: SQL programmer has to remember (or, at least, lookup) the list of analytic functions. The performance argument is not evident, since non-analytical queries are simpler construction from optimizer perspective. A shorter list of physical execution operators implies fewer query transformation rules, and less dramatic combinatorial explosion of the optimizer search space.
    It might even be argued that the syntax could be better. The partition by and order by clauses have similar functionality to the group by and order by clauses in the main query block. Yet one name was reused, and the other had been chosen to have a new name. Unlike other scalar expressions, which can be placed anywhere in SQL query where scalar values are accepted, the analytics clause lives in the scope of the select clause only. I have never been able to suppress an impression that analytic extension could be designed in more natural way.

  • Where to put the sql

    Hi,
    When I develop a Java software which gets data from the user (for example a Web page) and use them for performing and put the result into the database, according to you is it almost always smarter calling an Oracle stored procedure or a package making the task or can it be usefull to put the logics-sql inside the Java code? For me it's always better to develop a strored procedure to be called, but I'd like to listen to your experience.
    Thanks!

    If the Java code is to run against a variety of different database products, then it is limited to the lowest common denominator between these products - the basic SQL language.
    And unfortunately, such code will use the various database products non-optimally. SQL language implementations differ. Analytical SQL functions available in one product will be different or even non-existent in another.
    But in this case, the Java code has little choice - and need to use bare bones SQL.
    Usually this is only a problem for ISVs that are developing commercial client products. For most others, we have a single database product as the strategic product for the selected IT architecture.
    So in this case it makes sense to use and leverage all the features of that database products. Enabling the Java code to optimally use the database. Enable the database to perform and scale.
    In the case of Oracle, that typically means not having Java developers code SQL at all. Not because they are SQL/Oracle idiots (which can be argued). But because of providing a formal and abstract data interface allows far greater flexibility, maintainability and usability.
    It enables you to to deal with SQL and SQL related performance inside this interface, without having to touch and recompile a single byte of Java client code.
    It enables you to deal with database structure changes via this interface, without having to touch and recompile a single byte of Java client code.
    So it makes a LOT of sense to create and use such an interface - not just for Java clients, but all clients. Allowing all clients to share the same interface and be subject to the same validation and business rules in a coherent and consistent fashion.
    In Oracle, this interface will be written using PL/SQL packages - and will typically return ref cursors to the clients.

  • Performance comparison between using sql and pl/sql for same purpose

    Hi All,
    I have to do some huge inserts into a table from some other tables. I have 2 option:
    Option 1
    ======
    a. Declare a cusor for a query involving all source tables, this will return the data to be populated into target
    b. Use a cursor for loop to loop through all the records in the cursor
    c. for each iteration of the loop, populate target columns, do any calculations/function calls required to populate derived columns, and then insert the resulting record into target table
    Option 2
    ======
    Just write a big single "Insert Into ..... Select ..." statement, doing alll calculations/funtion calls in the select statement generating the source data.
    Now my question is ; which option is fast? and why. This operation is performace critical so I need the option which will run faster. Can anybody help???
    Thanks in Advance.

    user9314072 wrote:
    while the above comments are vaild, you should concider maintainability in you code. Even if you can write the sql it might be the code becomes complex making tuning very dificult, and derade performance.Beg to differ on that. Regardless of complexity of code, SQL is always faster than PL/SQL when dealing with SQL data. The reason for that is that PL/SQL still needs to use SQL anyway for row retrieval, and in addition it needs to copy row data from the buffer cache into the PL/SQL PGA. This is an overhead that does not exist in SQL.
    So if you are processing a 100 million rows with a complex 100 line SQL statement, versus a 100 million rows 100 line PL/SQL procedure, SQL will always be faster.
    It is a trade off, my experiance is large SQL's 100's lines long become hard to manage. You need to ask yourself why there are 100's of line of SQL. This points to an underlying problem. A flaky data model is very likely the cause. Or not using SQL correctly. Many times a 100 line SQL can be changed to a 10 liner by introducing different logic that solves the exact same problem easier and faster (e.g. using analytical SQL, thinking "+out-of-the-box+").
    Also, 100's of line of SQL points to a performance issue always. And it does not matter where you move this code logic to PL/SQL or Java or elsewhere, the performance problem will remain. Moving the problem from SQL to PL/SQL or Java does not reduce the number of rows to process, or make a significant change in the number of CPU instructions to be executed. And there's the above overhead mentioned - pulling SQL data into a client memory segment for processing (an overhead that does not exist using SQL).
    So how do you address this then? Assuming the data model is correct, then there are 2 primary methods to address the 100's of SQL lines and its associated performance problem.
    Modularise the SQL. Make the 100's of lines easier to maintain and understand. This can be done using VIEWS and the SQL WITH clause.
    As for the associated performance issue - materialised views comes to mind as an excellent method to address this type of problem.
    my advice is keep things simple, because soon or later you will need to change the code.I'm all for that - but introducing more moving parts like PL/SQL or Java and ref cursors and bulk fetching and so on.. how does that reduce complexity?
    SQL is the first and best place to solve row crunching problems. Do not be fooled into thinking that you can achieve that same performance using PL/SQL or Java.

  • Need sequence on resultset without using ROWNUM

    I need to query some data from a SQLServer 2000 database (which don't
    have analytic SQl capibilities) and load it into Oracle 10g Warehouse. It must be
    done in a query, SQLServer don't do cursor very well. So I need a ANSI standard Query.
    I need a way of putting a sequential number on a result set. SQLServer does not have ROWNUM.
    I need a slick equivalent of: select rownum, value1, value2 from <some table>
    Can't use ROWNUM

    Only for MS SQL Server:
    set nocount on
    if exists (select * from sysobjects where type = 'U' and  name = 'test')
    begin
         drop table test
    end
    /* Create TEST table */
    create table test
         id_test int identity not null,
         string char (7),
         constraint pk_test primary key (id_test)
    set identity_insert test on
    insert into test (id_test, string)
    values (1,'string1')
    insert into test (id_test, string)
    values (4,'string2')
    insert into test (id_test, string)
    values (12,'string3')
    insert into test (id_test, string)
    values (17,'string4')
    insert into test (id_test, string)
    values (29,'string5')
    insert into test (id_test, string)
    values (31,'string6')
    insert into test (id_test, string)
    values (42,'string7')
    insert into test (id_test, string)
    values (45,'string8')
    insert into test (id_test, string)
    values (61,'string9')
    set identity_insert test off
    go
    /* Solution #1, Create VIEW */
    if exists (select * from sysobjects where type = 'V' and name = 'ranked_table')
    begin
         drop view ranked_table
    end
    go
    create view ranked_table (rank, id_test, sting)
    as
         select (
                   select count(*)
                   from test as test_2
                   where test_2.id_test <= test_1.id_test
              ) as rank,
              test_1.id_test,
              test_1.string
         from test as test_1
    go
    select *
    from ranked_table
    order by rank
    go
    /* Solution #2 STANDART ANSI-SQL (SELF-JOIN + GROUP BY)*/
    select count (test_2.id_test) as rank, test_1.id_test, test_1.string
    from test as test_1 inner join test as test_2 on
         test_1.id_test >= test_2.id_test
    group by test_1.id_test, test_1.string
    order by rank
    go
    /* Solution #3 STANDART ANSI-SQL (SCALAR SUBQUERY IN SELECT-clause)*/
    select test_3.rank, test_3.id_test, test_3.string
    from (select test_1.id_test,
              test_1.string,
              (select count(*)
                   from test as test_2
                   where test_2.id_test <= test_1.id_test
              ) as rank
         from test as test_1) as test_3
    order by rank
    go
    /* Solution #4, TEMPORARY TABLE WITH IDENTITY-FIELD */
    create table #rank_table
         rank int identity not null,
         id_test int null,
         string char (7),
         constraint pk_test primary key (rank)
    go
    insert into #rank_table (id_test, string)
    select id_test, string
    from test
    order by id_test
    select * from #rank_table
    go
    /* Solution #5, TABLE-TYPE VARIABLE WITH IDENTITY */
    declare @rank_table table
         rank int identity not null,
         id_test int null,
         string char (7)
    insert into @rank_table (id_test, string)
    select id_test, string
    from test
    order by id_test
    select * from @rank_table
    go
    /* Solution #6, CURSOR */
    declare @rank int,
         @id_test int,
         @string char (7)
    declare rank_cursor cursor
    for select id_test, string
         from test
         order by id_test
    open rank_cursor
    fetch next from rank_cursor into @id_test, @string
    set @rank = 1
    while (@@fetch_status <> -1)
    begin
         select @rank, @id_test, @string
         set @rank = @rank + 1
         fetch next from rank_cursor into @id_test, @string
    end
    close rank_cursor
    deallocate rank_cursor

  • How can i get first four highest values from a table

    suppose we have salary table and we need first 4 highest salaries in one query or attemp

    Or use an analytic:
    SQL> select ename, sal from emp;
    ENAME                       SAL
    SMITH                       800
    ALLEN                      1600
    WARD                       1250
    JONES                      2975
    MARTIN                     1250
    BLAKE                      2850
    CLARK                      2450
    SCOTT                      3000
    KING                       5000
    TURNER                     1500
    ADAMS                      1100
    JAMES                       950
    FORD                       3000
    MILLER                     1300
    14 rows selected.
    SQL> select ename, sal
      2  from
      3  (
      4     select ename
      5           ,sal
      6           ,dense_rank() over (order by sal desc) dr
      7     from   emp
      8  )
      9  where dr <= 4;
    ENAME                       SAL
    KING                       5000
    SCOTT                      3000
    FORD                       3000
    JONES                      2975
    BLAKE                      2850

  • Help in understanding TKPROF output

    Hi All,
    Following is the TKPROF output of a user_dump_dest trace file, obtained by setting trace to 10046@level 12.
    select "CHNNL"."CHNNL_BK" "C0", case "GEOG12"."SUB_STATE_PRVNC_CD" when
    *:"SYS_B_000" then :"SYS_B_001" when :"SYS_B_002" then :"SYS_B_003" when*
    *:"SYS_B_004" then :"SYS_B_005" when :"SYS_B_006" then :"SYS_B_007" when*
    *:"SYS_B_008" then :"SYS_B_009" when :"SYS_B_010" then :"SYS_B_011" when*
    *:"SYS_B_012" then :"SYS_B_013" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *"C1", "TIME_PERIOD13"."MONTH_CD" "C2", lpad(to_char(EXTRACT( MONTH*
    FROM
    *(TIMESTAMP :"SYS_B_014") )), :"SYS_B_015", :"SYS_B_016") "C3", sum(case*
    when "TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_017" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_018" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_019"
    then :"SYS_B_020" when :"SYS_B_021" then :"SYS_B_022" when :"SYS_B_023"
    then :"SYS_B_024" when :"SYS_B_025" then :"SYS_B_026" when :"SYS_B_027"
    then :"SYS_B_028" when :"SYS_B_029" then :"SYS_B_030" when :"SYS_B_031"
    then :"SYS_B_032" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C4", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_033" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_034" ), :"SYS_B_035" )
    + INTERVAL :"SYS_B_036" DAY) and TIMESTAMP :"SYS_B_037" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_038" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_039"
    then :"SYS_B_040" when :"SYS_B_041" then :"SYS_B_042" when :"SYS_B_043"
    then :"SYS_B_044" when :"SYS_B_045" then :"SYS_B_046" when :"SYS_B_047"
    then :"SYS_B_048" when :"SYS_B_049" then :"SYS_B_050" when :"SYS_B_051"
    then :"SYS_B_052" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C5", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_053" then*
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_054" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_055"*
    then :"SYS_B_056" when :"SYS_B_057" then :"SYS_B_058" when :"SYS_B_059"
    then :"SYS_B_060" when :"SYS_B_061" then :"SYS_B_062" when :"SYS_B_063"
    then :"SYS_B_064" when :"SYS_B_065" then :"SYS_B_066" when :"SYS_B_067"
    then :"SYS_B_068" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C6", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_069" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_070" ), :"SYS_B_071" )
    + INTERVAL :"SYS_B_072" DAY) and TIMESTAMP :"SYS_B_073" then
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_074" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_075"*
    then :"SYS_B_076" when :"SYS_B_077" then :"SYS_B_078" when :"SYS_B_079"
    then :"SYS_B_080" when :"SYS_B_081" then :"SYS_B_082" when :"SYS_B_083"
    then :"SYS_B_084" when :"SYS_B_085" then :"SYS_B_086" when :"SYS_B_087"
    then :"SYS_B_088" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C7", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_089" then*
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_090" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_091"*
    then :"SYS_B_092" when :"SYS_B_093" then :"SYS_B_094" when :"SYS_B_095"
    then :"SYS_B_096" when :"SYS_B_097" then :"SYS_B_098" when :"SYS_B_099"
    then :"SYS_B_100" when :"SYS_B_101" then :"SYS_B_102" when :"SYS_B_103"
    then :"SYS_B_104" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C8", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_105" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_106" ), :"SYS_B_107" )
    + INTERVAL :"SYS_B_108" DAY) and TIMESTAMP :"SYS_B_109" then
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_110" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_111"*
    then :"SYS_B_112" when :"SYS_B_113" then :"SYS_B_114" when :"SYS_B_115"
    then :"SYS_B_116" when :"SYS_B_117" then :"SYS_B_118" when :"SYS_B_119"
    then :"SYS_B_120" when :"SYS_B_121" then :"SYS_B_122" when :"SYS_B_123"
    then :"SYS_B_124" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C9", sum("SALES_FACT"."EXTND_GROSS_SALE_AMNT")*
    over (partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD"
    when :"SYS_B_125" then :"SYS_B_126" when :"SYS_B_127" then :"SYS_B_128"
    when :"SYS_B_129" then :"SYS_B_130" when :"SYS_B_131" then :"SYS_B_132"
    when :"SYS_B_133" then :"SYS_B_134" when :"SYS_B_135" then :"SYS_B_136"
    when :"SYS_B_137" then :"SYS_B_138" else
    *"GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end , "TIME_PERIOD13"."MONTH_CD") "C10",*
    *((sum(case when ("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_139")*
    then "SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_140" end ) over
    *(partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when*
    *:"SYS_B_141" then :"SYS_B_142" when :"SYS_B_143" then :"SYS_B_144" when*
    *:"SYS_B_145" then :"SYS_B_146" when :"SYS_B_147" then :"SYS_B_148" when*
    *:"SYS_B_149" then :"SYS_B_150" when :"SYS_B_151" then :"SYS_B_152" when*
    *:"SYS_B_153" then :"SYS_B_154" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *, "TIME_PERIOD13"."MONTH_CD")+sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_155" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_156" ), :"SYS_B_157" )
    + INTERVAL :"SYS_B_158" DAY) and TIMESTAMP :"SYS_B_159" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_160" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_161"
    then :"SYS_B_162" when :"SYS_B_163" then :"SYS_B_164" when :"SYS_B_165"
    then :"SYS_B_166" when :"SYS_B_167" then :"SYS_B_168" when :"SYS_B_169"
    then :"SYS_B_170" when :"SYS_B_171" then :"SYS_B_172" when :"SYS_B_173"
    then :"SYS_B_174" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD"))+(sum(case when*
    *("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_175") then*
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_176" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_177"*
    then :"SYS_B_178" when :"SYS_B_179" then :"SYS_B_180" when :"SYS_B_181"
    then :"SYS_B_182" when :"SYS_B_183" then :"SYS_B_184" when :"SYS_B_185"
    then :"SYS_B_186" when :"SYS_B_187" then :"SYS_B_188" when :"SYS_B_189"
    then :"SYS_B_190" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD")+sum(case when "TIME_PERIOD13"."DAY_CLNDR_DATE"*
    between (TIMESTAMP :"SYS_B_191" - NUMTODSINTERVAL( EXTRACT( DAY FROM
    TIMESTAMP :"SYS_B_192" ), :"SYS_B_193" ) + INTERVAL :"SYS_B_194" DAY) and
    TIMESTAMP :"SYS_B_195" then "SALES_FACT"."QTY_SOLD_IN_CASES" else
    *:"SYS_B_196" end ) over (partition by "CHNNL"."CHNNL_BK", case*
    *"GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_197" then :"SYS_B_198" when*
    *:"SYS_B_199" then :"SYS_B_200" when :"SYS_B_201" then :"SYS_B_202" when*
    *:"SYS_B_203" then :"SYS_B_204" when :"SYS_B_205" then :"SYS_B_206" when*
    *:"SYS_B_207" then :"SYS_B_208" when :"SYS_B_209" then :"SYS_B_210" else*
    *"GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end , "TIME_PERIOD13"."MONTH_CD")))*
    +(sum(case  when ("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_211")
    then "SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_212" end ) over
    *(partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when*
    *:"SYS_B_213" then :"SYS_B_214" when :"SYS_B_215" then :"SYS_B_216" when*
    *:"SYS_B_217" then :"SYS_B_218" when :"SYS_B_219" then :"SYS_B_220" when*
    *:"SYS_B_221" then :"SYS_B_222" when :"SYS_B_223" then :"SYS_B_224" when*
    *:"SYS_B_225" then :"SYS_B_226" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *, "TIME_PERIOD13"."MONTH_CD")+sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_227" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_228" ), :"SYS_B_229" )
    + INTERVAL :"SYS_B_230" DAY) and TIMESTAMP :"SYS_B_231" then
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_232" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_233"*
    then :"SYS_B_234" when :"SYS_B_235" then :"SYS_B_236" when :"SYS_B_237"
    then :"SYS_B_238" when :"SYS_B_239" then :"SYS_B_240" when :"SYS_B_241"
    then :"SYS_B_242" when :"SYS_B_243" then :"SYS_B_244" when :"SYS_B_245"
    then :"SYS_B_246" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD")) "C11" from "THA_SALES_DBA"."CHNNL" "CHNNL",*
    *(select "GEOG"."GEOG_KEY" "GEOG_KEY", "GEOG"."SUB_STATE_PRVNC_CD"*
    *"SUB_STATE_PRVNC_CD", "GEOG"."SUB_STATE_PRVNC_NAME_TXT"*
    *"SUB_STATE_PRVNC_NAME_TXT" from "THA_SALES_DBA"."GEOG" "GEOG" where*
    *"GEOG"."SUB_STATE_PRVNC_LOAD_DATA_TYPE"=:"SYS_B_247") "GEOG12",*
    *"THA_SALES_DBA"."TIME_PERIOD" "TIME_PERIOD13", "THA_SALES_DBA"."SALES_FACT"*
    *"SALES_FACT", (select "PROD"."PROD_KEY" "PROD_KEY", "PROD"."PROD_DVSN_CD"*
    *"PROD_DVSN_CD", "PROD"."PCKG_SIZE_CD" "PCKG_SIZE_CD" from*
    *"THA_SALES_DBA"."PROD" "PROD" where "PROD"."LOAD_DATA_TYPE_CD"=:"SYS_B_248")*
    *"PROD14", "THA_SALES_DBA"."DSTRBTR" "DSTRBTR" where*
    *"PROD14"."PROD_DVSN_CD"=:"SYS_B_249" and "PROD14"."PCKG_SIZE_CD"=*
    *:"SYS_B_250" and "DSTRBTR"."DSTRBTR_CD"<>:"SYS_B_251" and CASE*
    WHEN("DSTRBTR"."DSTRBTR_CD" IS NULL) OR ("CHNNL"."CHNNL_BK" IS NULL) THEN
    NULL ELSE ("DSTRBTR"."DSTRBTR_CD"||"CHNNL"."CHNNL_BK") END<>:"SYS_B_252"
    and "SALES_FACT"."CHNNL_KEY"="CHNNL"."CHNNL_KEY" and
    *"SALES_FACT"."DSTRBTR_KEY"="DSTRBTR"."DSTRBTR_KEY" and*
    *"SALES_FACT"."GEOG_KEY"="GEOG12"."GEOG_KEY" and "SALES_FACT"."PROD_KEY"=*
    *"PROD14"."PROD_KEY" and "SALES_FACT"."TIME_PERIOD_KEY"=*
    *"TIME_PERIOD13"."TIME_PERIOD_KEY"*
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.01       0.01          0          0          0           0
    Fetch     7632    129.92     245.70     406278      12619         35      763042
    total     7634    129.95     245.73     406278      12619         35      763042
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 68
    Rows     Row Source Operation
    *763042 WINDOW BUFFER (cr=12619 pr=406278 pw=257613 time=239232878 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=372409 pw=237458 time=217248824 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=339595 pw=217662 time=194593662 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=307255 pw=198149 time=177438908 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=275292 pw=178940 time=157976971 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=244097 pw=160017 time=139997871 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=213275 pw=141404 time=119675383 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=184170 pw=123525 time=105714100 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=155800 pw=105953 time=88478655 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=128025 pw=88650 time=71243641 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=100871 pw=71641 time=54047210 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=73821 pw=54957 time=35324144 us)*
    *763042 WINDOW SORT (cr=12619 pr=48205 pw=38587 time=18865032 us)*
    *763042 HASH JOIN (cr=12619 pr=0 pw=0 time=3127703 us)*
    *15098 TABLE ACCESS FULL TIME_PERIOD (cr=693 pr=0 pw=0 time=15216 us)*
    *763042 HASH JOIN (cr=11926 pr=0 pw=0 time=2344335 us)*
    *1845 TABLE ACCESS FULL GEOG (cr=92 pr=0 pw=0 time=1910 us)*
    *763194 HASH JOIN (cr=11834 pr=0 pw=0 time=1577327 us)*
    *11 TABLE ACCESS FULL CHNNL (cr=7 pr=0 pw=0 time=47 us)*
    *765432 HASH JOIN (cr=11827 pr=0 pw=0 time=1580849 us)*
    *2 TABLE ACCESS FULL DSTRBTR (cr=7 pr=0 pw=0 time=50 us)*
    *765432 HASH JOIN (cr=11820 pr=0 pw=0 time=814835 us)*
    *313 TABLE ACCESS FULL PROD (cr=174 pr=0 pw=0 time=1195 us)*
    *1045260 TABLE ACCESS FULL SALES_FACT (cr=11646 pr=0 pw=0 time=31 us)*
    Elapsed times include waiting on following events:
    Event waited on                             Times   Max. Wait  Total Waited
    ----------------------------------------   Waited  ----------  ------------
    SQLNet message to client 7633 0.00 0.01*
    SQLNet message from client 7633 1826.57 2334.17*
    SQLNet more data from client 1 0.00 0.00*
    direct path write temp                       5332        0.09          6.23
    direct path read temp                      389239        0.09        115.09
    The query is automatically generated by Cognos 8.2. The database is 64-bit Oracle 10.2.0.4 on Windows 2003 Enterprise Edition R2.
    I am unable to understand the "*WINDOW BUFFER/WINDOW SORT*" statement under the Row Source Operation. Could one of you please explain this operation to me?
    Thanks and Regards,
    Sriraman

    The WINDOW BUFFER/WINDOW SORT operations are used when processing analytical SQLs, you can see these in your SQL statement. In WINDOW BUFFER the SQL engine do calculations above some buffered data subset and in the WINDOW SORT data subsets are being sorted.
    Dusan

  • Query of Query(cursor)

    Hi all,
    I want to implement something like "query of queries" in Oracle with the help of CURSORS.
    Is it possible to use a cursor in the from clause of a query?
    Please help me....
    Thanking u all in advance...
    Regards,
    Aswathy.

    > But can i know if this can be done with CURSORS.
    A cursor is not a data set or result set - it is not a copy of rows (or row identifiers) in memory.
    A cursor is (SQL) program parsed & compiled into an execution plan. This contains the instructions to fetch the applicable rows.
    A FETCH from a cursor is an instruction to Oracle to execute that SQL program to return the next rows (or rows in the case of a bulk fetch).
    It seems to me that you are thinking of row-by-row processing - which is why you want a query of a query and use a cursor for that.
    Row-by-row processing is also aptly named slow-by-slow processing.
    The correct approach is to think data sets. And write queries to deal with data sets. And yes, you can create a data set using SQL and re-use it with the WITH syntax.
    For example (and a very poor example as analytical SQL should be used instead, but the intention is simply to show you how the WITH syntax works):
    with MY_DATA_SET as(
    select
    col1,
    col2,
    col3
    from table1
    where <some conditions & filters>
    select
    'MAX C1' as NAME,
    max(col1)
    from my_data_set
    union all
    select
    'MAX C2' as NAME,
    max(col2)
    from my_data_set
    union all
    select
    'C1=C2' as NAME,
    count(*)
    from my_data_set
    where c1 = c2
    <etc>
    You can create multiple "data sets" like this and join them, further refine them, etc. Just remember to aim to write minimal SQL code... the less code there is, the less complexity, the less work to do (usually) and the better the likelihood of good performance and scalability.

Maybe you are looking for

  • Hook up home ste

    I will try to give as much info as possible,I have a sound blaster li've xgamer card which has fi've jacks in the rear including the digital outI am going to a reciever which is somewhat new but does not have digital in. Therefore I need to hookup wi

  • Version 1 or 2?

    I have a WRT55AG router and want to do a firmware upgrade but I don't know if it is versoin 1 or 2. How can I tell?

  • Has anyone created a complex navigation in Encore??

    I am authoring a DVD instructional video program and was hoping to be able to create an option for viewers to pick and choose whatever poses they wanted to practice from a menu and have their selection play back all at once. I can't seem to find any

  • Restart of RV042 Router

    Can anyone answer this for me please?  Would I lose my router settings if I were to restart the RV042 router from the System Management>Restart section of the router UI? The "restart" command is just like a warm reset, correct??? Thanks, Max

  • Help! 'Package for Print' Script

    Hi all, I have a specific 'Package For Print' script, that needs a small modification, and and I was hoping someone could help me. Essentially, I need to OMIT 'Include PDF' option when packaging, since this makes things a bit wonky on my script (see