oracle-----sql--建表

来源:互联网 发布:windows抄袭mac os 编辑:程序博客网 时间:2024/05/04 09:05
file-user
create user by   identified by"123456";//创建用户
drop user tom//删除用户


Columns
id   char(4)
name  varchar2(100)
height  number(3)

birthday date/timestamp
photo  clob//字节型超大的  blob//字符节超大的



--创建表     --注释
create table student
(
    id char(4) not null,
    name varchar2(100) not null,
    height number(3),
    birthday  date
    sex  char(1)   null   --性别不能用boolean型
);
--删除表
drop table student;
sqlplus exam/password--链接   cmd
点击齿轮--创建成功
--crud
--查询语句
select*from student;--选中执行的语句点击此轮(到红毛看结果)
--修改
update student set height=height+5;
--删除
delete from student where id='0001';
--创建
insert into student values('0001','tom',200,to_date('1998-1-1','yyyy-MM-dd'));
insert into student(name,id) value('mary','0003');
--sql     ddl数据定义语言  dml数据操做语言 dcl数据控制语言
--管理员要做的事情
--表空间
creat tablespace exam_tbs
datefile 'D:'size 5 m reuse autoextend on maxsize,
    'D:'size 5 m reuse autoextend on
drop tablespace exam_tbs;   --drop删除表空间(文件不会删掉)
drop tablespace exam_tbs including contents  --删除表空间(包含内容)
--用户管理
create user exam identified by password default tablespace exam_;
drop user;--删除
drop user casecade--删除所有
--授权
grant create session to exam;
grant connect to exam;
grant resource to exam;
--收回权限
revoke create seeion from exam;
revoke resource from exam;
revoke connect from exam;

0 0