达梦数据库
1. 新增字段
ALTER TABLE "数据库名"."表名" ADD 字段名 字段类型;
ALTER TABLE "SZZY"."feedback_info" ADD mark VARCHAR2(256);
2. 修改字段
alter table test_table modify (test_column varchar(19) not null);
3. 删除表中字段
ALTER TABLE "数据库名"."表名" DROP COLUMN 字段名;
ALTER TABLE "SZZY"."feedback_info" DROP COLUMN case_id;
4. 给字段添加备注
comment ON COLUMN "数据库名"."表名"."字段名" IS '备注名';
comment ON COLUMN "SZZY"."feedback_info"."mark" IS '标记';
5. 给指定字段添加默认值
ALTER TABLE "数据库名"."表名" ALTER COLUMN 字段名 SET DEFAULT 默认值;
ALTER TABLE "SZZY"."feedback_info" ALTER COLUMN status SET DEFAULT 0;
6. 删除指定字段默认值
ALTER TABLE "数据库名"."表名" ALTER COLUMN 字段名 DROP DEFAULT;
ALTER TABLE "SZZY"."feedback_info" ALTER COLUMN mark DROP DEFAULT;
7. 增删改查
SELECT 字段名 FROM "表名" WHERE 条件;
SELECT "id", "case_code" FROM "case_info" WHERE "case_code" LIKE '%民终33%';
===========================================================================
UPDATE 数据库名."表名" SET "字段名" = '修改值' WHERE 条件;
UPDATE SZZY."feedback_info" SET "status" = '1' WHERE id = 1745737045470896128;
===========================================================================
INSERT INTO "数据库名"."表名" (字段列表) VALUES (字段值列表) ;
INSERT INTO "SZZY"."feedback_info" ("func_code","fdbk_person") VALUES ('04', '管理员') ;
===========================================================================
DELETE FROM "数据库名"."表名" WHERE 条件;
DELETE FROM "SZZY"."feedback_info" WHERE "fdbk_date" < '2024-01-11 16:06:40';
8. 修改表名
ALTER TABLE 旧表名 RENAME TO 新表名;
ALTER TABLE yuangong RENAME TO employee;
9. 增加表注释
comment ON TABLE 表名 is ‘注释’
10. 达梦数据库 修改字段名
ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name;