当前位置:网站首页>SQL常用的命令
SQL常用的命令
2022-04-23 19:06:00 【游戏编程】
目录
首先选择database
USE DatabaseName;
| 关于table | 代码 |
| 创建table | create table xx(); |
| 复制table | create table xx1 like xx; |
| 更改table名 | rename table xx to xx2; |
建立table的写法
CREATE TABLE lesson (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(32) default '',
views int(11) NOT NULL default '0',
created_at DATETIME,
PRIMARY KEY (id,name)
FOREIGN KEY () REFERENCES XX()
);
| alter | code |
| 删除 | ALTER TABLE xx DROP COLUMN c |
| 增加 | ALTER TABLE xx ADD COLUMN c a varchar(50) |
| 更名 | ALTER TABLE xx CHANGE COLUMN c C |
| 改属性 | ALTER TABLR xx CHANGE COLUMN c c age int() |
| 增加primary key | ALTER TABLE xx ADD CONSTRAINT 约束名 PRIMARY KEY |
| 删除primary key | ALTER TABLE xx DROP primary key |
给tablle 添加数据
查询数据
duplicate问题
| 地点table/column | column数据处理 | 排序 | 自定义table | 数据属性 | |
|---|---|---|---|---|---|
| 代码 | where | avg,count | oder by(desc,asc | as | null |
| in | like | some(select ...) | exist | ||
| from | distinct xx/unique(select) | all(select..) | |||
| with | having(group by) | group by | |||
| between and |
以用select必定忽略null值
distinct & unique
选择问题
使用where
使用like
使用in来执行多表查询
as用法做多表查询
some & as互换
用很多个=做多表查询
order by
集合表现
avg,count
group by
having
exits
作者:DendenTaytay
游戏编程 ️,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
版权声明
本文为[游戏编程]所创,转载请带上原文链接,感谢
https://www.233tw.com/database/118807
边栏推荐
- Practice of Druid SQL and security in meituan review
- 2022.04.23(LC_763_划分字母区间)
- 解决:cnpm : 無法加載文件 ...\cnpm.ps1,因為在此系統上禁止運行脚本
- Deeply understand what new and make in golang are and what are the differences?
- 開關電源設計分享及電源設計技巧圖解
- [today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born
- Esp01s with Arduino development environment
- Raspberry pie uses root operation, and the graphical interface uses its own file manager
- Introduction to ROS learning notes (II)
- MySQL学习第五弹——事务及其操作特性详解
猜你喜欢

Druid SQL和Security在美团点评的实践

Simplified path (force buckle 71)

ESP32 LVGL8. 1 - input devices (input devices 18)
![[record] typeerror: this getOptions is not a function](/img/c9/0d92891b6beec3d6085bd3da516f00.png)
[record] typeerror: this getOptions is not a function

Practice of Druid SQL and security in meituan review

Chondroitin sulfate in vitreous

Switching power supply design sharing and power supply design skills diagram

Eight bit binary multiplier VHDL

The difference between ordinary inner class and static inner class

MySQL学习第五弹——事务及其操作特性详解
随机推荐
Esp32 drive encoder -- siq-02fvs3 (vscade + IDF)
SSDB基础1
Summary of actual business optimization scheme - main directory - continuous update
微搭低代码零基础入门课(第三课)
FTP、ssh远程访问及控制
Deeply understand what new and make in golang are and what are the differences?
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
[mathematical modeling] - analytic hierarchy process (AHP)
程序员如何快速开发高质量的代码?
ESP32 LVGL8. 1 - slider slider (slider 22)
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
Seata处理分布式事务
Scrollto and scrollby
Nacos as service registry
static类变量快速入门
该买什么设备,Keysight 给你挑好了
FTP, SSH Remote Access and control
Nacos cluster construction and MySQL persistence configuration
An 8266 crash
[advanced level 11 of C language -- character and string functions and their simulation implementation (2)]