get rows in mysql at command prompt

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mechphisto

    #1

    get rows in mysql at command prompt

    This question really belongs more in a mySQL group, but my NNTP server
    doesn't have a mySQL group available. Sorry. =(

    I'm trying to get number of rows in a table without doing a "select * from
    table" or even a "select id from table". I know in PHP you put:
    mysql_numrows()
    but what's the equivelant in command prompt?
    I searched mysql.net and can't find anything.

    Thanks for any advice!
    Liam


  • Alvaro G Vicario

    #2
    Re: get rows in mysql at command prompt

    *** Mechphisto wrote/escribió (Mon, 12 Apr 2004 15:49:42 GMT):[color=blue]
    > I'm trying to get number of rows in a table without doing a "select * from
    > table" or even a "select id from table".[/color]

    SELECT COUNT(*) FROM table

    It's standard SQL, works in any DBMS.


    --
    --
    -- Álvaro G. Vicario - Burgos, Spain
    --

    Comment

    • Mechphisto

      #3
      Re: get rows in mysql at command prompt

      "Alvaro G Vicario" <alvaro_QUITAR_ REMOVE@telecomp uteronline.com> wrote in
      message news:1iep4vmuga lig$.1055jimple qom$.dlg@40tude .net...[color=blue]
      > *** Mechphisto wrote/escribió (Mon, 12 Apr 2004 15:49:42 GMT):[color=green]
      > > I'm trying to get number of rows in a table without doing a "select *[/color][/color]
      from[color=blue][color=green]
      > > table" or even a "select id from table".[/color]
      >
      > SELECT COUNT(*) FROM table[/color]

      Thank you very much!! Saves me a lot of problems! =)
      Liam


      Comment

      • Tom Thackrey

        #4
        Re: get rows in mysql at command prompt


        On 12-Apr-2004, "Mechphisto " <liam@REEMOVEme chphisto.net> wrote:
        [color=blue]
        > This question really belongs more in a mySQL group, but my NNTP server
        > doesn't have a mySQL group available. Sorry. =(
        >
        > I'm trying to get number of rows in a table without doing a "select * from
        > table" or even a "select id from table". I know in PHP you put:
        > mysql_numrows()
        > but what's the equivelant in command prompt?
        > I searched mysql.net and can't find anything.[/color]

        try "SHOW TABLE STATUS LIKE 'tablename'" look at the column named 'Rows'

        --
        Tom Thackrey

        tom (at) creative (dash) light (dot) com
        do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

        Comment

        • Garp

          #5
          Re: get rows in mysql at command prompt


          "Mechphisto " <liam@REEMOVEme chphisto.net> wrote in message
          news:qUyec.2278 0$rg5.40320@att bi_s52...[color=blue]
          > This question really belongs more in a mySQL group, but my NNTP server
          > doesn't have a mySQL group available. Sorry. =([/color]
          <snip>

          Does it have alt.php.sql?

          Garp


          Comment

          • Mechphisto

            #6
            Re: get rows in mysql at command prompt

            "Garp" <garp7@no7.blue yonder.co.uk> wrote in message
            news:yzzec.1849 $YI3.18848971@n ews-text.cableinet. net...[color=blue]
            >
            > "Mechphisto " <liam@REEMOVEme chphisto.net> wrote in message
            > news:qUyec.2278 0$rg5.40320@att bi_s52...[color=green]
            > > This question really belongs more in a mySQL group, but my NNTP server
            > > doesn't have a mySQL group available. Sorry. =([/color]
            > <snip>
            >
            > Does it have alt.php.sql?[/color]

            No, afraid not. =/


            Comment

            • Garp

              #7
              Re: get rows in mysql at command prompt


              "Mechphisto " <liam@REEMOVEme chphisto.net> wrote in message
              news:jRCec.2184 2$wP1.44082@att bi_s54...[color=blue]
              > "Garp" <garp7@no7.blue yonder.co.uk> wrote in message
              > news:yzzec.1849 $YI3.18848971@n ews-text.cableinet. net...[color=green]
              > >
              > > "Mechphisto " <liam@REEMOVEme chphisto.net> wrote in message
              > > news:qUyec.2278 0$rg5.40320@att bi_s52...[color=darkred]
              > > > This question really belongs more in a mySQL group, but my NNTP server
              > > > doesn't have a mySQL group available. Sorry. =([/color]
              > > <snip>
              > >
              > > Does it have alt.php.sql?[/color]
              >
              > No, afraid not. =/[/color]

              Don't worry about it, it's low traffic (and not really a great idea either).
              Everyone else posts MySQL questions here, anyway...

              Garp


              Comment

              Working...