Loading ...
Sorry, an error occurred while loading the content.

Re: [SQLQueriesNoCode] pls help

Expand Messages
  • Noman Aftab
    ... correction SELECT MIN(Salary) FROM information WHERE salary IN (SELECT TOP 3 salary FROM information order by salary desc) alse need to apply distinct in
    Message 1 of 14 , Nov 9, 2007
    • 0 Attachment
      > SELECT MIN(Salary)
      > FROM information
      > WHERE salary IN
      > (SELECT TOP 3 salary FROM information)

      correction

      SELECT MIN(Salary)
      FROM information
      WHERE salary IN
      (SELECT TOP 3 salary FROM information order by salary desc)

      alse need to apply distinct in the sub-query, as there may be more that one record for the same salary (value)

      Noman Muhammad Aftab
      Software Engineer
      Avanza Solutions
      Tel:+92 21 567 5240 – 42 (ext: 762)
      Fax:+92 21 567 5244
      URL: http://www.avanzasolutions.com
      Email: noman.aftab@...



      ----- Original Message ----
      From: John Warner <john@...>
      To: SQLQueriesNoCode@yahoogroups.com
      Sent: Friday, 9 November, 2007 5:23:26 AM
      Subject: RE: [SQLQueriesNoCode] pls help

      > Pls help me to find out the maximum number in a sql database.

      What number? Salary or a count of all the rows in the table?

      > With this mail i'm attaching a sql file.

      Attachments (thankfully) are stripped from postings before being
      distributed. So your file never arrived.

      > Pls help me to find out the maximum salary
      > salary in it.

      SELECT MAX(salary)
      FROM information

      > and the 3rd maximum

      SELECT MIN(Salary)
      FROM information
      WHERE salary IN
      (SELECT TOP 3 salary FROM information)

      And that completes tonight's homework assignment. You should really give
      thought to popping that Relational Database textbook open and give it a
      read, Data Manipulation is only part of the job of learning SQL.

      John Warner

      > -----Original Message-----
      > From: SQLQueriesNoCode@ yahoogroups. com
      > [mailto:SQLQueriesNoCode@ yahoogroups. com] On Behalf Of zayed **
      > Sent: Thursday, November 08, 2007 1:49 PM
      > To: SQLQueriesNoCode@ yahoogroups. com
      > Subject: [SQLQueriesNoCode] pls help
      >
      > Hellogroup,
      > Pls help me to find out the maximum number in a sql database.
      > With this mail i'm attaching a sql file.
      > Pls help me to find out the maximum salary and the 3rd maximum
      > salary in it.
      > pls give me the sql code to find it out.
      > Pls help me .
      > I'm very new in coding.
      >
      > ____________ _________ _________ _________ _________ __
      > Do You Yahoo!?
      > Tired of spam? Yahoo! Mail has the best spam protection around
      > http://mail. yahoo.com
      > ----------
      >
      > -- phpMyAdmin SQL Dump
      > -- version 2.8.0.3
      > -- http://www.phpmyadm in.net
      > --
      > -- Host: localhost
      > -- Generation Time: Nov 05, 2007 at 03:49 PM
      > -- Server version: 5.0.21
      > -- PHP Version: 5.1.4
      > --
      > -- Database: `employee`
      > --
      >
      > -- ------------ --------- --------- --------- --------- --------
      >
      > --
      > -- Table structure for table `information`
      > --
      >
      > CREATE TABLE `information` (
      > `id` int(2) default NULL,
      > `name` varchar(20) default NULL,
      > `salary` int(5) default NULL
      > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
      >
      > --
      > -- Dumping data for table `information`
      > --
      >
      > INSERT INTO `information` VALUES (1, 'Mahboob', 25000);
      > INSERT INTO `information` VALUES (2, 'Zayed', 1500);
      > INSERT INTO `information` VALUES (3, 'gorki', 6500);
      > INSERT INTO `information` VALUES (4, 'rifat', 5000);
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >





      ___________________________________________________________
      Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html

      [Non-text portions of this message have been removed]
    • zayed_ctn
      ... Hello sir ur state ment cant get me to the 3rd MAXIMUM NUMBER. It only shows the row 3.
      Message 2 of 14 , Nov 9, 2007
      • 0 Attachment
        --- In SQLQueriesNoCode@yahoogroups.com, Carmen Popescu
        <carmen_cngl@...> wrote:
        >
        > I'm not very sure if this is working with SQL server, but in Oracle
        you can use something like this:
        > select * from
        > ( select * from information order by salary)
        > where rownum=3
        >
        > This is for returning the 3rd value of the salary.
        >


        Hello sir ur state ment cant get me to the 3rd MAXIMUM NUMBER.
        It only shows the row 3.
      • zayed **
        Hello sir, I couldn t find out the 3rd maximum number with ur code. Could u pls tell me to find out the TOP 3 salaries? ur code was- SELECT MIN(Salary) FROM
        Message 3 of 14 , Nov 9, 2007
        • 0 Attachment
          Hello sir,
          I couldn't find out the 3rd maximum number with ur code.
          Could u pls tell me to find out the TOP 3 salaries?

          ur code was-

          SELECT MIN(Salary)
          FROM information
          WHERE salary IN
          (SELECT TOP 3 salary FROM information)

          It gives error in line 3 .

          Thank u sir.

          __________________________________________________
          Do You Yahoo!?
          Tired of spam? Yahoo! Mail has the best spam protection around
          http://mail.yahoo.com

          [Non-text portions of this message have been removed]
        • John Warner
          I think the target is MySQL based on his php dump. I have no idea if it supports the ROWNUM keyword. I will say I like that better then TOP x. John Warner
          Message 4 of 14 , Nov 9, 2007
          • 0 Attachment
            I think the target is MySQL based on his php dump. I have no idea if it
            supports the ROWNUM keyword. I will say I like that better then TOP x.

            John Warner




            > -----Original Message-----
            > From: SQLQueriesNoCode@yahoogroups.com
            > [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Carmen Popescu
            > Sent: Friday, November 09, 2007 1:53 AM
            > To: SQLQueriesNoCode@yahoogroups.com
            > Subject: Re: [SQLQueriesNoCode] pls help
            >
            >
            > I'm not very sure if this is working with SQL server, but in
            > Oracle you can use something like this:
            > select * from
            > ( select * from information order by salary)
            > where rownum=3
            >
            > This is for returning the 3rd value of the salary.
            >
            >
            >
            > zayed ** <zayed_ctn@...> wrote:
            > Hellogroup,
            > Pls help me to find out the maximum number in a sql database.
            > With this mail i'm attaching a sql file. Pls help me to find
            > out the maximum salary and the 3rd maximum salary in it. pls
            > give me the sql code to find it out. Pls help me . I'm very
            > new in coding.
            >
            > __________________________________________________
            > Do You Yahoo!?
            > Tired of spam? Yahoo! Mail has the best spam protection around
            > http://mail.yahoo.com
            > ----------
            >
            > -- phpMyAdmin SQL Dump
            > -- version 2.8.0.3
            > -- http://www.phpmyadmin.net
            > --
            > -- Host: localhost
            > -- Generation Time: Nov 05, 2007 at 03:49 PM
            > -- Server version: 5.0.21
            > -- PHP Version: 5.1.4
            > --
            > -- Database: `employee`
            > --
            >
            > -- --------------------------------------------------------
            >
            > --
            > -- Table structure for table `information`
            > --
            >
            > CREATE TABLE `information` (
            > `id` int(2) default NULL,
            > `name` varchar(20) default NULL,
            > `salary` int(5) default NULL
            > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
            >
            > --
            > -- Dumping data for table `information`
            > --
            >
            > INSERT INTO `information` VALUES (1, 'Mahboob', 25000);
            > INSERT INTO `information` VALUES (2, 'Zayed', 1500);
            > INSERT INTO `information` VALUES (3, 'gorki', 6500);
            > INSERT INTO `information` VALUES (4, 'rifat', 5000);
          • Noman Aftab
            ... correction SELECT MIN(Salary) FROM information WHERE salary IN (SELECT TOP 3 salary FROM information order by salary desc) Noman Muhammad Aftab Software
            Message 5 of 14 , Nov 9, 2007
            • 0 Attachment
              > SELECT MIN(Salary)
              > FROM information
              > WHERE salary IN
              > (SELECT TOP 3 salary FROM information)

              correction

              SELECT MIN(Salary)
              FROM information
              WHERE salary IN
              (SELECT TOP 3 salary FROM information order by salary desc)


              Noman Muhammad Aftab
              Software Engineer
              Avanza Solutions
              Tel:+92 21 567 5240 – 42 (ext: 755)
              Fax:+92 21 567 5244
              URL: http://www.avanzasolutions.com
              Email: noman.aftab@...



              ----- Original Message ----
              From: John Warner <john@...>
              To: SQLQueriesNoCode@yahoogroups.com
              Sent: Friday, 9 November, 2007 5:23:26 AM
              Subject: RE: [SQLQueriesNoCode] pls help

              > Pls help me to find out the maximum number in a sql database.

              What number? Salary or a count of all the rows in the table?

              > With this mail i'm attaching a sql file.

              Attachments (thankfully) are stripped from postings before being
              distributed. So your file never arrived.

              > Pls help me to find out the maximum salary
              > salary in it.

              SELECT MAX(salary)
              FROM information

              > and the 3rd maximum

              SELECT MIN(Salary)
              FROM information
              WHERE salary IN
              (SELECT TOP 3 salary FROM information)

              And that completes tonight's homework assignment. You should really give
              thought to popping that Relational Database textbook open and give it a
              read, Data Manipulation is only part of the job of learning SQL.

              John Warner

              > -----Original Message-----
              > From: SQLQueriesNoCode@ yahoogroups. com
              > [mailto:SQLQueriesNoCode@ yahoogroups. com] On Behalf Of zayed **
              > Sent: Thursday, November 08, 2007 1:49 PM
              > To: SQLQueriesNoCode@ yahoogroups. com
              > Subject: [SQLQueriesNoCode] pls help
              >
              > Hellogroup,
              > Pls help me to find out the maximum number in a sql database.
              > With this mail i'm attaching a sql file.
              > Pls help me to find out the maximum salary and the 3rd maximum
              > salary in it.
              > pls give me the sql code to find it out.
              > Pls help me .
              > I'm very new in coding.
              >
              > ____________ _________ _________ _________ _________ __
              > Do You Yahoo!?
              > Tired of spam? Yahoo! Mail has the best spam protection around
              > http://mail. yahoo.com
              > ----------
              >
              > -- phpMyAdmin SQL Dump
              > -- version 2.8.0.3
              > -- http://www.phpmyadm in.net
              > --
              > -- Host: localhost
              > -- Generation Time: Nov 05, 2007 at 03:49 PM
              > -- Server version: 5.0.21
              > -- PHP Version: 5.1.4
              > --
              > -- Database: `employee`
              > --
              >
              > -- ------------ --------- --------- --------- --------- --------
              >
              > --
              > -- Table structure for table `information`
              > --
              >
              > CREATE TABLE `information` (
              > `id` int(2) default NULL,
              > `name` varchar(20) default NULL,
              > `salary` int(5) default NULL
              > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
              >
              > --
              > -- Dumping data for table `information`
              > --
              >
              > INSERT INTO `information` VALUES (1, 'Mahboob', 25000);
              > INSERT INTO `information` VALUES (2, 'Zayed', 1500);
              > INSERT INTO `information` VALUES (3, 'gorki', 6500);
              > INSERT INTO `information` VALUES (4, 'rifat', 5000);
              >
              >
              > [Non-text portions of this message have been removed]
              >
              >
              >
              >
              > Yahoo! Groups Links
              >
              >
              >





              ___________________________________________________________
              Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html

              [Non-text portions of this message have been removed]
            • monojit aich
              In SQL server several ways to get nth highest . --********************************************************* -- pls run sqls before test sql 1 and 2
              Message 6 of 14 , Nov 9, 2007
              • 0 Attachment
                In SQL server several ways to get nth highest .

                --*********************************************************
                -- pls run sqls before test sql 1 and 2
                --**********************************************************
                create table SampleTable(ID numeric)

                insert into SampleTable values(2)
                insert into SampleTable values(7)
                insert into SampleTable values(5)
                insert into SampleTable values(3)
                insert into SampleTable values(11)

                --***************************************************************


                1. Without using Top x or RowNum ( I hope it will run any database)

                SELECT ID FROM SampleTable where id not in(
                SELECT ID FROM SampleTable where id >=all(
                SELECT ID FROM SampleTable where id not in(
                SELECT ID FROM SampleTable where id >= all(SELECT ID FROM SampleTable ))))
                and id in
                (SELECT ID FROM SampleTable where id >=all(
                SELECT ID FROM SampleTable where id not in(
                SELECT ID FROM SampleTable where id >=all(
                SELECT ID FROM SampleTable where id not in(
                SELECT ID FROM SampleTable where id >= all(SELECT ID FROM SampleTable ))))))


                2. Using Top(Only for SQL server)

                SELECT ID FROM SampleTable WHERE ID IN (
                SELECT TOP 3 ID FROM SampleTable ORDER BY ID )
                AND ID NOT IN
                (
                SELECT TOP 2 ID FROM SampleTable ORDER BY ID )



                ----- Original Message ----
                From: zayed ** <zayed_ctn@...>
                To: SQLQueriesNoCode@yahoogroups.com
                Sent: Friday, November 9, 2007 12:18:43 AM
                Subject: [SQLQueriesNoCode] pls help













                Hellogroup,

                Pls help me to find out the maximum number in a sql database.

                With this mail i'm attaching a sql file.

                Pls help me to find out the maximum salary and the 3rd maximum salary in it.

                pls give me the sql code to find it out.

                Pls help me .

                I'm very new in coding.



                ____________ _________ _________ _________ _________ __

                Do You Yahoo!?

                Tired of spam? Yahoo! Mail has the best spam protection around

                http://mail. yahoo.com

                ----------



                -- phpMyAdmin SQL Dump

                -- version 2.8.0.3

                -- http://www.phpmyadm in.net

                --

                -- Host: localhost

                -- Generation Time: Nov 05, 2007 at 03:49 PM

                -- Server version: 5.0.21

                -- PHP Version: 5.1.4

                --

                -- Database: `employee`

                --



                -- ------------ --------- --------- --------- --------- --------



                --

                -- Table structure for table `information`

                --



                CREATE TABLE `information` (

                `id` int(2) default NULL,

                `name` varchar(20) default NULL,

                `salary` int(5) default NULL

                ) ENGINE=InnoDB DEFAULT CHARSET=latin1;



                --

                -- Dumping data for table `information`

                --



                INSERT INTO `information` VALUES (1, 'Mahboob', 25000);

                INSERT INTO `information` VALUES (2, 'Zayed', 1500);

                INSERT INTO `information` VALUES (3, 'gorki', 6500);

                INSERT INTO `information` VALUES (4, 'rifat', 5000);



                [Non-text portions of this message have been removed]














                <!--

                #ygrp-mkp{
                border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
                #ygrp-mkp hr{
                border:1px solid #d8d8d8;}
                #ygrp-mkp #hd{
                color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
                #ygrp-mkp #ads{
                margin-bottom:10px;}
                #ygrp-mkp .ad{
                padding:0 0;}
                #ygrp-mkp .ad a{
                color:#0000ff;text-decoration:none;}
                -->



                <!--

                #ygrp-sponsor #ygrp-lc{
                font-family:Arial;}
                #ygrp-sponsor #ygrp-lc #hd{
                margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
                #ygrp-sponsor #ygrp-lc .ad{
                margin-bottom:10px;padding:0 0;}
                -->



                <!--

                #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
                #ygrp-mlmsg table {font-size:inherit;font:100%;}
                #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
                #ygrp-mlmsg pre, code {font:115% monospace;}
                #ygrp-mlmsg * {line-height:1.22em;}
                #ygrp-text{
                font-family:Georgia;
                }
                #ygrp-text p{
                margin:0 0 1em 0;}
                #ygrp-tpmsgs{
                font-family:Arial;
                clear:both;}
                #ygrp-vitnav{
                padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
                #ygrp-vitnav a{
                padding:0 1px;}
                #ygrp-actbar{
                clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
                #ygrp-actbar .left{
                float:left;white-space:nowrap;}
                .bld{font-weight:bold;}
                #ygrp-grft{
                font-family:Verdana;font-size:77%;padding:15px 0;}
                #ygrp-ft{
                font-family:verdana;font-size:77%;border-top:1px solid #666;
                padding:5px 0;
                }
                #ygrp-mlmsg #logo{
                padding-bottom:10px;}

                #ygrp-vital{
                background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
                #ygrp-vital #vithd{
                font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
                #ygrp-vital ul{
                padding:0;margin:2px 0;}
                #ygrp-vital ul li{
                list-style-type:none;clear:both;border:1px solid #e0ecee;
                }
                #ygrp-vital ul li .ct{
                font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
                #ygrp-vital ul li .cat{
                font-weight:bold;}
                #ygrp-vital a{
                text-decoration:none;}

                #ygrp-vital a:hover{
                text-decoration:underline;}

                #ygrp-sponsor #hd{
                color:#999;font-size:77%;}
                #ygrp-sponsor #ov{
                padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
                #ygrp-sponsor #ov ul{
                padding:0 0 0 8px;margin:0;}
                #ygrp-sponsor #ov li{
                list-style-type:square;padding:6px 0;font-size:77%;}
                #ygrp-sponsor #ov li a{
                text-decoration:none;font-size:130%;}
                #ygrp-sponsor #nc{
                background-color:#eee;margin-bottom:20px;padding:0 8px;}
                #ygrp-sponsor .ad{
                padding:8px 0;}
                #ygrp-sponsor .ad #hd1{
                font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
                #ygrp-sponsor .ad a{
                text-decoration:none;}
                #ygrp-sponsor .ad a:hover{
                text-decoration:underline;}
                #ygrp-sponsor .ad p{
                margin:0;}
                o{font-size:0;}
                .MsoNormal{
                margin:0 0 0 0;}
                #ygrp-text tt{
                font-size:120%;}
                blockquote{margin:0 0 0 4px;}
                .replbq{margin:4;}
                -->







                __________________________________________________
                Do You Yahoo!?
                Tired of spam? Yahoo! Mail has the best spam protection around
                http://mail.yahoo.com

                [Non-text portions of this message have been removed]
              • Carmen Popescu
                I cheked now, and the MySQL equivalent for ROWNUM is LIMIT. So you can write: SELECT * FROM (SELECT * FROM information ORDER BY salary DESC) LIMIT 3,3 ...
                Message 7 of 14 , Nov 9, 2007
                • 0 Attachment
                  I cheked now, and the MySQL equivalent for ROWNUM is LIMIT. So you can write:

                  SELECT * FROM
                  (SELECT * FROM information ORDER BY salary DESC)
                  LIMIT 3,3




                  ---------------------------------------
                  Carmen Popescu
                  "Gheorghe Lazar" National College
                  Sibiu - Romania
                  Oracle Academy Lead Adjunct
                  __________________________________________________
                  Do You Yahoo!?
                  Tired of spam? Yahoo! Mail has the best spam protection around
                  http://mail.yahoo.com

                  [Non-text portions of this message have been removed]
                • Carmen Popescu
                  I m not sure, but it is posible to need to use an alias for the table obtained from the subquery: SELECT * FROM (SELECT * FROM information ORDER BY salary) AS
                  Message 8 of 14 , Nov 9, 2007
                  • 0 Attachment
                    I'm not sure, but it is posible to need to use an alias for the table obtained from the subquery:
                    SELECT * FROM
                    (SELECT * FROM information ORDER BY salary) AS tab1
                    LIMIT 3,3


                    Carmen Popescu <carmen_cngl@...> wrote:
                    I cheked now, and the MySQL equivalent for ROWNUM is LIMIT. So you can write:

                    SELECT * FROM
                    (SELECT * FROM information ORDER BY salary DESC)
                    LIMIT 3,3

                    ---------------------------------------
                    Carmen Popescu
                    "Gheorghe Lazar" National College
                    Sibiu - Romania
                    Oracle Academy Lead Adjunct
                    __________________________________________________
                    Do You Yahoo!?
                    Tired of spam? Yahoo! Mail has the best spam protection around
                    http://mail.yahoo.com

                    [Non-text portions of this message have been removed]






                    ---------------------------------------
                    Carmen Popescu
                    "Gheorghe Lazar" National College
                    Sibiu - Romania
                    Oracle Academy Lead Adjunct
                    __________________________________________________
                    Do You Yahoo!?
                    Tired of spam? Yahoo! Mail has the best spam protection around
                    http://mail.yahoo.com

                    [Non-text portions of this message have been removed]
                  • John Warner
                    You are absolutely right, the list needs to be sorted. I like to think I would have noticed that if I had run the query. On the other hand the way my week has
                    Message 9 of 14 , Nov 9, 2007
                    • 0 Attachment
                      You are absolutely right, the list needs to be sorted. I like to think I
                      would have noticed that if I had run the query. On the other hand the way
                      my week has gone, it might have been in production for weeks before I
                      noticed.

                      John Warner




                      > -----Original Message-----
                      > From: SQLQueriesNoCode@yahoogroups.com
                      > [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Noman Aftab
                      > Sent: Friday, November 09, 2007 5:56 AM
                      > To: SQLQueriesNoCode@yahoogroups.com
                      > Subject: Re: [SQLQueriesNoCode] pls help
                      >
                      >
                      > > SELECT MIN(Salary)
                      > > FROM information
                      > > WHERE salary IN
                      > > (SELECT TOP 3 salary FROM information)
                      >
                      > correction
                      >
                      > SELECT MIN(Salary)
                      > FROM information
                      > WHERE salary IN
                      > (SELECT TOP 3 salary FROM information order by salary desc)
                      >
                      > alse need to apply distinct in the sub-query, as there may be
                      > more that one record for the same salary (value)
                      >
                      > Noman Muhammad Aftab
                      > Software Engineer
                      > Avanza Solutions
                      > Tel:+92 21 567 5240 - 42 (ext: 762)
                      > Fax:+92 21 567 5244
                      > URL: http://www.avanzasolutions.com
                      > Email: noman.aftab@...
                      >
                      >
                      >
                      > ----- Original Message ----
                      > From: John Warner <john@...>
                      > To: SQLQueriesNoCode@yahoogroups.com
                      > Sent: Friday, 9 November, 2007 5:23:26 AM
                      > Subject: RE: [SQLQueriesNoCode] pls help
                      >
                      > > Pls help me to find out the maximum number in a sql database.
                      >
                      > What number? Salary or a count of all the rows in the table?
                      >
                      > > With this mail i'm attaching a sql file.
                      >
                      > Attachments (thankfully) are stripped from postings before
                      > being distributed. So your file never arrived.
                      >
                      > > Pls help me to find out the maximum salary
                      > > salary in it.
                      >
                      > SELECT MAX(salary)
                      > FROM information
                      >
                      > > and the 3rd maximum
                      >
                      > SELECT MIN(Salary)
                      > FROM information
                      > WHERE salary IN
                      > (SELECT TOP 3 salary FROM information)
                      >
                      > And that completes tonight's homework assignment. You should
                      > really give thought to popping that Relational Database
                      > textbook open and give it a read, Data Manipulation is only
                      > part of the job of learning SQL.
                      >
                      > John Warner
                      >
                      > > -----Original Message-----
                      > > From: SQLQueriesNoCode@ yahoogroups. com [mailto:SQLQueriesNoCode@
                      > > yahoogroups. com] On Behalf Of zayed **
                      > > Sent: Thursday, November 08, 2007 1:49 PM
                      > > To: SQLQueriesNoCode@ yahoogroups. com
                      > > Subject: [SQLQueriesNoCode] pls help
                      > >
                      > > Hellogroup,
                      > > Pls help me to find out the maximum number in a sql database. With
                      > > this mail i'm attaching a sql file. Pls help me to find out the
                      > > maximum salary and the 3rd maximum salary in it.
                      > > pls give me the sql code to find it out.
                      > > Pls help me .
                      > > I'm very new in coding.
                      > >
                      > > ____________ _________ _________ _________ _________ __
                      > > Do You Yahoo!?
                      > > Tired of spam? Yahoo! Mail has the best spam protection around
                      > > http://mail. yahoo.com
                      > > ----------
                      > >
                      > > -- phpMyAdmin SQL Dump
                      > > -- version 2.8.0.3
                      > > -- http://www.phpmyadm in.net
                      > > --
                      > > -- Host: localhost
                      > > -- Generation Time: Nov 05, 2007 at 03:49 PM
                      > > -- Server version: 5.0.21
                      > > -- PHP Version: 5.1.4
                      > > --
                      > > -- Database: `employee`
                      > > --
                      > >
                      > > -- ------------ --------- --------- --------- --------- --------
                      > >
                      > > --
                      > > -- Table structure for table `information`
                      > > --
                      > >
                      > > CREATE TABLE `information` (
                      > > `id` int(2) default NULL,
                      > > `name` varchar(20) default NULL,
                      > > `salary` int(5) default NULL
                      > > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
                      > >
                      > > --
                      > > -- Dumping data for table `information`
                      > > --
                      > >
                      > > INSERT INTO `information` VALUES (1, 'Mahboob', 25000); INSERT INTO
                      > > `information` VALUES (2, 'Zayed', 1500); INSERT INTO `information`
                      > > VALUES (3, 'gorki', 6500); INSERT INTO `information` VALUES (4,
                      > > 'rifat', 5000);
                    • John Warner
                      I ve forgotten what DBMS are we talking about? John Warner
                      Message 10 of 14 , Nov 9, 2007
                      • 0 Attachment
                        I've forgotten what DBMS are we talking about?

                        John Warner




                        > -----Original Message-----
                        > From: SQLQueriesNoCode@yahoogroups.com
                        > [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of zayed **
                        > Sent: Friday, November 09, 2007 6:12 AM
                        > To: SQLQueriesNoCode@yahoogroups.com
                        > Subject: RE: [SQLQueriesNoCode] pls help
                        >
                        >
                        > Hello sir,
                        > I couldn't find out the 3rd maximum number with ur code.
                        > Could u pls tell me to find out the TOP 3 salaries?
                        >
                        > ur code was-
                        >
                        > SELECT MIN(Salary)
                        > FROM information
                        > WHERE salary IN
                        > (SELECT TOP 3 salary FROM information)
                        >
                        > It gives error in line 3 .
                        >
                        > Thank u sir.
                      • Attiq Jaffar
                        this might b help u ppl http://sqlserver2000.databases.aspfaq.com/how-do-i-get-the-nth-row-in-a-sql-server-table.html
                        Message 11 of 14 , Nov 10, 2007
                        • 0 Attachment
                          this might b help u ppl
                          http://sqlserver2000.databases.aspfaq.com/how-do-i-get-the-nth-row-in-a-sql-server-table.html

                          On Nov 10, 2007 1:35 AM, John Warner <john@...> wrote:
                          >
                          >
                          >
                          >
                          >
                          >
                          > I've forgotten what DBMS are we talking about?
                          >
                          >
                          > John Warner
                          >
                          > > -----Original Message-----
                          > > From: SQLQueriesNoCode@yahoogroups.com
                          > > [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of zayed **
                          > > Sent: Friday, November 09, 2007 6:12 AM
                          > > To: SQLQueriesNoCode@yahoogroups.com
                          > > Subject: RE: [SQLQueriesNoCode] pls help
                          > >
                          > >
                          > > Hello sir,
                          > > I couldn't find out the 3rd maximum number with ur code.
                          > > Could u pls tell me to find out the TOP 3 salaries?
                          > >
                          > > ur code was-
                          > >
                          > > SELECT MIN(Salary)
                          > > FROM information
                          > > WHERE salary IN
                          > > (SELECT TOP 3 salary FROM information)
                          > >
                          > > It gives error in line 3 .
                          > >
                          > > Thank u sir.
                          >
                          >
                          >
                        Your message has been successfully submitted and would be delivered to recipients shortly.