简单的数据表操作
--创建一个简单的表student
create table student(stuid number(8),
stuname varchar2(20),
stuphone varchar2(12)
);
--插入新记录
insert into student (stuid,stuname,stuphone) values(1,'lisi','888888');-- 完全插入 包括所有字段名insert into student values(2,'zhangsan','888888'); -- 完全插入 省略所有字段名
insert into student (stuid,stuname) values(3,'wangwu'); --部分插入 不可省略字段名
--修改表中数据
update student set stuname='lili' where stuid=1; --修改表中stuid为1的stuname为lili;
--删除表中数据
delete student where stuid=3; --删除一条记录 删除stuid为3的记录
delete student; --删除表中所有记录 注意的是表结构还在。
--查看表结构
select * from student; --查看表中所有记录及表结构
--删除表
drop table student; --删除表中的数据及表结构 用该关键字删除,那么该表在数据库中就不存在了。