SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: mysql help!

  1. #1
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql help!

    I am trying to add a database to my Webpage .. and I am working on creating the tables, it's been while since I worked with SQL so I can't remember some things, so if someone could help me out that would be really cool.

    I am trying to add a "journal" to my site and I can't remember how many characters can be stored in one entry in the Database(mysql) and how to do the insert.


    Thanks

    Chuck
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe the amount of characters per record is dependant on the setting of each column. Let's take for example the setting tinyint(). It can only hold up to 4 integers, whereas the setting int() can hold many more.
    I think we need a bit more information on the design of your database, before we can tell you how many characters each column can hold in one record .

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to have an online journal in a database, an I am wondering if I write a huge journal entry, say 1000 words, will it be able to fit into mysql ? And if so how would I set it up? I am trying to find the limitations of mysql, how many words or characters can mysql hold in one entry?


    Thanks

    Chuck
    Last edited by Chuckie; May 11, 2002 at 03:32.
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  4. #4
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm.. that will be perfectly feasible if you ask me. I pasted a small portion of the MySQL Manual below, to give you a little explanation on the different field types for strings, and how many characters they can hold.

    [NATIONAL] VARCHAR(M) [BINARY]
    A variable-length string. Note: trailing spaces are removed when the value is stored (this differs from the ANSI SQL specification). The range of M is 0 to 255 characters (1 to 255 prior to MySQL Version 4.0.2). VARCHAR values are sorted and compared in case-insensitive fashion unless the BINARY keyword is given. See section 6.5.3.1 Silent Column Specification Changes. VARCHAR is a shorthand for CHARACTER VARYING. See section 6.2.3.1 The CHAR and VARCHAR Types.
    TINYBLOB
    TINYTEXT
    A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. See section 6.2.3.2 The BLOB and TEXT Types.
    BLOB
    TEXT
    A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. See section 6.2.3.2 The BLOB and TEXT Types.
    MEDIUMBLOB
    MEDIUMTEXT
    A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. See section 6.2.3.2 The BLOB and TEXT Types.
    LONGBLOB
    LONGTEXT
    A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters. See section 6.5.3.1 Silent Column Specification Changes. Note that because the server/client protocol and MyISAM tables has currently a limit of 16M per communication packet / table row, you can't yet use this the whole range of this type. See section 6.2.3.2 The BLOB and TEXT Types.
    As you can see, LONGBLOB or LONGTEXT, is well capable of holding 1000 characters .

  5. #5
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Mark!

    I am going to go download the manual now


    Chuck
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  6. #6
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Mark T.
    I believe the amount of characters per record is dependant on the setting of each column. Let's take for example the setting tinyint(). It can only hold up to 4 integers, whereas the setting int() can hold many more.
    for INT-family columns, the difference is in the range of numbers that can be stored. i don't know what "4 integers" means.

    Chuckie, TEXT should be fine for 1000 words as long as the words are less than 65 chars long on average. TEXT can hold 64K of text. if you think you need more, MEDIUMTEXT would be fine, which can hold 16M.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  7. #7
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by DR_LaRRY_PEpPeR
    for INT-family columns, the difference is in the range of numbers that can be stored. i don't know what "4 integers" means.
    i'm quite sure the 4 in INT (4) means that MySQL will only display up to 4 'characters' of the integer value, i.e. it's the display size... the range of values that can be stored is still unchanged (-2147483648 to 2147483647)

  8. #8
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know about that. if he meant that, he should've said "display a width of 4 numbers" or something. either way, INT(n) has nothing to do with the storage range. all n is, is the minimum display width. you could have INT(1) and you could still insert, and see, 999999999, etc. the only time specifying n is even necessary, it appears to me, is if you're using the ZEROFILL attribute. then, of course, you want to specify the minmum amount of numbers (0's) to be displayed.

  9. #9
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heh i know you knew about that doc... just trying to clear up any ambiguity...

  10. #10
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the heads up on that one Matt. And yes, I was trying to say "display width of 4 numbers", it just came out a bit wrong I guess .


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
  •