ORCL-主线1-SQL-DDL语言

SQL-DDL语言

  • Create,创建表结构
create table TABLENAME
(
	col1  dataType [not null],
	col2  dataType [not null],
	col3  dataType [not null],
	col4  dataType [not null],
	col5  dataType [not null],
	col6  dataType [not null],
	.....

)

示例:


  • alter和drop,修改和删除表的机构
-- 增加表的字段
alter table tname add(col1 datatype)
-- 删除表字段
alter table tname drop column colName
-- 修改字段名称
alter table tname rename column to newName
-- 修改字段的数据类型
alter table tname modify column dataType
-- 修改表名
rename oldTname to newName
-- 删除表结构
drop table tname
-- 查看表结构
desc tname
  • Truncate:清空表中所有数据
-- 清空表中所有数据
truncate table tname;

DML语言

  • insert:向表中插入记录
-- 插入记录
insert into tname(col1,col2...) values(val1,val2....)
列名可省略,但是其后的值必须一一对应
  • delete:删除记录
-- 删除表中所有记录(可回滚)
delete [from] tname;
-- 删除指定条件的数据
delete [from] tname where 条件
  • update:用来更新数据
update tname set col1=val1[,col2=val2] [where 条件]

DQL语言

select :查询数据(必须基于一张表)

需日后多加练习。

相关材料:

ORACLE语句编写

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值