-5

In SQL, what's the standard convention for what rows and columns should be used for? For instance, if I need to make a table of users and their data, which axis (rows or columns) should be the users labels and which axis should be the users data labels?

EDIT: The Free Heroku plan only allows a maximum of 10000 rows on the SQL table, so will it make a difference if I switch the table axises around and use a very large number of columns instead of rows?

  • Can you provide some sample data? – user209881 May 30 '17 at 23:59
  • 1
    I guarantee that your DBMS allows fewer columns than rows, so switching them wouldn't improve on that. Plus-- you can't exactly switch them, it doesn't work that way. – John Wu May 31 '17 at 2:38
  • This question is based off a complete misunderstanding of what a "table" is, in the database sense of the term. – Alexander May 31 '17 at 23:00
6

Rows are used for entities, e.g. "users."

Columns are used for fields, e.g. "FirstName", "LastName."

Always.

So you're probably asking the wrong question.

The answer to the question you probably should be asking is "Users is one table, user data is in one or more additional tables joined to the Users table via Primary Key/Foreign Key relationships."

If you're trying to get around some limitation like the 10,000 rows of the free Heroku plan, switching the axes is going to cost you far, far more than just buying a data plan and doing it the right way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.