Oracle笔记(二)基本SQL语句
2012-01-15 10:13
811 查看
延续之前安装好的oracle11g R2,这里使用putty这个工具登陆linux系统,putty的好处就在于可以随意在linux和windows直接复制粘贴,而且互相拷贝文件也非常方便!这里注意要用oracle用户登陆才能正常登陆oracle!
系统登陆成功后访问数据库,使用oracle自带的用户名system登陆,如下图所示:
以下用表tableA来举一个例子
1、创建表
create table 表名( 字段名A 字符类型, 字段名B 字符类型);
create table tableA (id integer,name varchar(25),age number);
2、删除表
drop table 表名;
drop table tableA;
3、添加记录
insert into 表名 values(‘记录A’,’记录B’,’记录C’);
或 insert into 表名(字段名A,字段名C) values(‘记录A’,’记录C’);
insert into tableA values(‘101’,’Jack’,’25’);
或 insert into tableA (id,name,age) values (‘101’,‘Jack’,’25’);
4、添加字段
ALTER TABLE 表名 ADD 字段名 字符类型;
alter table tableA add native varchar(20);
5、删除字段
ALTER TABLE 表名 DROP COLUMN 字段名;
alter table tableA drop column native;
6、修改记录
Update 表名 set 字段名A=’记录C’ where 字段名B=’记录B’;
update tableA set age=’23’ where name=’Jack’;
7、删除记录
Delete from 表名 where 字段名A=’记录A’;
delete from tableA where name=’Jack’
8、查询记录
select 字段名 from 表名 where 字段名='记录A’;
select name from tableA where age=’24’;
系统登陆成功后访问数据库,使用oracle自带的用户名system登陆,如下图所示:
以下用表tableA来举一个例子
1、创建表
create table 表名( 字段名A 字符类型, 字段名B 字符类型);
create table tableA (id integer,name varchar(25),age number);
2、删除表
drop table 表名;
drop table tableA;
3、添加记录
insert into 表名 values(‘记录A’,’记录B’,’记录C’);
或 insert into 表名(字段名A,字段名C) values(‘记录A’,’记录C’);
insert into tableA values(‘101’,’Jack’,’25’);
或 insert into tableA (id,name,age) values (‘101’,‘Jack’,’25’);
4、添加字段
ALTER TABLE 表名 ADD 字段名 字符类型;
alter table tableA add native varchar(20);
5、删除字段
ALTER TABLE 表名 DROP COLUMN 字段名;
alter table tableA drop column native;
6、修改记录
Update 表名 set 字段名A=’记录C’ where 字段名B=’记录B’;
update tableA set age=’23’ where name=’Jack’;
7、删除记录
Delete from 表名 where 字段名A=’记录A’;
delete from tableA where name=’Jack’
8、查询记录
select 字段名 from 表名 where 字段名='记录A’;
select name from tableA where age=’24’;
相关文章推荐
- 【Oracle】SQL学习笔记1---基本概念及SELECT语句及提取和排序数据
- Oracle Database SQL Language Reference 笔记(4)—— SQL语句基本元素
- 自己初学数据库的笔记(oracle为主) (附带在网上看到的一个对SQL语句的小结见附件)
- oracle心得1--oracle简介@基本sql语句@条件查询@排序数据理论与案例
- 四、oracle基本sql语句和函数详解
- Related to Oracle SQL 关于优化,SQL语句的共享[笔记]
- Oracle中5个核心Sql语句的基本构造:Select、Insert、Update、Delete和Merge
- oracle学习笔记(一)------oracle基础知识和基本sql语句
- 【笔记】Oracle 数据库编程 - 基本语句总结
- Oracle学习之路(一):oracle简介+基本sql语句+条件查询+排序数据理论与案例
- Day57-Oracle01 - oracle体系结构、sql语句分类和结构、基本查询、函数入门
- Oracle SQL Plus 的基本操作 - Oracle 学习笔记 1
- oracle 有用的SQL语句与oracle的 基本命令
- oracle笔记2--基本sql操作
- 【笔记】Oracle SQL语句 | 进阶篇
- oracle笔记一(sql语句方面)
- oracle基本sql语句和函数详解
- Day30 Oracle基础1 数据库安装与入门 基本SQL语句
- Oracle-基本SQL语句
- Oracle的小笔记,模糊处理人名,电话,地址之类字段数据时可以使用的SQL语句