当前位置:网站首页>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
边栏推荐
- MySQL学习第五弹——事务及其操作特性详解
- Using Visual Studio code to develop Arduino
- Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
- An 8266 crash
- c1000k TCP 连接上限测试
- Class loading process of JVM
- Methods of nested recycleview to solve sliding conflict and incomplete item display
- Practice of Druid SQL and security in meituan review
- c1000k TCP 连接上限测试1
- Esp32 (UART event) - serial port event learning (1)
猜你喜欢
[advanced level 11 of C language -- character and string functions and their simulation implementation (2)]
The first leg of the national tour of shengteng AI developer creation and enjoyment day was successfully held in Xi'an
ESP32 LVGL8. 1 - textarea text area (textarea 26)
Eight bit binary multiplier VHDL
FTP、ssh远程访问及控制
[mathematical modeling] - analytic hierarchy process (AHP)
Introduction to micro build low code zero Foundation (lesson 3)
解决:cnpm : 無法加載文件 ...\cnpm.ps1,因為在此系統上禁止運行脚本
Esp32 (UART 485 communication) - 485 communication of serial port (3)
ESP32 LVGL8. 1. Detailed migration tutorial of m5stack + lvgl + IDF (27)
随机推荐
Druid SQL和Security在美团点评的实践
FTP, SSH Remote Access and control
MySQL Téléchargement et installation de la version Linux
Actual combat of Nacos as service configuration center
Simple use of viewbinding
Disable Ctrl + Alt + Del
该买什么设备,Keysight 给你挑好了
实战业务优化方案总结---主目录---持续更新
Using bafayun to control the computer
特征选择feature_selection--SelectKBest
Esp32 (UART event) - serial port event learning (1)
2022.04.23(LC_763_划分字母区间)
Golang 语言实现TCP UDP通信
Nacos作为服务注册中心
JVM的类加载过程
ESP32 LVGL8. 1 - img picture (IMG 20)
How about CICC wealth? Is it safe to open an account up there
Circuit on-line simulation
12个例子夯实promise基础
高层次人才一站式服务平台开发 人才综合服务平台系统