Comments and Federated primary keys for SQL

Source: Internet
Author: User

1. Add a comment to the SQL

Comment on table tableName is ' table note ';

Comment on column tablename.columnname is ' field comment description ';

Comment on table t_cif_ehrlog is ' EHR synchronization log table ';
Comment on column t_cif_ehrlog.id is ' serial number ';
Comment on column t_cif_ehrlog.syn_date was ' synchronized (yyyy-mm) ';
Comment on column t_cif_ehrlog.interface_type is ' interface type (encoded) (Ehrcompanyimpl company information; Ehrdeptimpl Department information; Ehrpositionimpl position information; I MPL basic information; Ehrnationalimpl document information; Ehrbirthdayimpl birthday information; Ehrphoneimpl telephone information; Ehrorganizationimpl agency information;) ';
Comment on column t_cif_ehrlog.create_date is ' storage time (yyyy-mm-dd hh24:mi:ss) ';
Comment on column t_cif_ehrlog.update_date is ' Update time (yyyy-mm-dd hh24:mi:ss) ';
Comment on column t_cif_ehrlog.is_success is ' state (0: Success 1: failed) ';
Comment on column t_cif_ehrlog.error_message is ' failure description ';

2. Create the SQL for the Federated primary key

--ehr Synchronization Log Table

CREATE TABLE T_cif_ehrlog
(Id number is not NULL,
Syn_date VARCHAR2 () NOT NULL,
Interface_type VARCHAR2 (+) NOT NULL,
Create_date date NOT NULL,
Update_date date,
Is_success VARCHAR2 (1) NOT NULL,
Error_message VARCHAR2 (1000),
CONSTRAINT Pk_sin
Primary KEY (Syn_date,interface_type)
);

Description

Primary key: A property in a table that can uniquely determine a tuple. (The popular explanation is that a primary key is a combination of columns or columns that can uniquely determine a record.) Its role is to be able to accurately locate a record.

The Federated primary key is also used to accurately locate the unique records in a table, typically in many-to-many cases.

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.