当前位置:网站首页>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
边栏推荐
- WebView opens H5 video and displays gray background or black triangle button. Problem solved
- Sogou cell thesaurus analysis (only extract words and word frequency)
- JVM的类加载过程
- Advanced transfer learning
- K210 serial communication
- Some records used by VS2010
- Using Visual Studio code to develop Arduino
- Use of content provider
- Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
- ESP32 LVGL8. 1 - roller rolling (roller 24)
猜你喜欢
从技术体系到商业洞察,中小研发团队架构实践之收尾篇
Chondroitin sulfate in vitreous
ESP32 LVGL8. 1. Detailed migration tutorial of m5stack + lvgl + IDF (27)
Eight bit binary multiplier VHDL
mysql_linux版本的下載及安裝詳解
Wechat video extraction and receiving file path
Practice of Druid SQL and security in meituan review
Raspberry pie uses root operation, and the graphical interface uses its own file manager
[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born
OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
随机推荐
剑指 Offer II 116. 省份数量-空间复杂度O(n),时间复杂度O(n)
About the operation of unit file reading (I)
RPM包管理
Sentinel rule persistence into Nacos
解决:cnpm : 无法加载文件 ...\cnpm.ps1,因为在此系统上禁止运行脚本
The first leg of the national tour of shengteng AI developer creation and enjoyment day was successfully held in Xi'an
C: generic reflection
mysql_linux版本的下載及安裝詳解
Esp32 (UART event) - serial port event learning (1)
Sogou cell thesaurus analysis (only extract words and word frequency)
简化路径(力扣71)
Sentinel规则持久化进Nacos
mysql通过binlog恢复或回滚数据
Résolution: cnpm: impossible de charger le fichier... Cnpm. PS1 parce que l'exécution de scripts est désactivée sur ce système
Introduction to ROS learning notes (I)
12个例子夯实promise基础
Methods of nested recycleview to solve sliding conflict and incomplete item display
特征选择feature_selection--SelectKBest
How can programmers quickly develop high-quality code?
Using Visual Studio code to develop Arduino