一、添加数据
INSERT语句 INSERT INTO table_name(字段的名字,字段的名字)VALUES(VALUE1,VALUE2)
1.向表中所有字段添加值
INSERT INTO userinfo
VALUES (1,‘xxx‘,‘123‘,‘[email protected]‘,sysdate)
2.向表中制定的字段添加值
INSERT INTO userinfo(id,username,userpwd)
VALUES(2,‘yyy‘,‘123‘)
create table userinfo1
(id number(6,0),
regdate date default sysdate
)
insert into userinfo1(id)
values(1)
二、复制表数据
1.创建表时全部复制
CREATE TABLE userinfo_new
as
select*from userinfo
2.创建表时选择复制
CREATE TABLE userinfo_new1
as
select id,username from userinfo
3.再添加时全部复制
INSERT INTO userinfo_new
select*from userinfo
4.选择复制
INSERT INTO userinfo_new(id,username)
select id,username from userinfo
三、修改数据
1.无条件更新
UPDATE userinfo
SET userpwd=‘111‘
UPDATE userinfo
SET userpwd=‘1‘ ,email=‘[email protected]‘
2.有条件更新
UPDATE userinfo
set userpwd=‘123‘
where username=‘xxx‘
3.无条件删除
create table testd1
as
select*from userinfo
DELETE FROM testd1
4.有条件删除
delete from userinfo
where username=‘yyy‘