Professional Web Applications Themes

Obviously using the wrong command - MySQL

Based on some suggestions given in a previous thread for a different problem, I decided to try this. Purpose is to find the "longest" value stored in a column in an existing table. SELECT COUNT(*),MIN(LENGTH(city)) FROM chemp SELECT COUNT(*),MAX(LENGTH(city)) FROM chemp SELECT COUNT(*),AVG(LENGTH(city)) FROM chemp Strange (to me) everyone of these queries comes back as "30" which is the column design width. In fact every record in this table has "null" as the value in "city". Column type is varchar - table type is InnoDB. Is there some other string function that would returned the desired information? TIA Lee...

  1. #1

    Default Obviously using the wrong command

    Based on some suggestions given in a previous thread for a different
    problem, I decided to try this.

    Purpose is to find the "longest" value stored in a column in an
    existing table.

    SELECT COUNT(*),MIN(LENGTH(city)) FROM chemp
    SELECT COUNT(*),MAX(LENGTH(city)) FROM chemp
    SELECT COUNT(*),AVG(LENGTH(city)) FROM chemp

    Strange (to me) everyone of these queries comes back as "30" which is
    the column design width. In fact every record in this table has
    "null" as the value in "city".

    Column type is varchar - table type is InnoDB. Is there some other
    string function that would returned the desired information?

    TIA
    Lee



    Lee Guest

  2. #2

    Default Re: Obviously using the wrong command

    On 14 Feb, 19:17, Lee Peedin <rr.com> wrote: 

    What are you counting with the COUNT(*)?

    Captain Guest

  3. #3

    Default Re: Obviously using the wrong command

    On 15 Feb 2007 01:36:57 -0800, "Captain Paralytic"
    <com> wrote:
     
    >
    >What are you counting with the COUNT(*)?[/ref]

    The COUNT(*) was just to show the number of rows in the table (2602).
    I get the same result (30) if I remove the COUNT(*).

    Lee
    Lee Guest

  4. #4

    Default Re: Obviously using the wrong command

    On Wed, 14 Feb 2007 19:17:54 GMT, Lee Peedin wrote: 

    How long is a null? Try putting a value in column `city` in at least one
    row, and see what happens.

    --
    87. My vats of hazardous chemicals will be covered when not in use. Also, I
    will not construct walkways above them.
    --Peter Anspach's list of things to do as an Evil Overlord
    Peter Guest

Similar Threads

  1. What is wrong with this command ?
    By R.Smits in forum MySQL
    Replies: 2
    Last Post: September 29th, 03:02 AM
  2. What is wrong with this system "..." command?
    By Victor in forum PERL Miscellaneous
    Replies: 2
    Last Post: September 20th, 08:13 PM
  3. Windows Explorer Right Click Command (+ Custom Command Script)
    By lennySydney webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 1
    Last Post: September 6th, 07:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139