惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
The Register - Security
The Register - Security
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
P
Proofpoint News Feed
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
The Last Watchdog
The Last Watchdog
F
Fortinet All Blogs
S
Schneier on Security
Help Net Security
Help Net Security
Security Archives - TechRepublic
Security Archives - TechRepublic
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
I
InfoQ
T
The Blog of Author Tim Ferriss
Cisco Talos Blog
Cisco Talos Blog
Stack Overflow Blog
Stack Overflow Blog
T
Troy Hunt's Blog
人人都是产品经理
人人都是产品经理
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cyber Attacks, Cyber Crime and Cyber Security
雷峰网
雷峰网
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
Forbes - Security
Forbes - Security
Vercel News
Vercel News
S
Security Affairs
美团技术团队
P
Privacy & Cybersecurity Law Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Spread Privacy
Spread Privacy
Attack and Defense Labs
Attack and Defense Labs
IT之家
IT之家
U
Unit 42
Recorded Future
Recorded Future
W
WeLiveSecurity
PCI Perspectives
PCI Perspectives
P
Palo Alto Networks Blog
H
Hacker News: Front Page
S
Security @ Cisco Blogs
博客园 - 【当耐特】

博客园 - ゛無磿頭.㊣

Linux学习笔记 关于判定表拆分合并的分析 第6章 运行维护——DBA的日常工作 第5章 智能管理——用好集成管理环境 我的中国心 TestLink1.7.4_Released完整安装方法(Windows篇) 如何从一名测试员转型为管理人员 合格的测试人员应具备的性格条件 标准测试用例的几点要素 通过GreenAMP架设BUGFREE后的端口修改 Bugfree管理员使用指南 微软公司软件测试简介 杂谈,工作日志 Bugfree缺陷管理使用指南 四款主流测试工具的测试流程 关于WAP测试方法的演讲胶片 读书笔记总结更新目录 第3章 管理入门——数据库服务器的管理 第2章 构建环境——安装Oracle 9i
第4章 数据库利器——SQL
゛無磿頭.㊣ · 2008-01-06 · via 博客园 - ゛無磿頭.㊣

第4章    数据库利器——SQL

4.1、       SQL有哪些特点,SQL的用途有哪些?

解答:SQL语言简单易学、风格统一,可以利用简单的几个英语单词的组合就可以完成所有的功能。它可以不加修改的嵌入到前端开发平台上,利用前端开发平台的计算能力和SQL的数据库操作能力,可以快速的建立数据库应用程序。

4.2、       Oracle 9i中,SQL如何访问数据表?

解答:标准格式是按照“用户名.数据表”的形式进行访问的,但通常可以简化为直接查询数据表的形式访问。

4.3、       SQL语句进行单表查询

解答:单表查询是相对于多表查询而言的,指从一个数据表中查询数据。

²         查询所有记录

语法:Select * From 用户名.数据表 (这里的“*”代表数据表中的所有字段)

²         查询所有记录的某些字段

语法:Select 字段名1,字段名2…. From 用户名.数据表 (注意这里的字段名之间的逗号是英文状态下的逗号)

²         查询某些字段不同记录

语法:Select distinct 字段名 From 用户名.数据表 (这里的保留字“distinct”指的是在显示时除去相同的记录,与之对应的是“all”,默认为“all”)

²         单查询条件

语法:Select 字段名 From 用户名.数据表 Where 字段名 比较运算符 ‘字符串’ (“字符串”的值为数字型时不需要加单引号,如是字符型则要加单引号。)

单查询条件使用的比较运算符如表

名称

实例

=(等于)

Select * from scott.emp where job = ‘MANAGER’

Select * from scott.emp where sal = 1100

!=(不等于)

Select * from scott.emp where job != ‘MANAGER’

Select * from scott.emp where sal != 1100

^=(不等于)

Select * from scott.emp where job ^= ‘MANAGER’

Select * from scott.emp where sal ^= 1100

<>(不等于)

Select * from scott.emp where job <> ‘MANAGER’

Select * from scott.emp where sal <> 1100

<(小于)

Select * from scott.emp where job < ‘MANAGER’

Select * from scott.emp where sal < 1100

>(大于)

Select * from scott.emp where job > ‘MANAGER’

Select * from scott.emp where sal > 1100

<=(小于等于)

Select * from scott.emp where job <= ‘MANAGER’

Select * from scott.emp where sal <= 1100

>=(大于等于)

Select * from scott.emp where job = ‘MANAGER’

Select * from scott.emp where sal = 1100

in(列表)

Select * from scott.emp where job in (‘MANAGER’, ‘CLERK’)

Select * from scott.emp where sal in (2000, 3000)

not in(不在列表)

Select * from scott.emp where job not in (‘MANAGER’, ‘CLERK’)

Select * from scott.emp where sal not in (2000, 3000)

between(介于之间)

Select * from scott.emp where job between ‘MANAGER’ and ‘CLERK’

Select * from scott.emp where sal between 2000 and 3000

not between(不介于之间)

Select * from scott.emp where job not between ‘MANAGER’ and ‘CLERK’

Select * from scott.emp where sal not between 2000 and 3000

like(模式匹配)

Select * from scott.emp where job like ‘M%’

Select * from scott.emp where job like ‘M_’

not like(模式不匹配)

Select * from scott.emp where job not like ‘M%’

Select * from scott.emp where job not like ‘M_’

is null(为空)

Select * from scott.emp where job is null

Select * from scott.emp where sal is null

is not null(不为空)

Select * from scott.emp where job is not null

Select * from scott.emp where sal is not null

(“like”和“not like”适合字符型字段的查询,%表示任意长度的字符串,_下划线表示一个任意的字符。like ’m%’表示以m开头的任意长度的字符串,like ‘m_’表示以m开头的长度为1的字符)

²         组合条件的查询

语法:Select 字段名 From 用户名.数据表

Where 字段名1 比较运算符 ‘字符串1逻辑比较符 字段名2 比较运算符 ‘字符串2

名称

实例

and(逻辑与)

Select * from scott.emp where job = ‘MANAGER’ and sal = 1100

or(逻辑或)

Select * from scott.emp where job = ‘MANAGER’ or sal = 1100

not(逻辑非)

Select * from scott.emp where not job = ‘MANAGER’

                   not job = ‘MANAGER’ 等价于 job <> ‘MANAGER’

²         排序查询

语法:Select 字段名 From 用户名.数据表 Where 字段名 比较运算符 ‘字符串’Order by 字段名 排序关键词 Order by可以指定查询结果如何排序,asc表示升序排序,desc表示降序排序,多个排序字段之间用逗号分割。若有where查询条件,order by要放在where语句后面。)