数据库
Mumu2609
学习
展开
-
数据库中的键
超键可以区别表中的元组的一个属性或几个属性的集合主键超键的一种,是超键中集合最小的那个,主键不能为空外键引用其他表中的主键原创 2016-10-31 18:05:47 · 581 阅读 · 0 评论 -
数据库基础
基本数据类型 char(n) 定长字符串 varchar2(n) 变长字符串 number(m,n) 可变长的数值列 date 日期类型 表创建create table 表名(属性列) 例子:create table department (deptdept_name varchar2(20), building varchar2(15), budget number(1原创 2016-10-31 21:03:52 · 295 阅读 · 0 评论 -
字符串操作
字符串操作 percent (%). The % character matches any substring. underscore (). The character matches any character. escape character().like ‘ab\%cd%’ escape ‘\’ using “||”,连接原创 2016-10-31 21:04:55 · 232 阅读 · 0 评论 -
排序操作
排序例子:select * from instructor order by salary desc, name ascdesc降序,asc升序betweenselect name from instructor where salary between 90000 and 100000原创 2016-10-31 21:06:02 · 247 阅读 · 0 评论 -
集合操作
集合操作 交集 (select course_id from section where year = 2009) intersect (select course_id from section where year = 2010)并集 (select course_id from section where year = 2009) union (select course_id f原创 2016-10-31 21:06:35 · 230 阅读 · 0 评论 -
嵌套查询
嵌套查询 A common use of subqueries is to perform tests for set membership: in, not in set comparisons: some, all empty set: exists, not exists set containment: not exists (B except A) duplicate tuples: u原创 2016-10-31 21:25:27 · 322 阅读 · 0 评论 -
表的增删改
Deletion of tuples from a given relationExample:delete from instructor where dept_name= ’Finance’ Insertion of new tuples into a given relation Add a new tuple to course insert into course values (’CS原创 2016-10-31 21:34:50 · 311 阅读 · 0 评论 -
分组操作
分组操作 avg: average value (input: numbers) min: minimum value max: maximum value sum: sum of values (input: numbers) count: number of values Group byExample:select dept_name, avg (salary) as avg_sa原创 2016-10-31 21:07:07 · 450 阅读 · 0 评论