??接下来,我们在SQL*Plus中实战一下,为我们下面将要做的打好基础。 ??用system登陆到SQL*Plus后,我们做如下操作(这次没有截图,有具体的说明) ??SQL>create user maxuan identified by max; #创建口令为max的用户maxuan ??SQL>grant connect,resource to maxuan; #为用户maxuan授权 ??SQL>conn maxuan/max; #以用户maxuan进行连接 ??L>create table test(a number); #建立一个名为test的表,只有字段名为A的一列,数据类型为数字 ??SQL>insert into test values(1); #插入一条记录 ??SQL>select * from test; #查询记录,此时A列的第一行为1 ??SQL>update test set a=2; #更改记录,此时A列的第一行已改为2 ??SQL>commit; #提交 ??SQL>delete from test; #删除test表中所有的记录,此时test表中没有记录 ??SQL>roll; #回滚到提交前,此时再查询test表,A列第一行值又回复到2
rem ///BY MAXUAN 开始/// create table item( type_id integer not null, type varchar2(30), constraint item_pk primary key(type_id) );
create table product( product_id integer not null, title varchar2(30) not null, type_id integer not null, info varchar2(80), price number(16,2) not null, constraint product_pk primary key (product_id), constraint product_fk foreign key(type_id) references item(type_id) );
create table orders( order_id integer not null, name varchar2(20) not null, address varchar2(100), tel number(16), email varchar2(30) not null, btime date, product_id integer not null, uword varchar2(100), constraint orders_pk primary key(order_id), constraint orders_fk foreign key(product_id) references product(product_id) );
create table admin( admin_id integer not null, adminname varchar2(20) not null, password varchar2(20) not null, constraint admin_pk primary key(admin_id) );
create sequence type_id increment by 1 start with 1; create sequence product_id increment by 1 start with 1; create sequence order_id increment by 1 start with 1; create sequence admin_id increment by 1 start with 1;