Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I want to design a database which is going to consists of really lot of columns, since it's a web game's inventory but there is going to be really lot of things.
It would probably call for names like "item_1", "item_2" but is that even ideal?
When I plan it to be extended over 1 000 items?
I need to SELECT later if the user has them, every single one.
I plan to use MariaDB and Laravel framework with Jetstream, Livewire and Tailwind.css.
Before you do anything, read about
NF
1NF
2NF
3NF
BCNF
Bearing in mind the knowledge you thusly accumulate, you should reach to a conclusion similar to having some tables like these:
item_types(id, name, ...)
user(username, password, ...)
inventory(user_id, item_type_id, amount)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have to build the conceptual model for a school, which has a Cafe inside it. The school wants to control the profits which derive from the Cafe.
What could be the best way to represent this with an er-diagram?
I tried to create the entity "CAFE", with attributes NameActivity, Profits. But I don't think that makes sense
One possible conceptual model could be this
The Cafe generates orders and every orders contains different order rows (cappuccino, latte, and so on). You can retrive the profit simply adding the cost of each order row.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
For example, why would I use ENUM of '0','1' as opposed to having an INT(1) and set conditions in php?
Some people just need to create problems for themselves. They don't know it at the time. I recommend staying away from enum, like salmon left out on the summertime counter.
If you have codes, have a code table with full blown verbiage and Foreign Key Constraints. It's how the big boys roll.
http://komlenic.com/244/8-reasons-why-mysqls-enum-data-type-is-evil/
The ENUM option is used, more descriptibos when developing your tables for example: enum ('active', 'inactive') instead of using zero or one, also can use it as enum ('admin' editor ', 'client').
As I mentioned helps you be more descriptive and here about 6 months after touching your model, you look back and you must not guess that means one or zero. if not that just see it you realize that it serves the field.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
How to build a nice schema for activities in a database?
One activity can relate to one of 50 different entities.
For now i see only 3 solutions:
Table "activity" contains 50 columns with foreignkeys to the other entities.
This results in a very big table, which i do not like.
Each entity has its own "activity"-Table.
This solution results in nearly doubling the tables in my database, but its clearer. Still not the best solution.
Dirty one: "activity"-table contains one "entityType"-column with the entity-table-name and a other "entityId"-columns with the id to the entity.
But this solution break all foreign-keys and allows to store crap data in my activity table.
Perhaps somebody of you build a CRM and had to face with the same problem.
Does anyone have a better and clean solution?
Like i see, there is only a decission to make. First and second possibility are good because the keep the consistency of the db. In my case i decided to use 1. possibility.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
This is not technical question, anyway it's related to good and clean code.
If I had tables articles and tags, I know the taggings can be good choice for middle table name.
What about other names? Like many-to-many in articles and cateogories. What's the best name for table between these two?
Is there any good approach? Or is it a question of English grammar? Please let me know.
Best approach in my opinion would be to combine the two model names into one: ArticleTag (TagArticle makes less sense here). If you call it Taggings, then you (or someone maintaining your code / database) won't realise the relationship right away.
Same for ArticleCategory (CategoryArticle makes less sense).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have several databases represents the companies we work.
In every database there are fields which we work on.
And in the fields area, there are field infos and our engineer who worked at that field.
I need to search all databases and filter with engineer names, to get a list of fields he worked.
I hope I could explain.
Any simple solution?
Nope. You're going to have to manually write queries to search each table in each database. The whole idea of database schemas and tables is that they are distinct wrappers for data, which can't be implicitly joined.