自动编号报告的最佳方法(MySQL)(Best method for auto numbering reports (MySQL))

编程入门 行业动态 更新时间:2024-10-27 22:32:09
自动编号报告的最佳方法(MySQL)(Best method for auto numbering reports (MySQL)) mysql

我正在开发一个应该生成校准证书的应用程序。 我们有10种类型的证书。

证书编号应自动生成。 证书应保存在数据库中(MySQL) 编号应该是顺序的。

我只想知道编号证书和将数据保存在数据库中的最佳机制。

顺便说一下,我正在使用休眠。 谢谢,

I'm working on an application that is supposed to be generating calibration certificates. We have like 10 types of certificates.

Certificates number should be auto generated. Certificates should be saved in the database (MySQL) numbering should be sequential.

I just want to know the best mechanism for numbering the certificates and persisting the data in the database.

I'm using hibernate by the way. Thanks,

最满意答案

我想你想要一个自动递增的字段,就像@ bart2puck指出的那样。 但是,您还可以根据该数字添加自定义“公司”和“证书”字段。 CONCAT(id,' - ',Company,' - ',Type)类型。 所以,记录可能看起来像这样

ID (auto) Company CertificateType CertificateId 345 22 5601 22-5601-345

添加索引时,请创建它(CertificateId,CertificateType,ID)

I think you want an auto incremented field as @bart2puck pointed out. but, you could also add a custom 'company' and 'certificate' field based upon that number. CONCAT(id,'-',Company,'-',Type) type. So, a record may look like this

ID (auto) Company CertificateType CertificateId 345 22 5601 22-5601-345

When you add your index, create it upon (CertificateId,CertificateType,ID)

更多推荐

本文发布于:2023-08-04 09:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1412765.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编号   方法   报告   MySQL   reports

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!