s

createtable tt (ttno number(10),ttname varchar2(10));

altertable ht add tname varchar2(10);

altertable test_table1 modify spno number(12);

altertable ht drop column tname;

createindex one_index on kt(tno);

dropindex h_index;

create orreplace view testview as select tno,sex from test_table1;

createsequence i_se increment by 1 start with 1 maxvalue 1028;

createtable ht(tno number(10) primary key);

altertable tt add primary key(ttno);

insertinto kt values(3);

insertinto test_table1 values('heery', 03,1881300646,'f');

updatetest_table1 set tno=4 where tno=1

droptable pt;

createtable yt(ytno number(10),ytname varchar2(20), ytno primary key);

altertable yt add  constraint fk_name1 foreignkey  (ytno)  references ht(tno) ;

select *from kt; select t.* from ht t;

desc pt; desctest_table1;

createtable  lp as select * from kt;

createtable ht as select * from  kt where 1=2;

rename  ht to kt;

deletefrom kt where tno=3;

delete  from kt;

spool a; spooloff;将显示的内容输出到指定文件,关闭spool输出

exit退出SQL*PLUS

desc 表名    显示表的结构

show user    显示当前连接用户

show error显示错误

show all显示所有68个系统变量值

edit打开默认编辑器,Windows系统中默认是notepad.exe,把缓冲区中最后一条SQL语句调入afiedt.buf文件中进行编辑

edit 文件名   把当前目录中指定的.sql文件调入编辑器进行编辑

clear screen清空当前屏幕显示

run,r,/ :执行当前缓冲区的命令

 

createuser test identified by test;

grantconnect,resource to test;

connecttest_view/test@ideploynoas;sql*plus中连接到指定的数据库

selectinstance_name from v$instance;

>COPY FROMSCOTT/TIGER@HQ TO JOHN/CHROME@WEST将一个数据库中的一些数据拷贝到另外一个数据库(如将一个表的数据拷贝到另一个数据库)

(l)ist显示缓冲区中所有行

(l)ist n显示缓冲区中第 n

(l)ist mn显示缓冲区中 m n

28.将执行的过程暂停,等待用户响应后继续执行

PAUSE[text]

Sql>PAUSEAdjust paper and press RETURN to continue.

274) . 显示数据库的版本:

showREL[EASE]

.将指定的信息或一个空行输出到屏幕上

PROMPT[text]

 

startfile_name /@ file_name  执行一个SQL脚本文件

executeprocedure_name(参数1,参数2)

 

有几种情况:
1.
删除非空约束(not null)
alter table
表名 modify 列名 null;
2.
删除check约束(check)
alter table 表名  drop constraint 约束名;
3.
删除主键及外键约束(primary key(pk) and foreign key(fk))

altertable TEST_CCCC  drop constraint 键名 cascade;
4.
删除唯一索引(unique)
drop index
索引名;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值