Database design: Some points of attention in database SQL Server design

Source: Internet
Author: User
Tags add time

1. Each table is gradually the object +id, the primary key + auto increment. No GUID.

2. Add 4 tracking fields per table: Insertdate,insertuserid, add time and add people, updatedate,updateuserid the last update time and update people, a total of four fields. If you are sure to use SQL SERVER, you can name it. if it is a product, in order to support multiple databases, or separate to good, such as: insert_date all lowercase, so naming is also a good choice, unified up can be. If I do, in the SQL Server database, I still prefer to name the case, Oracle with less, Oracle must be "_" separate.

3. Date unification with DateTime, whether the wrong is unified with the bit field, with the Chinese text byte unified with nvarchar, only in English with varchar, the price with a decimal point of the Unification of Decimal (10,2), almost all of these already contain all the field types.

4. Any table name does not use abbreviations, and the words are separated from the words by _.

5. Date-related table field suffix are date, the number of metric suffixes are used by the count, the message is used with the price, the prices are used cost, the link with the URL, the image with the image, points with point, record log with records, configuration with config, State with status, pattern mode with mode, classification are unified with category, class type unified with type, factory with factory, orders with order, users with user, admin with admin, password Password, comment Notes are used remark, Article article, news, imports with import, export with export, enable enabled, whether it is, described with description, The logo is marked with flags. Corporate companies with company, products with product, Province province, Urban city, county and county with district, address with a role, permissions with permission, login with login, Launched with logout, create unified with Create, delete with delete, update with update, get with GET, photos with photo, picture with image. Contact person Linkman.

Database design: Some points of attention in database SQL Server design

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.