sybase 常用DDL语句
时间:2021-07-01 10:21:17
帮助过:45人阅读
1.删除列:
ALTER TABLE table_name DELETE column_name;
2.增加列:
ALTER TABLE table_name ADD (column_name DATA_TYPE [NOT] NULL);
3.修改列的空与非空:
ALTER TABLE table_name MODIFY column_name [NOT] NULL;
4.修改列名:
ALTER TABLE table_name RENAME old_column_name TO new_column_name;
5.快速建立临时表:
SELECT * INTO [#]table_name FROM .....;
6、修改表名:
ALTER TABLE old_table_name RENAME new_table_name
7.增加主键约束:
ALTER TABLE tb_name ADD CONSTRAINT pk_name PRIMARY KEY(col_name,..)
8.删除主键约束:
ALTER TABLE tb_name DROP CONSTRAINT pk_name;
9.建立自增长字段,与Oracle的SEQUENCE类似:
CREATE TABLE TMP_001 (RES_ID INTEGER IDENTITY NOT NULL);
10.添加表注释:
COMMENT ON TABLE table_name IS ‘....‘;
11.创建索引:
CREATE INDEX index_name ON table_name(column_name);
sybase 常用DDL语句
标签:mod primary int 创建索引 表名 sof ddl comment 字段