当前位置:网站首页>sql语句
sql语句
2022-07-15 19:34:00 【ssh04223】
基础
创建数据库
CREATE DATABASE database-name
删除数据库
drop database dbname
备份sql server
创建 备份数据的 device
USE master EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'开始 备份
BACKUP DATABASE pubs TO testBack
创建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
根据已有的表创建新表:
A:create table tab_new like tab_old (使用旧表创建新表)
B:create table tab_new as select col1,col2… from tab_old definition only
删除新表
drop table tabname
增加一个列
Alter table tabname add column col type
注:列增加后将不能删除。DB2中列加上后数据类型也不能改变,唯一能改变的是增加varchar类型的长度。
添加主键
Alter table tabname add primary key(col)
删除主键
Alter table tabname drop primary key(col)
创建索引
create [unique] index idxname on tabname(col….)
删除索引
drop index idxname
注:索引是不可更改的,想更改必须删除重新建。
创建视图
create view viewname as select statement
删除视图
drop view viewname边栏推荐
- 脚本编写规则和变量定义
- Codeforces Global Round 21 D. Permutation Graph
- 开机按F11 选择 one-shot再选U盘启动
- 408天勤第八章排序课内代码合集
- Win10定时运行程序
- 要想不踩SaaS那些坑,得先了解“SaaS架构”
- 我国数据安全治理研究
- Grow up Summer Challenge | learn / create from the boss, and get CSDN gift bag, exclusive certificate of honor, commemorative T-shirt and medal!
- AIRIOT答疑第4期|如何使用數據分析引擎?
- 网络空间资产探测关键技术研究
猜你喜欢

Codeforces Round #802 B. Palindromic Numbers

ACL 2022 | 基于阅读理解的论点对抽取

腾势全新豪华中大型MPV曝光,安全、舒适一个不落

openGauss 联合产业界创新,共建开源数据库根社区

开机按F11 选择 one-shot再选U盘启动

助力品牌洞察——消费者情绪行为分析

7-Redis架构设计到使用场景-缓存穿透、缓存雪崩、缓存预热、缓存降级

【开源可信隐私计算框架 “隐语”】蚂蚁宣布面向全球开发者正式开源

Scenarios that must be considered when designing a stable microservice system

Codeforces Global Round 21 D. Permutation Graph
随机推荐
QT make color selection control
4-Redis架构设计到使用场景-string、list、set、zset、hash使用场景
func(){}() 一种奇怪的写法,不知道属于什么范畴
Is it safe for Huatai Securities to open an account online and what materials are needed
美国对人脸识别技术的法律规制及启示
好玩的ping命令
Analyzing the starting point of modern maker Education
小目标检测2_OHEM
Research on data security governance in China
Analysis of quantum secure communication
小目标检测1_Focal loss
5个时间序列预测的深度学习模型对比总结:从模拟统计模型到可以预训练的无监督模型
Modify WiFi for Xiaomi camera
User login and registration function with verification code
Win11系统保护怎么关闭?Win11系统保护关闭方法
Legal regulation and Enlightenment of face recognition technology in the United States
idea 新建项目时克隆仓库代码
求助,更新到思源 v2.0.27,dark+ 主题自适应宽度问题
Codeforces Round #804 C The Third Problem
SQL也能玩转AI ?没错!MLOps Meetup V3 回顾|OpenMLBD+SQLFlow+Byzer