当前位置:网站首页>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
边栏推荐
- 【C语言进阶11——字符和字符串函数及其模拟实现(2))】
- ESP32 LVGL8. 1 - checkbox (checkbox 23)
- Go 语言 GUI 框架 fyne 中文乱码或者不显示的问题
- RPM包管理
- 【历史上的今天】4 月 23 日:YouTube 上传第一个视频;网易云音乐正式上线;数字音频播放器的发明者出生
- Nacos as service registry
- 12 examples to consolidate promise Foundation
- 2022.04.23 (lc_763_divided into letter interval)
- MySQL restores or rolls back data through binlog
- FTP, SSH Remote Access and control
猜你喜欢

Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)

Installation, use and problem summary of binlog2sql tool

開關電源設計分享及電源設計技巧圖解

FTP、ssh远程访问及控制

Esp32 (UART ecoh) - serial port echo worm learning (2)

binlog2sql 工具安装使用及问题汇总

Switching power supply design sharing and power supply design skills diagram

Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique

从技术体系到商业洞察,中小研发团队架构实践之收尾篇

C: generic reflection
随机推荐
迁移学习进阶
网络协议之:sctp流控制传输协议
ESP32 LVGL8. 1 - calendar (calendar 25)
: app: transformclasseswithrobustfordevrease meituan hot repair compilation error record
12 examples to consolidate promise Foundation
Practice of Druid SQL and security in meituan review
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
mysql_linux版本的下载及安装详解
WebView opens H5 video and displays gray background or black triangle button. Problem solved
机器学习理论基础篇--关于机器学习的一些术语
2022.04.23(LC_714_买卖股票的最佳时机含手续费)
redis优化系列(三)解决主从配置后的常见问题
MySQL Téléchargement et installation de la version Linux
mysql_linux版本的下載及安裝詳解
RPM包管理
Minesweeping II of souI instance
Download xshell 6 and xftp6 official websites
Methods of nested recycleview to solve sliding conflict and incomplete item display
Simple use of viewbinding
An 8266 crash