关系运算
- 选择
- 投影
- 连接
数据库设计
- 需求分析
- 概念结构设计
- E-R模型: E-R图即实体-联系图(Entity Relationship Diagram),是指提供了表示实体型、属性和联系的方法,用来描述现实世界的概念模型,
![]()
矩形为实体,椭圆为属性,联系有1:1, 1:N, M:N
- 逻辑设计
- 物理设计
- 数据库实施
- 数据的运行和维护
时间
- now()
- curdate()
- curtime()
sql 语句
- 查询
select * from student
select (*,列名) from (表名)
- 修改表结构
alter table (表名) add (列名) (列属性)alter table student add remark char(10)
- 删除表
drop table student
drop table (表名)
- 创建表
create tabel student { id char(10) not null primary key, name char(10) not null }
create table (表名) {列名 列属性}
- 更新表数据
update student set name = '' where id = ''
update 表名 set 列名 = '' where id = ''
删除数据
delete from student where id = ''
delte from 表名 where 列名 = ''
插入数据
insert into student values(1, 'lili'),(2, 'lili2')
insert into 表名[属性] values('值')[,()]
去掉重复行
select distinct id, name from student
select distinct (*, 列名) from 表名