7

I have a database which stores a large amount of data in tables. This works fine, but I have a few individual variables that I need to store which are not "repeatable" in the sense that there will be no need for additional rows to store more copies of them.

I could just create a single table storing these miscellaneous variables and leave only a single row in that table, but that doesn't seem like the most efficient or cleanest option.

Is there a better approach (or ideally a way to store a single variable in MySQL)?

1 Answer 1

12

Just create a table e.g. called 'variables' with two fields 'name' and 'value'. Store your variables in this table, and there you go.

Sign up to request clarification or add additional context in comments.

1 Comment

Good idea. I should have thought of that. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.