When naming tables and schema of the db is it best to use singular or plural.

For example. should it be Customers or Customer?

And when naming should it be Capital such as Customer or customer? Any best practice regarding naming?

解决方案

This question calls for a religious war.

I have no doubt it should be plural because...

A table is a collection of rows.

The SQL syntax becomes more natural - SELECT * FROM Customers instead of SELECT * FROM Customer.

The analogy to OOP - you have a class Customer and a list or other collection of customers called Customers.

SELECT * FROM Customers AS Customer WHERE Customer.FirstName = 'John' - Customers refers to the whole table while Customer refers to the current row.

Negative things

One has to switch several times between singular and plural during the development. You may start with a conceptual model - for example an entity relationship model - where the natural choice is to name the entity Customer. From this model you generate a database and must pluralize the name to get the Customers table. Finally you pick your favourit O/R mapper and it has to singularize the name again to get a class named Customer.

If you have to do this manually because the tool is lacking support (for example EntityFramework prior to .NET 4.0) it might be a reasonable choice to keep the table names singular but therfore get a class Customer instead of Customers without changing it by hand.

mysql 表名 复数,数据库表命名,复数或单数相关推荐

  1. vb 读取mysql所有表名_VB 读取ACCESS数据库中所有表名和指定表字段名.doc

    VB 读取ACCESS数据库中所有表名和指定表字段名 托束显疫面绰么蚂扛沁米衅居鸳辗熊踌薄舱杂们帖婉珍抓津担庐撕枪呻头胀亨短宛溅锭语氏遣搀赠摩紧茧综逾颂备呛庞枷脓移厚醛仕恬浸值胶碟亦短咳腥钥捎魄朗氟商 ...

  2. php爆数据库,php+MySql注入非暴力爆数据库表段

    某群主发了一篇<php+MySql注入非暴力爆数据库表段>的科普,那样的都可以发,我只好也一起发科普了. Author:Juliet 科普: <php+MySql注入非暴力爆数据库表 ...

  3. 【MySQL 第三天数据库表 增删改查】

    [MySQL 第三天数据库表 增删改查]] [1]mysql数据库表创建命令 [2]mysql查看数据库下的表命令 [3]mysql查看表内容命令 [4]mysql修改数据库表 [4.1]mysql添 ...

  4. 【MyBatis】Mybatis的java对象名和数据库表名不同怎么办?

    java对象名 和 数据库表名 不同怎么办? 提问: 我想请教一下,在使用mybatis的注解的时候,如果出现java对象名和数据库表名不同的时候,如何写mapper. 比如,UserAccount是 ...

  5. 在mysql中更新数据sql语句怎么写_在MySQL中,更新数据库表记录的SQL语句,包括______语句...

    在MySQL中,更新数据库表记录的SQL语句,包括______语句 答:insert replace update delete 在域F中,设其特征为2,对于任意a,b∈F,则(a+b)2 等于多少 ...

  6. java 修改mysql数据库表结构_MYSQL数据库表结构优化方法详解

    摘要:这篇MySQL栏目下的"MYSQL数据库表结构优化方法详解",介绍的技术点是"mysql数据库表结构.MySQL数据库.数据库表结构.MySQL.据库表结构.数据库 ...

  7. php设置数据库名,设置数据库表名-海豚PHP1.0.6完全开发手册-基于ThinkPHP5.0.10的快速开发框架...

    setTableName("数据库表名") 版本更新内容1.0.7支持使用模型 默认情况下,批量操作或者右侧的启用.禁用,其他快捷操作会去修改"当前模块名_当前控制器名& ...

  8. python连接mysql,自动生成数据库表对应的word文档(毕设福利)

    效果图 运行程序后生成的word文档 所需依赖 安装两个依赖插件 pip install pymysql pip install python-docx python程序 #!/usr/bin/pyt ...

  9. oracle 查询表字段6,Oracle 查询库中所有表名、字段名、字段名说明,查询表的数据条数、表名、中文表名、...

    --创建用户 create user "用户名" identitied by "密码": --给自己修改密码 查询所有表名: select t.table_na ...

  10. Oracle 查询库中所有表名、字段名、字段名说明,查询表的数据条数、表名、中文表名...

    查询所有表名: select t.table_name from user_tables t; 查询所有字段名: select t.column_name from user_col_comments ...

最新文章

  1. 六一:如何在Datawhale开源学习小程序中管
  2. python中的lambda匿名函数
  3. java怎么获取文本里的值_怎么获取到text中的文本,或者title中的值
  4. LINUX系统中动态链接库的创建与使用
  5. SAP Spartacus B2B Popover Directive 和 Popover Component 的生命周期管理
  6. javafx中的tree_JavaFX中的塔防
  7. python怎么改目录_如何查看文件,而不是使用Python进行更改的目录?
  8. 如何恢复被破坏的PowerDesigner pdm文件
  9. angularjs中的分页指令
  10. 将a数组部分给b数组c语言,C语言第6章1 数组.ppt
  11. golang 解析php序列化,golang实现php里的serialize()和unserialize()序列和反序列方法
  12. Design Pattern: Adapter 模式 - Object Adapter
  13. LINUX系统下监控DELL服务器硬盘状态
  14. 在Java中如何高效判断数组中是否包含某个元素
  15. Ceph浅析”系列之四——Ceph的结构
  16. java voip 的sip服务器搭建_用ASTERISK搭建自己的免费VOIP服务器
  17. 国自然标书,600多份成功申请基金的标书 可下载
  18. UNITY设计一款简单的3d射击小游戏(虚拟现实大作业)
  19. ES6特性:Promise
  20. 《Effective STL》 读书笔记

热门文章

  1. 七夕专属程序员的浪漫
  2. C++ 快速学习(一)
  3. 团队项目开发流程总结
  4. 1024Byte(字节)=1KB
  5. button标签定义type属性
  6. iOS 系统分享UIActivityViewController,自定义分享预览UI
  7. 关于使用[MASK]做完形填空时需要注意的点
  8. u盘格式化后数据能恢复吗?
  9. 优盘格式化了怎么恢复里面的数据?
  10. 2022年软件评测师真题