What is the best practice names of the table fields in MySQL?

0 like 0 dislike
10 views
5bfbe9788be7e365284372.png

or

5bfbe9840b772746892892.png

???
by | 10 views

4 Answers

0 like 0 dislike
1 is better in General here and there shoals
by
0 like 0 dislike
There is a matter of choice standards within the group of developers agree to use names.
For example, the second method is redundant in this approach, writing queries.
select country.country_id from country

and here is a little easier to understand why to include the table alias:
select c.country_id from country c

If skillfully to shorten the alias names, then you can live with a short approach naming:
select ctry.id from country ctry

If the catch of a different kind - call or id_country field country_id.
The first option is correct from the point of view of eng. language, and the second is visually easier to keep track of the types of fields, if you put vertically.
by
0 like 0 dislike
Simple name is much easier, especially when working with different ORM, so you will have to specify the primary key. All sorts country_id convenient when making foreign keys and then probably here for convenience can be neglected
by
0 like 0 dislike
1. Exactly according to claim 1, we need to do!
2. active_status is not right!
Need: or bool "isActive" or "status_id", and a separate status table.
3. *_total, *_tally is the result of a query count() and these fields should not have to be anywhere else!

Normalize your DB first. Details here.
by

Related questions

0 like 0 dislike
4 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Apr 5, 2019 by cac95
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
32,854 users