Is it possible to have an SQL table with over a million columns? Is it possible to have an SQL table with over a million columns? database database

Is it possible to have an SQL table with over a million columns?


Don't.

Event if you can make it work, it will be very slow and unwieldly.

Instead, you should make a separate table with columns for PatientID, Feature, and Value.
This table would have one row for each cell in your proposed table.

It also makes it possible to add additional information about each patient-feature pair.


You'd normally split (normalize) the tables:

Sample: ID, PatientIDFeature: ID, NameSampleFeature: SampleID, FeatureID, value

SQL databases can't handle a lot of columns, but they can handle a lot of rows.


Try rearranging your table to:

CREATE TABLE MicroarrayData (    SampleID  INTEGER,    FeatureID INTEGER,    Value     REAL,    PRIMARY KEY (SampleID, FeatureID));