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.
Related
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)
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 5 years ago.
Improve this question
In many many forms you see separate inputs for first and last name. I assume that asking for a users full name in one input is bad practice because you cannot rely on simply splitting the string by spaces to get the first and last names.
Now I think about it i'm not sure if this would be a problem, can anyone shed any light on whether this is good or bad practice and if it is bad to ask for full name in a single input, why is it bad.
Thanks
As soon as you need to address a customer by Last Name, First Name you're screwed. Sorting becomes a problem, etc.
It's very little extra effort to ask for each separately even if you don't think it's useful now. But to go back and do it is very problematic. Data atomization is important.
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 7 years ago.
Improve this question
I am making a tablature website and I wonder which is the best way to store tabs in the database.
Here is an example:
------------------------------------------------------------0------------------------------
-------------1-0---------------------1-0-----------0-1-1-1-----3-1-0-----------------------
0-0-0-2-2-2------2-0-----0-0-0-2-2-2-----2-0---0-2-------------------2-------2-0---0-------
-----------------------------------------------------------------------4-2-0-----4---------
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
If it was me, and it is exactly that way, (I. E. 1-2-3) I'd go for the following:
Create table tabs (
Songid varchar(36) -- uuid or name, fk to the song
String int,
Position int
)
Depending on the server side language, you could theoretically retrieve and display them, separated by the dashes.
It'd be a bit tricky to get right, but what you would want, is to have a while loop or cursor display the number, or dash if there is no number at the given position, for the given string.
Does that make sense? I can try and elaborate, but it would depend on the language the web server was using.
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 8 years ago.
Improve this question
I want to remove some special strings like ' in, at, on, a, an ,with... etc' from a search string in MySql.
eg-
select * from tbl_search where serachkey='best hotels in kerala';
I need to remove 'in' from string and need to look on database for best match, its somthing like google search.
I have one table with id,keys and parent_id.
The most scored parent_id should emit first.
Google Search is not an easy task to build.. but What you are in need of is Natural Language Processing.
Learn about OPEN NLP or Stanford NLP.
This will identify the parts of speech in a given sentence and you can manipulate further as per your needs.
You can also train a model for your needs.
Link for OpenNLP
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).