orcale 基本语句
来源:互联网 发布:知乎 父母的爱 编辑:程序博客网 时间:2024/05/17 22:40
---ddl
create table
student(sno char(6), sname varchar(10), sex char(6), birthday date, dno char(6));
alter table student add (address varchar2(20));
alter table student modify(address varchar2(50));
alter table student rename to stu;
select * from cat;
alter table stu rename to student
alter table student rename column address to familyaddress
select * from student
alter table student rename column familyaddress to address
alter table student add(ilovelx varchar2(10) );
select * from student
alter table student drop(ilovelx)
---试一下modify 可以用来改变列的类型,,也可以用来给类添加主键约束吗
--结果是可以的!!
alter table student modify(sno char(6) constraint pk_student_sno primary key);
select * from student
---oracle中日期的表达方式 dd-mon-yy 而且月份后面还得带一个月: 10-5月-1991
insert into student values('s01','lx','man','10-5月-1991','d01','buqingchu','iloveu');
insert into student values('s02','lx','man','10-5月-1991','d01','buqingchu','iloveu');
create table dep (dno char(6) constraint pk_dep_dno primary key ,dname varchar2(20),tel varchar2(10));
drop table dep
alter table dep modify (tel varchar2(20));
---下面两个语句一起执行的时候 前一条语句要以;结束
insert into dep values('s01','计算机','010-58789657');
insert into dep values('s02','外语','010-58789657');
select * from dep
select * from student
delete from student
----modify可以给列添加主键约束,那么可以给列添加外键约束吗?
alter table student modify(dno char(6) constraint fk_student_dno references dep(dno));
---scott 用户的下的模型 表
select * from emp
select ename, sal*12 年工资,sysdate 日期 from emp
select * from emp order by sal desc
--order by 默认是asc
select * from emp where comm is null order by sal
--order by 默认是asc 日期在前面的小
select * from emp where comm is not null order by hiredate
--连接操作
select * from emp, dept where emp.deptno=dept.deptno order by dept.deptno desc,emp.hiredate ,emp.sal desc
--连接操作 列 冠以表 别名
select e.empno,e.ename,e.job,e.hiredate from emp e,dept d
where e.deptno=d.deptno order by d.deptno desc,e.hiredate ,e.sal desc
-------------like '%%'
select * from student
insert into student(sno,sname) values('111','ss_s')
insert into student(sno,sname) values('110','a_b')
select * from student where sname like '%\_s%'
select * from student where sname like '%a_b%' ESCAPE '\';
- orcale 基本语句
- orcale 基本语句2
- orcale数据库基本查询语句(SQL)
- [Orcale] select语句
- Orcale SQL语句开发
- orcale用户操作语句
- Orcale sql语句
- orcale 常用DDL 语句
- orcale 常用功能语句
- Orcale笔记-select语句(二)
- orcale数据库常用查询语句
- Orcale一些语句解答(1)
- orcale之查询语句1
- orcale PL/SQL管理命令语句
- 很多数据进行筛选 orcale 语句
- orcale数据库的简单操作语句
- ORCALE
- orcale
- ubuntu环境下配置tomcat7.0.40环境
- oracle 基本语句
- select:windows pipe的模拟
- div+css基础——1.页面全局属性设置
- 数据库(1)
- orcale 基本语句
- 中语言版 linux操作系统项目正在筹备
- Java 各进制间的转换
- POJ--3386--Frequent values--RMQ
- Hibernate 异常org.hibernate.LazyInitializationException: could not initialize proxy - no Session
- C/C++中static关键字详解
- [Bluetooth] Android Framework BluetoothA2dpService
- mongodb 无法启动的时候
- div+css基础——2.网页宽度和居中设置