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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 3. Vue語法--計算屬性Vue
- CSS(1)基礎語法、常見屬性CSS
- win10怎麼更改網路屬性_要如何更改網路屬性windows10Win10Windows
- win10怎樣更改連線屬性_win10怎麼更改網路屬性Win10
- LightDB/PostgreSQL 客戶端部署SQL客戶端
- LightDB/PostgreSQL等待事件 Lock transactionidSQL事件
- PostgreSQL:表的儲存屬性SQL
- NumPy 陣列屬性陣列
- LightDB/PostgreSQL 設定LightDB訪問白名單pg_hba.confSQL
- Oracle vs PostgreSQL Develop(25) - plsql vs plpgsql(語法嚴謹性)OracleSQLdev
- JavaScript 陣列 length 屬性JavaScript陣列
- LightDB/PostgreSQL 相容Oracle儲存過程SQLOracle儲存過程
- 使用GoldenGate 遷移Oracle到PostgreSQL/LightDBGoOracleSQL
- vue.js常用屬性 es6的常用語法Vue.js
- VueJs中動態更改svg的相關屬性VueJSSVG
- Vue模板語法、屬性繫結、條件渲染的學習Vue
- Java雙屬性列舉使用Java
- odoo欄位屬性列舉Odoo
- PostgreSQL/LightDB 分割槽表之分割槽裁剪SQL
- Oracle/MySQL透過odbc訪問PostgreSQL for LightDBOracleMySql
- win10怎麼更改檔案屬性 win10怎樣修改檔案屬性Win10
- C# 9 record 並非簡單屬性 POCO 的語法糖C#
- Lesson4——NumPy 陣列屬性陣列
- PostgreSQL/LightDB分割槽表之常見問題SQL
- PostgreSQL/LightDB 不走並行是為什麼?SQL並行
- 2. Vue語法--插值操作&動態繫結屬性 詳解Vue
- Sql語句實現不同記錄同一屬性列的差值計算SQL
- LightDB/PostgreSQL 生成可重複執行的指令碼SQL指令碼
- win10系統txt檔案怎麼改屬性_win10 txt檔案如何更改屬性Win10
- win10如何修改音樂檔案屬性_win10更改音樂檔案屬性的方法Win10
- js可列舉屬性的遍歷JS
- 處理陣列中某一屬性陣列
- cocos 無法設定Node layer屬性
- JS 陣列(Arrey)屬性以及方法詳解JS陣列
- 陣列物件按物件某個屬性排序陣列物件排序
- PostgreSQL多值列的選擇性-Statistics,Cardinality,Selectivity,EstimateSQL
- scala語法 -多維陣列陣列
- CMake 屬性之全域性屬性