当前位置:网站首页>Common SQL commands
Common SQL commands
2022-04-23 19:09:00 【Game programming】
Catalog
First choose database
USE DatabaseName;
About table | Code |
establish table | create table xx(); |
Copy table | create table xx1 like xx; |
change table name | rename table xx to xx2; |
establish table Writing
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 |
Delete | ALTER TABLE xx DROP COLUMN c |
increase | ALTER TABLE xx ADD COLUMN c a varchar(50) |
renamed | ALTER TABLE xx CHANGE COLUMN c C |
Change properties | ALTER TABLR xx CHANGE COLUMN c c age int() |
increase primary key | ALTER TABLE xx ADD CONSTRAINT Constraint name PRIMARY KEY |
Delete primary key | ALTER TABLE xx DROP primary key |
to tablle Add data
Query data
duplicate problem
place table/column | column Data processing | Sort | Customize table | Data attribute | |
---|---|---|---|---|---|
Code | 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 |
For select Must ignore null value
distinct & unique
Choice problem
Use where
Use like
Use in To execute multi table queries
as Usage: multi table query
some & as swap
Use many = Do multi table query
order by
Set performance
avg,count
group by
having
exits
author :DendenTaytay
Game programming ️, A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome Kernel browser .
版权声明
本文为[Game programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231906382002.html
边栏推荐
- SSDB foundation 2
- Esp32 drive encoder -- siq-02fvs3 (vscade + IDF)
- Esp32 (UART event) - serial port event learning (1)
- Convert string to JSON
- 2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)
- 该买什么设备,Keysight 给你挑好了
- Get a list of recent apps
- Codeforces Round #784 (Div. 4)
- SSDB foundation 1
- 7、 DOM (Part 2) - chapter after class exercises and answers
猜你喜欢
ESP32 LVGL8. 1 - msgbox message box (msgbox 28)
Simplified path (force buckle 71)
Oracle configuration st_ geometry
mysql通过binlog恢复或回滚数据
浅谈c语言指针的强制转换
Switching power supply design sharing and power supply design skills diagram
为何PostgreSQL即将超越SQL Server?
One of the reasons why the WebView web page cannot be opened (and some WebView problem records encountered by myself)
FTP, SSH Remote Access and control
mysql_ Download and installation of Linux version
随机推荐
Scrollto and scrollby
js 计算时间差
Actual combat of Nacos as service configuration center
OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
The difference between ordinary inner class and static inner class
Switching power supply design sharing and power supply design skills diagram
開關電源設計分享及電源設計技巧圖解
Tencent cloud GPU best practices - remote development training using jupyter pycharm
Simple use of navigation in jetpack
Using 8266 as serial port debugging tool
std::stoi stol stoul stoll stof stod
Openharmony open source developer growth plan, looking for new open source forces that change the world!
The corresponding permissions required to automatically open the app in the setting interface through accessibility service
[advanced level 11 of C language -- character and string functions and their simulation implementation (2)]
Get a list of recent apps
Sentinel service fusing practice (sentinel integration ribbon + openfeign + fallback)
js获取本机ip地址
c1000k TCP 连接上限测试1
binlog2sql 工具安装使用及问题汇总
Simplified path (force buckle 71)