1、创建表空间以及为授权登陆plsql的用户和密码
1)创建表空间。在sql窗口中输入create tablespace test datafile 'D:\test.ora' size
1000m;这里的test为表空间名称,路径自己来命名。然后点执行按钮
2)执行成功后,继续创建用户。输入create user test identified by test default
tablespace test quota 500m on users; 这里第一个test为用户名,第二个test 为密码,第三个test为表空间名。然后执行。
3)成功创建用户后,进行授权。输入grant all privileges to test; 执行该语句给test
用户授权,此时test用户就可以登录了。
4)新建某个表之后,如果需要这个登陆用户对这个表进行操作,则需要授权grant SELECT ANY DICTIONARY to username
2、oracle表操作用法
1)oracle10g新增了MERGE语句,使用这个语句可以实现对表的更新或插入。语法格式:
功能:检查表XS_JSJ中的数据是否和表XS的数据相匹配,如果匹配则使用INSERT 子句执行插入数据行。
merge into studentinfo a
using student1 b
on (a.sid=b.sid)
when not matched then
INSERT VALUES
(b.sid,b.sname,b.sage);
3、查询比所有王五非学生年龄都小的所有学生信息
select t.*
from studentinfo t
where SAGESELECT SAGE
FROM studentinfo
WHERE SNAME='王五非')