firebird学习笔记
firebird默认的用户名:SYSDBA 密码:masterkey
开源的Firebird的可视化管理工具Marathon
flameRobin也量个开源的可视化管理工具
1、创建表
CREATE TABLE table_name
(
column_name {< datatype> | COMPUTED BY (< expr>) | domain}
[DEFAULT { literal | NULL | USER}] [NOT NULL]
...
CONSTRAINT constraint_name
PRIMARY KEY (column_list),
UNIQUE (column_list),
FOREIGN KEY (column_list) REFERENCES other_table (column_list),
CHECK (condition),
...
);
如:create table t1
(
sno1 char(9) primary key,
sno2 char(9) references student(sno)
)
2、修改表
(1)增加字段
alter table table_name add fieldname datetype [not null ,primary key]
如:alter table student add sex char(2) not null
primary key
default 'm'
CHECK (sex1='f' or sex1='m')
ALTER TABLE STUDENT
ADD AGE INTEGER[1:100]
DEFAULT 56
CHECK (age between 20 and 35)
ALTER TABLE STUDENT
ADD AGE INTEGER[1:100]
DEFAULT 56
CHECK (age>=20 and age<=35)
(2)删除字段
alter table table_name drop fieldname
ALTER TABLE STUDENT DROP AA
(3)增加主键
alter table SCORE
add constraint PK_SCORE_1
primary key (ID, CORUSENAME)
查询:
SELECT [TRANSACTION transaction]
[DIST
firebird学习笔记
最新推荐文章于 2021-02-01 03:34:55 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)