当前位置:网站首页>数据库基础
数据库基础
2022-07-21 05:14:00 【changtianshuiyue】
基础语法
ALTER TABLE [TABLENAME] WITH CHECK ADD FOREIGN KEY([TemplateID]) REFERENCES [REFERECETABLE]([ID]) ON DELETE CASCADE
2. 修改列
ALTER TABLE [dbo].[SaaS_Template] ALTER COLUMN [TemplateKey] nvarchar(200) NOT NULL
3. 删除约束
ALTER TABLE [dbo].[SaaS_Template] DROP CONSTRAINT XXXX
4. 判断表是否存在
if object_id(N'tablename', N'U') is not null "U" 表示用户表
5. 判断存储过程是否存在
if exists (select * from sysobjects where id = object_id('存储过程名') and OBJECTPROPERTY(id, 'IsProcedure') = 1
6. 创建带参存储过程
if (exists (select * from sys.objects where name = 'proc_name')) drop proc proc_name
go
create proc proc_name (@id, int, @name varcher(20) out)
as select * from students
7. 左外连接
select A.ID, B.ID from A LEFT JOIN B ON A.ID = B.ID
数据库完整性
数据库完整性指的是数据库中数据的正确性和相容性. 数据库中数据的语法, 语义限制与数据之间的逻辑约束称为静态约束.
包括:
属性级约束
元组约束
关系约束
关系约束包括:
实体完整性约束: 主键不能为空
参照完整性约束: 外键存在或者为空
函数依赖约束
统计约束
数据库范式
两阶段锁协议
边栏推荐
- 德国大众集团独家软件测试供应商-Parasoft
- DevStream 成为 CNCF Sandbox 项目啦!- 锣鼓喧天、鞭炮齐鸣、红旗招展、忘词了。
- Nimble development platform based on ms-rtos
- 超级详细-NMOS、PMOS的工作原理及相关内容整理(下)
- Healthcare technology innovators use polarion software to reduce test creation time by up to 75%
- Arm V7 kernel notes - General timers and related coprocessors
- Share | ISO 26262 + FMEA concepts + polarization template
- Typescript泛型
- 利用MessageBox的句柄参数实现间接禁用窗口
- 【半导体先进工艺制程技术系列】SOI技术(上)
猜你喜欢
liteos开篇
Polarion用代码的方式管理需求和测试文档
【半导体先进工艺制程技术系列】SOI技术(中)
PCB电路板和集成电路的特点与区别
智能电表MCU需求,及电表芯片厂商排名
Raspberry pie 4B three sound sensor Ao module connection and high-precision time output
整明白了--cache组成与工作原理
手把手教你如何使用Charles抓包
【半导体先进工艺制程技术系列】应变硅工艺技术
003_ SSS_ Tackling the Generative Learning Trilemma with Denoising Diffusion GANs
随机推荐
JMeter中如何实现接口之间的关联?
Swin_ Transformer_ Minivit code interpretation
物联网蓝牙模块的特点和应用领域有哪些?
浅聊Matter协议 (原CHIP协议)
超级详细-NMOS、PMOS的工作原理及相关内容整理(下)
仿照MEMZ做一个特效程序
[Semiconductor Advanced Process Technology Series] Introduction to finfet and UTB - soi
nmn与线粒体的作用,nmn线粒体对细胞作用及影响,值得关注
嵌入式开发中,嵌入式硬件和软件有什么区别?
什么是物联网控制系统?它具有哪些特点?
DevStream 成为 CNCF Sandbox 项目啦!- 锣鼓喧天、鞭炮齐鸣、红旗招展、忘词了。
海外LPWAN的王者是我,一文看懂Wi-Sun协议
医疗保健技术创新者使用 Polarion 软件将测试创建时间缩短高达 75%
Postman核心功能解析-参数化和测试报告
Li Mu's learning notes of hands-on learning in depth (7) Chapter 1 preparatory knowledge section 5 automatic derivation
利用MessageBox的句柄参数实现间接禁用窗口
Nimble development platform based on ms-rtos
头部标题小竖线制作/LOGO SEO优化
Label Embedding Online Hashing for Cross-Modal Retrieval
Healthcare technology innovators use polarion software to reduce test creation time by up to 75%