How to print Requiered Rows in the middle of the table?












0














Table Input:



NAME    ID  COURSE YEAR
arun 1 mca 1
anil 2 mca 1
sudheer 3 mca 2
santosh 4 mca 2
arun 1 cse 1
sunil 2 cse 1
raj 3 cse 1
naveen 4 cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1
anil 4 mech 2
rani 5 mech 2
anvith 6 mech 2
madhu 7 mech 2
arun 1 it 3
sunil 2 it 3
raj 3 it 3
naveen 4 it 3
venki 5 it 4
prasad 6 it 4
sudha 7 it 4
ravi 1 ece 3
raju 2 ece 3
roja 3 ece 3
anil 4 ece 4
rani 5 ece 4
anvith 6 ece 4
madhu 7 ece 4


I need to print middle rows like below example



naveen  4   cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1









share|improve this question
























  • Which RDBMS are you using. Dont spam tag various RDBMS.
    – Madhur Bhaiya
    Nov 20 at 7:23






  • 1




    There is no such thing as "the middle of the table". Rows in relational database are not sorted. The only way to identify the "middle" is to specify an order by statement.
    – a_horse_with_no_name
    Nov 20 at 7:30










  • Is there any particular condition that you need to satisfy to get 'middle of the table' ?
    – Namandeep_Kaur
    Nov 20 at 7:36
















0














Table Input:



NAME    ID  COURSE YEAR
arun 1 mca 1
anil 2 mca 1
sudheer 3 mca 2
santosh 4 mca 2
arun 1 cse 1
sunil 2 cse 1
raj 3 cse 1
naveen 4 cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1
anil 4 mech 2
rani 5 mech 2
anvith 6 mech 2
madhu 7 mech 2
arun 1 it 3
sunil 2 it 3
raj 3 it 3
naveen 4 it 3
venki 5 it 4
prasad 6 it 4
sudha 7 it 4
ravi 1 ece 3
raju 2 ece 3
roja 3 ece 3
anil 4 ece 4
rani 5 ece 4
anvith 6 ece 4
madhu 7 ece 4


I need to print middle rows like below example



naveen  4   cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1









share|improve this question
























  • Which RDBMS are you using. Dont spam tag various RDBMS.
    – Madhur Bhaiya
    Nov 20 at 7:23






  • 1




    There is no such thing as "the middle of the table". Rows in relational database are not sorted. The only way to identify the "middle" is to specify an order by statement.
    – a_horse_with_no_name
    Nov 20 at 7:30










  • Is there any particular condition that you need to satisfy to get 'middle of the table' ?
    – Namandeep_Kaur
    Nov 20 at 7:36














0












0








0







Table Input:



NAME    ID  COURSE YEAR
arun 1 mca 1
anil 2 mca 1
sudheer 3 mca 2
santosh 4 mca 2
arun 1 cse 1
sunil 2 cse 1
raj 3 cse 1
naveen 4 cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1
anil 4 mech 2
rani 5 mech 2
anvith 6 mech 2
madhu 7 mech 2
arun 1 it 3
sunil 2 it 3
raj 3 it 3
naveen 4 it 3
venki 5 it 4
prasad 6 it 4
sudha 7 it 4
ravi 1 ece 3
raju 2 ece 3
roja 3 ece 3
anil 4 ece 4
rani 5 ece 4
anvith 6 ece 4
madhu 7 ece 4


I need to print middle rows like below example



naveen  4   cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1









share|improve this question















Table Input:



NAME    ID  COURSE YEAR
arun 1 mca 1
anil 2 mca 1
sudheer 3 mca 2
santosh 4 mca 2
arun 1 cse 1
sunil 2 cse 1
raj 3 cse 1
naveen 4 cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1
anil 4 mech 2
rani 5 mech 2
anvith 6 mech 2
madhu 7 mech 2
arun 1 it 3
sunil 2 it 3
raj 3 it 3
naveen 4 it 3
venki 5 it 4
prasad 6 it 4
sudha 7 it 4
ravi 1 ece 3
raju 2 ece 3
roja 3 ece 3
anil 4 ece 4
rani 5 ece 4
anvith 6 ece 4
madhu 7 ece 4


I need to print middle rows like below example



naveen  4   cse 1
venki 5 cse 2
prasad 6 cse 2
sudha 7 cse 2
ravi 1 mech 1
raju 2 mech 1
roja 3 mech 1






sql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 at 7:29









a_horse_with_no_name

291k46444537




291k46444537










asked Nov 20 at 7:20









Nagendra Prasad

31




31












  • Which RDBMS are you using. Dont spam tag various RDBMS.
    – Madhur Bhaiya
    Nov 20 at 7:23






  • 1




    There is no such thing as "the middle of the table". Rows in relational database are not sorted. The only way to identify the "middle" is to specify an order by statement.
    – a_horse_with_no_name
    Nov 20 at 7:30










  • Is there any particular condition that you need to satisfy to get 'middle of the table' ?
    – Namandeep_Kaur
    Nov 20 at 7:36


















  • Which RDBMS are you using. Dont spam tag various RDBMS.
    – Madhur Bhaiya
    Nov 20 at 7:23






  • 1




    There is no such thing as "the middle of the table". Rows in relational database are not sorted. The only way to identify the "middle" is to specify an order by statement.
    – a_horse_with_no_name
    Nov 20 at 7:30










  • Is there any particular condition that you need to satisfy to get 'middle of the table' ?
    – Namandeep_Kaur
    Nov 20 at 7:36
















Which RDBMS are you using. Dont spam tag various RDBMS.
– Madhur Bhaiya
Nov 20 at 7:23




Which RDBMS are you using. Dont spam tag various RDBMS.
– Madhur Bhaiya
Nov 20 at 7:23




1




1




There is no such thing as "the middle of the table". Rows in relational database are not sorted. The only way to identify the "middle" is to specify an order by statement.
– a_horse_with_no_name
Nov 20 at 7:30




There is no such thing as "the middle of the table". Rows in relational database are not sorted. The only way to identify the "middle" is to specify an order by statement.
– a_horse_with_no_name
Nov 20 at 7:30












Is there any particular condition that you need to satisfy to get 'middle of the table' ?
– Namandeep_Kaur
Nov 20 at 7:36




Is there any particular condition that you need to satisfy to get 'middle of the table' ?
– Namandeep_Kaur
Nov 20 at 7:36












2 Answers
2






active

oldest

votes


















0














Select * from Your_table Where rownum between START and END;


Change START and END with the row numbers you want as output.






share|improve this answer





























    0














    Considering it is MySQL :



    SELECT * FROM table_name LIMIT start,end;


    Replace start, end with the starting number and ending number.






    share|improve this answer























    • Not working bro
      – Nagendra Prasad
      Nov 20 at 7:31










    • Can you share the query?
      – Gaurav Neema
      Nov 20 at 7:32











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388054%2fhow-to-print-requiered-rows-in-the-middle-of-the-table%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Select * from Your_table Where rownum between START and END;


    Change START and END with the row numbers you want as output.






    share|improve this answer


























      0














      Select * from Your_table Where rownum between START and END;


      Change START and END with the row numbers you want as output.






      share|improve this answer
























        0












        0








        0






        Select * from Your_table Where rownum between START and END;


        Change START and END with the row numbers you want as output.






        share|improve this answer












        Select * from Your_table Where rownum between START and END;


        Change START and END with the row numbers you want as output.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 7:33









        Bhelasagar Meher

        235




        235

























            0














            Considering it is MySQL :



            SELECT * FROM table_name LIMIT start,end;


            Replace start, end with the starting number and ending number.






            share|improve this answer























            • Not working bro
              – Nagendra Prasad
              Nov 20 at 7:31










            • Can you share the query?
              – Gaurav Neema
              Nov 20 at 7:32
















            0














            Considering it is MySQL :



            SELECT * FROM table_name LIMIT start,end;


            Replace start, end with the starting number and ending number.






            share|improve this answer























            • Not working bro
              – Nagendra Prasad
              Nov 20 at 7:31










            • Can you share the query?
              – Gaurav Neema
              Nov 20 at 7:32














            0












            0








            0






            Considering it is MySQL :



            SELECT * FROM table_name LIMIT start,end;


            Replace start, end with the starting number and ending number.






            share|improve this answer














            Considering it is MySQL :



            SELECT * FROM table_name LIMIT start,end;


            Replace start, end with the starting number and ending number.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 20 at 7:28









            fa06

            10.4k1917




            10.4k1917










            answered Nov 20 at 7:26









            Gaurav Neema

            927




            927












            • Not working bro
              – Nagendra Prasad
              Nov 20 at 7:31










            • Can you share the query?
              – Gaurav Neema
              Nov 20 at 7:32


















            • Not working bro
              – Nagendra Prasad
              Nov 20 at 7:31










            • Can you share the query?
              – Gaurav Neema
              Nov 20 at 7:32
















            Not working bro
            – Nagendra Prasad
            Nov 20 at 7:31




            Not working bro
            – Nagendra Prasad
            Nov 20 at 7:31












            Can you share the query?
            – Gaurav Neema
            Nov 20 at 7:32




            Can you share the query?
            – Gaurav Neema
            Nov 20 at 7:32


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388054%2fhow-to-print-requiered-rows-in-the-middle-of-the-table%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Create new schema in PostgreSQL using DBeaver

            Deepest pit of an array with Javascript: test on Codility

            Costa Masnaga