当前位置:网站首页>SQL学习笔记(01)——数据库基本知识
SQL学习笔记(01)——数据库基本知识
2022-07-01 09:21:00 【雨轩GodLike】
一、什么是数据库技术
- 科学的组织和存储数据,高效的获取和处理数据
- SQL语言结构化查询语言(增删改查)
二、数据库的基本架构
数据(data)
定义:对客观事物的符号表示,如图形符号,数字,字母等等。数据是数据库存储的基本对象。数据库 database (DB)
定义:长期存储在计算机内,有组织,可共享的数据集合。数据库管理系统(DBMS)
数据库的定义功能:DDL语言(数据库定义语言),提供了三个语句:create(创建),alter(修改),drop (删除),操作的对象是数据库中的基本架构----表。
数据库的操作功能:DML语言(数据库操作语言),实现对数据库中存储的数据进行增删改查的操作( insert , delete , update , select )
数据库的保护功能:保护数据的完整性和安全性
数据库的维护功能:数据库中表结构和数据的维护功能
- 数据库系统(DBS)
数据库系统(DBS)= 数据库(DB)+ 数据库管理系统(DBMS)+ 应用系统 + 数据库管理员(DBA)+ 用户
数据库系统经历的三个阶段:
网状数据库 | 层次数据库 | 关系数据库 | |
---|---|---|---|
数据组织方式 | 网状模型 | 树状模型 | 关系模型 |
架构 | 图形结构 | 树形结构 | 表 |
三、数据库三大范式
1.第一范式
如果关系R的所有属性是简单属性:每个属性都不可再分,则称R满足第一范式,其实就是没有重复的列。表1
不满足第一范式。
表2
为满足第一范式要求,但数据冗余过大,需要借助第二范式。
2.第二范式
如果关系R先满足第一范式,非主键字段完全依赖于主键,则称R满足第二范式。
例:
有一个快递单号表,若同一个人同时发送了多个快递,这样的话发送人姓名都是重复的,就会造成数据冗余,这时我们应该把拆分开来。如表3
订单表:
姓名编号表:
表4和表5为拆分后的两个表,满足第二范式要求。
3.第三范式
如果关系R满足第二范式,非键字段之间不存在任何的依赖关系,即任何字段不能由其他字段派生出来,它要求字段没有冗余,则称R满足第三范式。
一个基本的关系型数据中要满足第一范式,一个完整的关系型数据库要满足第三范式。
四、SQL语句的分类
1.DQL数据查询语言: select 语句
2.DML数据操作语言: insert update delete 语句
3.DDL数据定义语言: create alter drop 语句
4.DCL数据控制语言: 授权grant 收权revoke
5.TCL事务控制语言: commit 提交 rollback 回滚或者撤销 savepoint 设置保存点
边栏推荐
猜你喜欢
Jetson nano installs tensorflow GPU and problem solving
Error org apache. catalina. core. StandardContext. FilterStart start filter exception
Implementation and application of queue
Daily practice of C language - day 80: currency change
Problems caused by delete and delete[]
【pytorch】nn. Crossentropyloss() and nn NLLLoss()
Which method is good for the management of fixed assets of small and medium-sized enterprises?
Simple load balancing with Nacos
JS原型链
[pytorch] softmax function
随机推荐
钓鱼识别app
Jetson nano installs tensorflow GPU and problem solving
队列的实现和应用
树结构---二叉树1
NiO zero copy
A 419 error occurred in the laravel postman submission form. July 6th, 2020 diary.
[ESP nanny level tutorial] crazy completion chapter - Case: gy906 infrared temperature measurement access card swiping system based on the Internet of things
Daily practice of C language - day 80: currency change
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + DS18B20 temperature sensor +nodejs local service + MySQL database
Ranking list of domestic databases in February, 2022: oceanbase regained the "three consecutive increases", and gaussdb is expected to achieve the largest increase this month
Differences between JS valueof and toString
Redis -- lattice connects to redis cluster
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + MQ Series + nodejs local service + MySQL storage
Exception handling of classes in C #
Log4j 日志框架
Imitation of Baidu search results top navigation bar effect
Tree structure -- binary tree 2 non recursive traversal
JS functionarguments object
Mysql 优化
Preparing for the Blue Bridge Cup -- bit operation