Preface
In Oracle database, you can useALTER TABLE
Statement to add fields and useCOMMENT ON COLUMN
Statement to add field comments. Here is an example:
Suppose you have a name calledemployees
table, you want to add a name calledemail
and comment on the field.
1. Add fields
ALTER TABLE employees ADD (email VARCHAR2(100));
2. Add field comments
COMMENT ON COLUMN IS 'Email address of the employee';
Complete example
-- Add fields ALTER TABLE employees ADD (email VARCHAR2(100)); -- Add fields注释 COMMENT ON COLUMN IS 'Email address of the employee';
illustrate
-
ALTER TABLE
Statements are used to modify existing table structures. -
ADD (column_name data_type)
Used to add new fields. -
COMMENT ON COLUMN
Statements are used to comment fields, and the annotation content can be any descriptive text to help other developers or database administrators understand the purpose of fields.
If you need to add multiple fields, you canADD
All fields are listed in the clause, for example:
ALTER TABLE employees ADD (email VARCHAR2(100), phone_number VARCHAR2(20));
Then add a comment for each field:
COMMENT ON COLUMN IS 'Email address of the employee'; COMMENT ON COLUMN employees.phone_number IS 'Employee';
Summarize
This is the article about oracle adding fields and field annotation SQL statements. For more related oracle adding fields and field annotation content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!