SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
-
Jun 6, 2004, 08:38 #1
How many columns are allowed in a table?
I've searched this and several other sites to find out if there is a max number of columns that a table can have. No dice.
Does anyone know for sure?
Also, I plan on making a table consisting of a single row with 40+ columns...is this just bad practice?
Any thoughts, be you a guru or not, are appreciated.
Thank you.
Cranjled
-
Jun 6, 2004, 08:54 #2
- Join Date
- Jun 2004
- Location
- Montreal
- Posts
- 88
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
http://www.mysql.com/information/features.html
Latest version should handle up to 3400 columns
-
Jun 6, 2004, 08:56 #3
- Join Date
- Oct 2000
- Location
- Philadelphia, PA
- Posts
- 4,708
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
What kind of database are you using?
Here are the limitations of SQL Server 2000:
http://msdn.microsoft.com/library/de...ar_ts_8dbn.asp
I know Access is MUCH smaller than that.
Notice this:
File size (data)32 TB32 TB
Can you imagine a 32 Terabyte database? Wow!"Does this napkin smell like chloroform?"
...now with SnapFoo!
My Blog | My Twitter | My Company | SitePoint Podcast
*** Matt Mullenweg on the SitePoint Podcast ***
-
Jun 7, 2004, 14:02 #4
Thanks for the links... And here I was concerned about having a measily 40 columns!! I'm using a mySQL database.
32 Terrabytes huh?? That is simply inconceivable (to me!)
Thanks again you two...
Cranjled
-
Jun 7, 2004, 15:08 #5
- Join Date
- Jul 2003
- Location
- Kent
- Posts
- 1,921
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
40 columns strongly suggests you haven't normalised your database in any way what so ever!! I suggest you read up carefully on how to split up your data into multiple tables and how to use an entity relationship diagram to plan how the tables should be created. It sounds very much as if you are designing a flatfile style database, with no regard for the entities you are using.
You are likely to have lots of redundant repeating data with a single table containing 40 columns. This can lead to all sorts of errors, apart from lots of needless typing.Dr John
www.kidneydialysis.org.uk
-
Jun 8, 2004, 14:01 #6
No normalization whatsoever. To clarify...I need this to all be in a single table... Redundant data is impossible (I think) as there will be only one single row. The table will hold config info for another script.
At this point, the admin GUI writes the settings to a config.php file...but since the rest of the site uses a database for config settings, I thought it would only be prudent to do the same with my script.
As far as databases, I have no idea what I'm doing...other than reading up... I'll probably end up sticking with my flat config file in the end as doing so avoids SQL injection woes (since none of the script uses the db)... as well as another learning curve with databases.
Thanks for the info.
-
Jun 8, 2004, 14:18 #7
- Join Date
- May 2002
- Location
- United States
- Posts
- 457
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You should always store config tables like this:
Property Key, Value
ie...
title, "test"
username, "user123"
password, "secret"Compwizard
"There are 10 kinds of people in this world -- those who know binary, and those who don't."
-
Jun 8, 2004, 14:21 #8
Ahh... So then, I'd have two colums and forty rows, right? Still, the process eludes me, so I'm probably doomed to the config.php file. Luckily there's no "important" info in there...
-
Jun 8, 2004, 14:35 #9
- Join Date
- May 2002
- Location
- United States
- Posts
- 457
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
basically, you can just run a query something like this:
SELECT * FROM tablename WHERE propkey = "username";
read that into a string variable and compare that to the value entered into a form.
Or you can just run through the whole query and create PHP vars with the table data!Compwizard
"There are 10 kinds of people in this world -- those who know binary, and those who don't."
Bookmarks