表管理
来源:互联网 发布:淘宝首页装修要多少钱 编辑:程序博客网 时间:2024/05/22 00:54
第三章 Oracle 表管理复习
一数据类型
字符类型:char,varchar2, long
数值型:number(3),number(5,2)
日期型:date 19-9月-16,timestamp
Lob数据类型:blob,clob,bFile
Rowid数据类型
二表管理
l 表的创建
Stu:id,name,age
Create table stu (id number(5),name varchar2(20), agenumber(3));
快速复制一张表,复制emp
Create table emp1 as select * from emp;//在scott用户下
Create table emp1 as select * from scott.emp; //不在scott用户下
l 修改表
1. 添加一列
Alter table stu add(telnumber(11));
2. 修改字段的长度,类型
Alter table stu modify(telnumber(10));
3. 修改字段名字 tel———》phone
Alter table stu rename columntel to phone;
4. 删除字段
Alter table stu drop columnphone;
5. 修改表名
Alter table stu rename to stu2;
Rename stu to stu2;(建议用这种方式)
6. 删除表
Drop table stu2;
l 数据库表的增删改查
1. 添加数据 insert into
Insert into stu values(1001, ‘ada’,18);
Insert into stu(id,name) values(1002, ‘ada2’);
Insert into stu(id,name,age) values(1003, ‘ada2’,null);
2. 查询数据 select
Select * from stu;
Select * from stu where name=’ada’;
Select name,age from stu;
Select * from stu where age is null;(查询空数据)
3.更新数据 update
Updatestu set age=20 where id=1001;
Updatestu set age=21,name=’tina’ where id=1002;
4. 删除数据 delete
Delete from stu where id=1001;
Delete from stu;(删除表中所有数据,可以找回数据)
Truncate table stu;(删除表中所有数据,不可以找回数据)
l 数据库约束
非空约束 not null
主键约束 primary key
唯一键约束 unique
外键约束 foreign key
- oracl--表管理,约束管理,序列管理
- 表管理
- 管理表
- 表管理
- 管理表
- 管理表
- 表管理
- 管理表
- 表空间管理,段管理
- 表空间管理方式 本地化管理VS字典管理(旧)
- 本地管理和字典管理-表空间
- OCP复习 - 管理(11) - 管理表存储空间
- ZStack API ----邦定表管理 & 组表管理
- 【自动化管理】自动维护管理表空间
- Oracle管理常用对象之管理表
- 数据库管理 -- 管理表空间和数据文件
- MySql数据库入门、数据库管理、表管理
- mysql 管理数据库和管理表笔记
- qbxt国庆水题记day3
- oracle用户管理
- 在Studio中运用HttpClient时报错可能原因
- 支持多位数,括号,四则运算,的计算器算法c++实现
- 国庆假期总结
- 表管理
- 转圈的箭头
- 310. Minimum Height Trees
- 请求网络数据
- 系统服务的控制
- python IDLE自定义背景配置、字体
- C++中引用(&)的用法和应用实例-- Mr.xu
- 表查询
- bzoj4563: [Haoi2016]放棋子