政林 2020-01-02 1285浏览 1条评论
分享到: / / / /

-- 创建用户表
create table  user1
(id number(5) primary key ,
username varchar2(10),
password varchar2(10),
rid number(10));

create table student(sid number(10)  primary key,
stu_name varchar2(20),
sex number(10),
age number(10),
cid number(10),
birthday date,
photo_name varchar2(2000),
photo_path varchar2(2000) 

create table clazz(
cid number(10) primary key,
clazz_name varchar2(1000)

drop table if exists bonus;

insert into clazz(clazz_name) values(1,'一年级');
insert into clazz(cid,clazz_name) values(2,'一年级');
insert into clazz(cid,clazz_name) values(3,'一年级');
insert into clazz(cid,clazz_name) values(4,'四年级');
insert into clazz(clazz_name) values('71年级');

update clazz set cid=6 where cid=68;

delete from clazz where cid=4;

select * from clazz;


create sequence cid_sequence  
      minvalue     1  
      start with   1  
      increment by 1  
      nocycle  ;
create trigger cid_table_trigger before insert on clazz for each row when(new.cid is null)  
    select cid_sequence.nextval into:new.cid from dual;  
drop trigger sid_student_trigger;
 -- 分页
  select * from (select c.*,rownum-1 rid from clazz c) where rid >=2 and rid <= 3 ;

select count(1) from clazz;
--最大值   平均值   最小值
select max(cid),avg(cid),min(cid) from clazz;

insert into student (stu_name,sex,age,cid) values ('张三2',1,20,2);
insert into student (stu_name,sex,age,cid) values ('张三3',1,20,2);
insert into student (stu_name,sex,age,cid) values ('张三4',1,20,2);

select * from student s;

select s.stu_name,c.clazz_name 
from student s,clazz c 
where s.cid=c.cid;

update student set cid=1 where sid=1;
update student set cid=3 where sid=3;

select count(*),cid from student group by cid;

select index_name, table_name, column_name from user_ind_columns where table_name='student' 

/*mysql  oracle区别:
1.分页      mysql:limit             oracle: rownum
2.自增      mysql:auto_increment    oracle:自增序
3.数据类型  mysql:int   varchar     oracle:number varchar2 blob
4.非空验证  mysql:!=""  null        oracle:is not null    没有""
5.分组      mysql:group             oracle:select column group by column
6.别名      mysql:as  空格          oracle:as  报错       空格ok
7.用户      mysql:root              oracle:scott
              mysql:mysqladmin -u root -p old password "new";
              oracle:alter user user_name identified by new_password
9.存在判断: mysql:if exists        oracle:没有

alter user scott identified by scott;

net start OracleServiceORCL

net start OracleServiceORCL

最后修改:2020-01-02 21:45:00 © 著作权归作者所有




匿名用户 2022-11-26 16:25:40
The Commission found that Complainant engaged in protected activity when she requested reasonable accommodation in the form of leave due to her inability to work on one day, and she was subjected to adverse treatment when she was given leave without pay instead of the annual leave she requested <a href=>buying cialis online usa</a> Immune Cell Infiltrates May Portend Better Prognosis Across Several Tumor Types