Oracle作业练习题

 

 第一问

//登陆scott用户

//解锁
alter user scott account unlock;

//给用户申请密码
alter user scott identified by tiger;

//连接
conn scott/tiger;
//创建student表 
create table student
    (
    sno char(10) not null,
    sname varchar(8) ,
    sex char(2) default '男' check(sex='男' or sex='女'),
    birthday date,
    sdept char(20),
    Constraint stu_pk primary key (sno)
  );
//创建Courser表 
create table course(
    eno char(10) primary key,
    ename char(30) Constraint cname_UK unique,
    ccredit number(3),
   );

 

//创建score表 
create table score(
    sno char(10) not null,
    cno char(10) not null,
    grade number(3) check(grade>0 and grade < 100),
    Constraint sco_pk primary key(sno,cno)
   );

 第二问

alter table student add(memo varchar2(200));


alter table student modify memo varchar2(300);

//查看表
desc student;


alter table student drop(memo);

//查看表
desc student;

 

posted @ 2018-11-26 22:05  峰寒  阅读(383)  评论(0编辑  收藏  举报