Home Database Mysql Tutorial Oracle笔记:基本SQL语句

Oracle笔记:基本SQL语句

Jun 07, 2016 pm 05:11 PM
data

延续之前安装好的oracle11g R2,这里使用putty这个工具登陆linux系统,putty的好处就在于可以随意在linux和windows直接复制粘贴,

延续之前安装好的Oracle11g R2(见  ),这里使用putty这个工具登陆linux系统,putty的好处就在于可以随意在linux和windows直接复制粘贴,而且互相拷贝文件也非常方便!这里注意要用oracle用户登陆才能正常登陆oracle!

系统登陆成功后访问数据库,使用oracle自带的用户名system登陆,如下图所示:

clip_image002

以下用表tableA来举一个例子 

1、创建表

create table 表名( 字段名A 字符类型, 字段名B 字符类型);

create table tableA (id integer,name varchar(25),age number);

2、删除表

drop table 表名;

drop table tableA;

clip_image004

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’);

clip_image006

4、添加字段

ALTER TABLE 表名 ADD 字段名 字符类型;

alter table tableA add native varchar(20);

clip_image008

5、删除字段

ALTER TABLE 表名 DROP COLUMN 字段名;

alter table tableA drop column native;

clip_image010

6、修改记录

Update 表名 set 字段名A=’记录C’ where 字段名B=’记录B’;

update tableA set age=’23’ where name=’Jack’;

clip_image012

7、删除记录

Delete from 表名 where 字段名A=’记录A’;

delete from tableA where name=’Jack’

clip_image014

8、查询记录

select 字段名 from 表名 where 字段名='记录A’;

select name from tableA where age=’24’;

clip_image016

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Use ddrescue to recover data on Linux Use ddrescue to recover data on Linux Mar 20, 2024 pm 01:37 PM

Use ddrescue to recover data on Linux

Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Apr 03, 2024 pm 12:04 PM

Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation!

How to use Excel filter function with multiple conditions How to use Excel filter function with multiple conditions Feb 26, 2024 am 10:19 AM

How to use Excel filter function with multiple conditions

Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Apr 01, 2024 pm 07:46 PM

Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training

The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks Apr 29, 2024 pm 06:55 PM

The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks

Slow Cellular Data Internet Speeds on iPhone: Fixes Slow Cellular Data Internet Speeds on iPhone: Fixes May 03, 2024 pm 09:01 PM

Slow Cellular Data Internet Speeds on iPhone: Fixes

The U.S. Air Force showcases its first AI fighter jet with high profile! The minister personally conducted the test drive without interfering during the whole process, and 100,000 lines of code were tested for 21 times. The U.S. Air Force showcases its first AI fighter jet with high profile! The minister personally conducted the test drive without interfering during the whole process, and 100,000 lines of code were tested for 21 times. May 07, 2024 pm 05:00 PM

The U.S. Air Force showcases its first AI fighter jet with high profile! The minister personally conducted the test drive without interfering during the whole process, and 100,000 lines of code were tested for 21 times.

The first robot to autonomously complete human tasks appears, with five fingers that are flexible and fast, and large models support virtual space training The first robot to autonomously complete human tasks appears, with five fingers that are flexible and fast, and large models support virtual space training Mar 11, 2024 pm 12:10 PM

The first robot to autonomously complete human tasks appears, with five fingers that are flexible and fast, and large models support virtual space training

See all articles