![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据库
Mumu2609
学习
展开
-
数据库中的键
超键可以区别表中的元组的一个属性或几个属性的集合主键超键的一种,是超键中集合最小的那个,主键不能为空外键引用其他表中的主键原创 2016-10-31 18:05:47 · 588 阅读 · 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 · 297 阅读 · 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 · 240 阅读 · 0 评论 -
排序操作
排序例子:select * from instructororder by salary desc, name ascdesc降序,asc升序betweenselect namefrom instructorwhere salary between 90000 and 100000原创 2016-10-31 21:06:02 · 251 阅读 · 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 · 232 阅读 · 0 评论 -
嵌套查询
嵌套查询A common use of subqueries is to perform tests for set membership: in, not inset comparisons: some, allempty set: exists, not existsset containment: not exists (B except A)duplicate tuples: u原创 2016-10-31 21:25:27 · 325 阅读 · 0 评论 -
表的增删改
Deletion of tuples from a given relationExample:delete from instructorwhere dept_name= ’Finance’Insertion of new tuples into a given relationAdd a new tuple to courseinsert into coursevalues (’CS原创 2016-10-31 21:34:50 · 314 阅读 · 0 评论 -
分组操作
分组操作avg: average value (input: numbers)min: minimum value max: maximum valuesum: sum of values (input: numbers)count: number of valuesGroup byExample:select dept_name, avg (salary) as avg_sa原创 2016-10-31 21:07:07 · 453 阅读 · 0 评论