为了账号安全,请及时绑定邮箱和手机立即绑定
慕课网数字资源数据库体验端
Oracle数据库开发必备利器之SQL基础_学习笔记_慕课网
为了账号安全,请及时绑定邮箱和手机立即绑定

Oracle数据库开发必备利器之SQL基础

AnnyQin
难度入门
时长 4小时14分
  • 数据类型: 1、字符型:char(n<=2000),nchar(n<=1000),n是长度; varchar2(n<=4000),nvarchar2(n<=2000); 2、数值型:number(p,s)p是有效数字,s小数点后的位数; float(n)表示二进制数; 3、日期型:date,范围为:公元前4712年1月1日到公园9999年12月31日; timestamp,时间戳,可以精确到秒; 4、其他类型:blob存取形式为二进制类数据; clob存取形式为字符串类数据。
    查看全部
  • 表:基本存储单位,二位结构,即行(记录)和列(域和字段) 约定:1.每一列的数据必须具有相同数据类型; 2.列名唯一; 3.没一行数据的唯一性。
    查看全部
  • 系统管理员用户查看的数据字典:dba_tablespaces 普通用户查看的数据字典:user_tablespaces 查看数据字典:desc dba_tablespaces/user_tablespaces 查看表空间名字:select tablespace_name from dba_tablespaces/user_tablespaces system表空间:存储system的表、视图、存储过程等(系统表空间) sysaux:example的辅助表空间 example:事例表空间 undotbs1:存储撤销信息 temp:存储sql语句处理的表和索引信息(临时表空间) users:存储数据库用户创建的数据库对象 dba_users:系统用户 user_users:普通用户 dba_users下:查看默认/临时表空间:select default_tablespace,temporary_tablespace from dba_users where username='STSTEM'; 设置用户的默认/临时表空间:alter user username default/temporary tablespace tablespace_name
    查看全部
  • 创建表空间:create tablespace test1_tablespace datafile 'test1file.dbf' size 10m; 创建临时表空间:create temporary tablespace temptest1_tablespace tempfile 'tempfile1.dbf' size 10m; 查看:select file_name frome dba_data_files where tablespace_name='TEST1_TABLESPACE';
    查看全部
  • 永久表空间:存放数据库永久的数据(表,视图等); 临时表空间:存放数据库操作中中间执行的过程,执行结束后释放掉; undo表空间:存储数据被修改前的数据。
    查看全部
  • scott用户解锁(启用):alter user scott account unlock; 登陆scott用户:connect scott/tiger
    查看全部
  • 查看登录用户:show user(sql plus中的命令不用分号结尾,但sql语句需要用分号结尾) 数据字典dba_users是数据库提供的表,用于查看数据库的信息。 查看数据字典:desc dba_users 查看用户:select username from dba_users;
    查看全部
  • 连接语句:connect username/password as sysdba
    查看全部
  • 用户:system/sys; sysman;scott(tiger) 登陆:username/password @server as sysdba|sysoper
    查看全部
  • 删除表空间:drop tablespace tablespace_name [including contents] 只删除表空间而不删除数据文件,要删除数据文件加上including contents
    查看全部
  • 添加数据文件:alter tablespace tablespace_name add datafile 'xx.dbf' size 10m; 删除数据文件:alter tablespace tablespace_name drop datafile 'filename.dbf'; 查看:select file_name from dba_data_files where tablespace_name='xx.dbf';
    查看全部
  • 每一列数据必须具有相同的数据类型 列名唯一 每一行数据的唯一性
    查看全部
  • 删除表空间 DROP TABLESPACE tablespace_name [INCLUDING CONTENTS] --[INCLUDING CONTENTS]删除表空间的同时删除数据文件
    查看全部
  • 修改表空间中的数据文件 一、增加数据文件 alter tablespace tablespace_name add datafile 'xx.dbf' size xx; select file_name from dba_data_files where tablespace_name='表空间名称' 二、删除数据文件 alter tablespace tablespace_name drop datafile 'xx.dbf'
    查看全部
  • alter tablespace test1_space online/offline(改变表空间状态);(永久表空间) select status from dba_tablespaces where tablespace_name=“TEST1_TABLESPACE”(查询表空间的状态) alter tablespace test1_tablespace read only;(设置表空间为只读状态) select status from dba_tablespaces where tablespace_name="TEST1_TABLESPACE"(查询即为read only 默认联机状态就是读写状态_
    查看全部

举报

0/150
提交
取消
课程须知
只要知道数据库是什么就可以来学习本课程呦!
老师告诉你能学到什么?
掌握Oracle的SQL语句基础,为后续的课程学习打好基础。
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!