Should we use prefixes in our database table naming conventions?

前端 未结 7 2180
攒了一身酷
攒了一身酷 2021-02-05 22:03

We are deciding the naming convention for tables, columns, procedures, etc. at our development team at work. The singular-plural table naming has already been decided,

7条回答
  •  醉梦人生
    2021-02-05 22:46

    If you're worried about mixing up your table names, employ a hungarian notation style system in your code. Perhaps "s" for string + "tn" for table name:

     stnUsers = 'users';
     stnPosts = 'posts';
    

    Of course, the prefix is up to you, depending on how verbose you like your code... strtblUsers, strtblnmeUsers, thisisthenameofatableyouguysUsers...

    Appending a prefix to table names does have some benefits, especially if you don't hardcode that prefix into the system, and allow it to change per installation. For one, you run less risk of conflicts with other components, as Ian said, and secondly, should you wish, you could have two or instances of your program running off the same database.

提交回复
热议问题