473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to create a table with 300 columns?

3
Hello

I have created tables with 20-30 columns and it was manually writing each line of code even when the col type was the same such as
Expand|Select|Wrap|Line Numbers
  1. create table testexamp(
  2. id varchar (28).
  3. sample1 float(7,3),
  4. sample2 float(7,3),
  5. sample3 float(7,3),
  6. sample4 float(7,3));
But how can I create a table with 300 columns? Is there a proper way other than manually writing each line as in the above example?

Please help
mr
Aug 28 '07 #1
4 2587
pbmods
5,821 Expert 4TB
Heya, MR. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

You may want to rethink your table structure. For example, you can save each sample as its own record:
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE
  2.     `testexamp`
  3.     (
  4.         `id`
  5.             VARCHAR(28)
  6.             NOT NULL,
  7.         `sample`
  8.             FLOAT(7,3)
  9.             NOT NULL,
  10.         KEY
  11.         (
  12.             `id`,
  13.             `sample`
  14.         )
  15.     )
  16.  
Each id will then have 300 rows, which is fine because MySQL is good at indexing. You'd just need another script, such as PHP, if you wanted to present your data horizontally.

To answer your question, though, if you want 300 columns, you need to declare all 300 of them.
Aug 28 '07 #2
mray
3
Heya, MR. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

You may want to rethink your table structure. For example, you can save each sample as its own record:
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE
  2.     `testexamp`
  3.     (
  4.         `id`
  5.             VARCHAR(28)
  6.             NOT NULL,
  7.         `sample`
  8.             FLOAT(7,3)
  9.             NOT NULL,
  10.         KEY
  11.         (
  12.             `id`,
  13.             `sample`
  14.         )
  15.     )
  16.  
Each id will then have 300 rows, which is fine because MySQL is good at indexing. You'd just need another script, such as PHP, if you wanted to present your data horizontally.

To answer your question, though, if you want 300 columns, you need to declare all 300 of them.
--------------------------------
Hello,

Thank you for your message. I guess there is no nice solution because basically my data is a 16000 x 300 matrix. so, it doesn't help to transpose it..:)
Aug 28 '07 #3
pbmods
5,821 Expert 4TB
Heya, MR.

Depends on where your data is coming from. Are you saving the data using another scripting language, such as PHP or ASP?
Aug 28 '07 #4
mray
3
Heya, MR.

Depends on where your data is coming from. Are you saving the data using another scripting language, such as PHP or ASP?
----------------------------------------------------------------
Hello

My data is in .txt format. I cannot open it in excel as it exceeds 256 columns. The data itself came from a gene expression scan.

Thank you
mray
Aug 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michael Lauzon | last post by:
This is not for a class, I have a group on SourceForge, this is what one of the Developers is asking; the more advanced you can make it right off all the better!: Can someone please create...
3
by: anon | last post by:
I have been used to using DAO in the past, and then converted to ADO. Now I am having to use VB.Net(2000) and ADO.NET and am experiencing difficulties with the creation and population of an mdb....
1
by: danths | last post by:
Hello, I am being sent a fmt file and a data file without headers which I would like to import into my sql 2000 server. However the data files have couple of 100's of columns, how could I avoid...
7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
6
by: Bruce | last post by:
I want to create a new table based on an existing table, but I don't want the tables to have any enforced relationship. Is this possible without having to do a CREATE TABLE and an INSERT? ...
4
by: Amos | last post by:
I built the following Sub, in order to create tables automatically. The button is placed on a mask where there are 3 txt box, two of them contain the "Bank name" and "Bank a/c". I want to name the...
24
by: flkeyman | last post by:
Work in legal office. Trying to create solid designed database structure. This is list of tables w/fields and primary keys. Any comments/advice greatly appreciated. tbl-Defendants CaseNumber...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
1
by: TG | last post by:
Hi! I have an application in which I have some checkboxes and depending which ones are checked those columns will show in the datagridview from sql server or no. After that I have 2 buttons:...
1
by: alhomam | last post by:
hi all i have a table with many columns and i need to create a report that the user can select the columns he needs to show in the report. is it possible? thanks
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.