初学常用命令(二)

插入多条记录:

insert into student(stu_id,stu_name) select id,name from stu;

添加字段

alter table student add bith varchar2(10);

创建序列

create sequence seq_name

start with 1

increment by 

使用序列

insert into student values(seq_stuid.nextval,321602302,'小二','男',20,89,sysdate);

创建一个表并从另一个表中插入记录

 create table stu2 as select stu_id,stu_num from student;

创建一张表并从另一张表插入表结构

 create table stu3 as select stu_id,stu_num from student where 1=2;

设置表字段为空

update student set stu_sex='';

查询为空的记录

select * from student where stu_age is null;

查询不为空的记录

select  stu_name from student where stu_age is not null;

链接查询结果并制定别名:

select firstname ||'.'|| lastname as 姓名
  from xingming;

显示固定行数记录:

select firstname,lastname
  from xingming
  where rownum<2;

连接两张表的记录不去重复

select firstname ||':'|| lastname as 姓名1
from xingming1 union all
select firstname ||':'|| lastname as 姓名1
from xingming2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值