PostgreSQL/Lightdb 更改列屬性語法
Oracle:
SQL> desc emp; Name Null? Type ----------------------------------------- -------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) DNAME VARCHAR2(100) SQL> SQL> alter table emp modify ename varchar2(20) default ' '; Table altered.
LightDB:
lightdb@postgres=# alter table emp alter column ename type varchar2(20); ALTER TABLE lightdb@postgres=# alter table emp alter column ename set default ' '; ALTER TABLE lightdb@postgres=# \d emp Table "public.emp" Column | Type | Collation | Nullable | Default ----------+---------------+-----------+----------+--------------- empno | numeric(4,0) | | not null | ename | varchar2(20) | | | ' '::varchar2 job | varchar2(9) | | | mgr | numeric(4,0) | | | hiredate | date | | | sal | numeric(7,2) | | | comm | numeric(7,2) | | | deptno | numeric(2,0) | | | dname | varchar2(100) | | | Indexes: "pk_emp" PRIMARY KEY, btree (empno) lightdb@postgres=# \h alter table Command: ALTER TABLE Description: change the definition of a table Syntax: ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ] action [, ... ] ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ] RENAME [ COLUMN ] column_name TO new_column_name ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ] RENAME CONSTRAINT constraint_name TO new_constraint_name ALTER TABLE [ IF EXISTS ] name RENAME TO new_name ALTER TABLE name WITH UPDATE CURRENT_TIMESTAMP ALTER TABLE name WITH PRIMARY KEY [ smallserial | serial | bigserial ] ALTER TABLE [ IF EXISTS ] name SET SCHEMA new_schema ALTER TABLE ALL IN TABLESPACE name [ OWNED BY role_name [, ... ] ] SET TABLESPACE new_tablespace [ NOWAIT ] ALTER TABLE [ IF EXISTS ] name ATTACH PARTITION partition_name { FOR VALUES partition_bound_spec | DEFAULT } ALTER TABLE [ IF EXISTS ] name DETACH PARTITION partition_name where action is one of: ADD [ COLUMN ] [ IF NOT EXISTS ] column_name data_type [ COLLATE collation ] [ column_constraint [ ... ] ] DROP [ COLUMN ] [ IF EXISTS ] column_name [ RESTRICT | CASCADE ] ALTER [ COLUMN ] column_name [ SET DATA ] TYPE data_type [ COLLATE collation ] [ USING expression ] ALTER [ COLUMN ] column_name SET DEFAULT expression ALTER [ COLUMN ] column_name DROP DEFAULT ALTER [ COLUMN ] column_name { SET | DROP } NOT NULL ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] ALTER [ COLUMN ] column_name ADD GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) ] ALTER [ COLUMN ] column_name { SET GENERATED { ALWAYS | BY DEFAULT } | SET sequence_option | RESTART [ [ WITH ] restart ] } [...] ALTER [ COLUMN ] column_name DROP IDENTITY [ IF EXISTS ] ADD AUTO_INCREMENT(column_name) [ =N ]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-2907813/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 屬性列舉法(轉載)
- 理解CSS屬性值語法CSS
- css屬性值語法解讀CSS
- 更改input的type屬性
- 3. Vue語法--計算屬性Vue
- 深入理解 CSS 屬性值語法CSS
- CSS語法手冊字型屬性(轉)CSS
- CSS(1)基礎語法、常見屬性CSS
- win10怎麼更改網路屬性_要如何更改網路屬性windows10Win10Windows
- win10怎樣更改連線屬性_win10怎麼更改網路屬性Win10
- LightDB/PostgreSQL 客戶端部署SQL客戶端
- PostgreSQL:表的儲存屬性SQL
- CSS語法手冊(六)分類屬性(轉)CSS
- NumPy 陣列屬性陣列
- Hive學習之更改表的屬性Hive
- 【ASM】ASMCMD chtmpl 更改ASM 模版的屬性ASM
- LightDB/PostgreSQL等待事件 Lock transactionidSQL事件
- Oracle vs PostgreSQL Develop(25) - plsql vs plpgsql(語法嚴謹性)OracleSQLdev
- LightDB/PostgreSQL 設定LightDB訪問白名單pg_hba.confSQL
- JavaScript 陣列 length 屬性JavaScript陣列
- LightDB/PostgreSQL 相容Oracle儲存過程SQLOracle儲存過程
- vue.js常用屬性 es6的常用語法Vue.js
- CSS語法手冊(五)顏色和背景屬性(轉)CSS
- Oracle/MySQL透過odbc訪問PostgreSQL for LightDBOracleMySql
- PostgreSQL/LightDB 分割槽表之分割槽裁剪SQL
- 使用GoldenGate 遷移Oracle到PostgreSQL/LightDBGoOracleSQL
- Excel無法更改巨集安全性Excel
- odoo欄位屬性列舉Odoo
- Java雙屬性列舉使用Java
- 【java規則引擎】基本語法和相關屬性介紹Java
- Vue模板語法、屬性繫結、條件渲染的學習Vue
- @JSON(name="members")//使用註釋語法來改變該屬性序列化後的屬性名JSON
- win10怎麼更改檔案屬性 win10怎樣修改檔案屬性Win10
- VueJs中動態更改svg的相關屬性VueJSSVG
- PostgreSQL/LightDB分割槽表之常見問題SQL
- PostgreSQL/LightDB 不走並行是為什麼?SQL並行
- C# 9 record 並非簡單屬性 POCO 的語法糖C#
- 《HTML5移動開發》——2.2 HTML元素/屬性的語法HTML移動開發