Submitted Questions

  • Memory Management

    How do you free the memory which is occupied by a process but did not free due to a memory leakage in a UNIX box? I know /proc/sys/vm/drop_caches will remove the memory out that command does not work in our UNIX box so I want a command or steps to find the memory and release them. I can use ipcrm command to remove the shared memory segment or the memory but I need to make sure that the one I am trying...

  • How to retrieve the 2nd record from a table ?

    How to retrieve the 2nd record from a table which has say 1000 records in it. Please answer this without using the row-id? I tried to say a query "select * from table where rowcount=1" which worked well and also "select * from table where rowcount=3" which gave me the result but not when I did the same query "select * from table where rowcount=2" ? why?

    rima

    • Nov 24th, 2011

    Code
    1. SELECT * FROM `table_name` WHERE rownum <> 1 ORDER BY rownum  ASC LIMIT 1;

    smonroy

    • Sep 27th, 2011

    The best way to issue is

    select top 1 * from cars where id_car in
    (select top 2 id_car from cars order by id_car)
    order by id_car DESC

    and with that
    obtain the second record (This way is for the PK)

  • Sorting algorithms

    Which is the best sorting algorithm and why? I know again that it depends on the implementation but how do you select that a particular one is the best one to implement. In other words what are the factors for selecting a sorting algorithm?