摘要:
安装# yuminstallpostgresqlpostgresql-libs postgresql-server[root@dev~]#servicepostgresqlstatuspostmasterisstopped[root@dev~]#servicepostgresqlstartInitializingdatabase:[OK]Startingpostgresqlservice:[OK]设为开机启动[root@dev~]#chkconfigpostgresqlon[root@dev~]#chkconfig--listpostgresqlpostgresql0:off1:off2:on 阅读全文
随笔分类 - 数据库
视图
2009-07-25 18:06 by htc开发, 113 阅读, 收藏,
摘要:
一.建立视图例1.建立信息系学生的视图create view IS_Studentasselect Sno,Sname,Sagefrom tab_Studentwhere Sdept='IS'例2.查询视图IS_Student中的所有学生select * from IS_Student二.对视图的操作可以像操作基本表一样操作视图如:查询,更新 阅读全文
数据更新
2009-07-25 18:06 by htc开发, 112 阅读, 收藏,
摘要:
一.数据插入数据插入有两种方式:1.插入一条数据2.插入子查询例题1插入一个学生数据insert into tab_Studentvalues('200215128','陈冬','男',18,'IS')注意:插入数据的顺序与建立表时的顺序一样,不然系统会拒绝插入数据如果选择这种方式插入数据,顺序可以不一样insert into tab_Student(Sno,Sname,Sdept,Ssex,Sage)values('200215128','陈冬','IS','男', 阅读全文
集合查询
2009-07-25 18:05 by htc开发, 159 阅读, 收藏,
摘要:
集合查询例题48查询计算机专业的学生和年龄不大于19岁的学生 unionselect * from tab_Student where Sdept='CS'unionselect * from tab_Studentwhere Sage<=19例题49查询选修了课程1或者选修了课程2的学生信息 unionselect * from tab_Studentwhere exists (select * from tab_SC where Sno=tab_Student.Sno and Cno=1)unionselect * from tab_Studentwhere exis 阅读全文
存储控制
2009-07-25 18:04 by htc开发, 139 阅读, 收藏,
摘要:
1.自由存取控制方法一.权限授予拥有权限授予能力的人可以数据库拥有者,表的创建者,还可以是具有授权能力的被授权者例题1把查询tab_Student的权限授给用户u1grant select on tab_Studentto u1;注:标准SQL语句按照规则应该这样写grant selecton table tab_Studentto u1;在MS SQL SERVER中稍有不同例题2把对表SC的查询权限授予给所有用户grant selecton SCto public;二.授予权限给其他用户的用户可以收回给与的权限通过revoke语句例题8收回给与u1对表tab_Student的select权 阅读全文
浙公网安备 33010602011771号