CREATE TABLESPACE my_tabs2
DATAFILE 'd:/software/Oracle/Space/my_tabs2.dbf' size 60M
AUTOEXTEND ON NEXT 30M MAXSIZE UNLIMITED;
create user user2
identified by user2
default tablespace my_tabs2
create user user1
identified by user1
default tablespace my_tabs2
grant connect,resource to user2;
revoke connect,resource from use2;
alter user user2 IDENTIfiEd by use231;
ALTER USER system ACCOUNT LOCK;
ALTER USER system ACCOUNT UNLOCK;
DROP USER user1;
CREATE TABLE student(
nol NUMBER,
sname VARCHAR(100)
)
insert into student values(1,1);
select s.* from student s;
select s.* from QQUser s;
alter table student drop column nol;
create table QQUser(
QQID number ,
QPassWord char(10) ,
ListLogWordTime date ,
QOnline number(2),
QLevel number(2)
)
alter table QQUser alter column QQID Number(10);
insert into QQUser values(123456,1,null,2,99);
insert into QQUser values(123456,1,null,2,99);
select * from QQUser ;
rename 表一 to 表二
truncate table user
alter table QQUser add sex char(2)
alter table QQUser modify sex varchar(2)
alter table QQUser drop column sex;
alter table QQUser add constraint QQName varchar(100);
alter table QQUser add constraint QQName unique(QQName);
alter table QQUser add constraint QQid primary key(QQID);
select session_id from v$locked_object;
SELECT sid, serial
ALTER SYSTEM KILL SESSION '132,170';
alter table QQUser add QQage number(3);
alter table QQUser add constraint QQage check(QQage between 10 and 40);
select length(QQName), QQname from QQUser;
alter table QQUser add constraint QQname check(length(QQName)>=2);
select * from QQUser where QQname like '%%';
select * from QQUser where QQID like '1%';
create table A (
anumber int primary key ,
aname char(11) unique ,
bnumber int
);
create table B (
Bnumber int primary key ,
bname varchar(11),
anumber int,
constraint a_b foreign key(bnumber) references B(bnumber)
);
alter table B add constraint B_A foreign key(bnumber) references A(anumber);