当前位置:网站首页>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
边栏推荐
- Seata handles distributed transactions
- Yyds dry goods inventory stringprep --- Internet string preparation
- 七、DOM(下) - 章节课后练习题及答案
- Recyclerview control list item layout match_ Fundamental principle of parent attribute invalidation
- 微搭低代码零基础入门课(第三课)
- About the operation of unit file reading (I)
- c1000k TCP 连接上限测试1
- SSDB基础1
- Using bafayun to control the computer
- 从技术体系到商业洞察,中小研发团队架构实践之收尾篇
猜你喜欢
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
Esp32 (UART 485 communication) - 485 communication of serial port (3)
mysql_linux版本的下载及安装详解
Esp01s with Arduino development environment
JVM的类加载过程
binlog2sql 工具安装使用及问题汇总
MySQL restores or rolls back data through binlog
[advanced level 11 of C language -- character and string functions and their simulation implementation (2)]
ESP32 LVGL8. 1 - arc (arc 19)
【科普】CRC校验(一)什么是CRC校验?
随机推荐
2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)
微搭低代码零基础入门课(第三课)
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
SSDB基础1
机器学习理论基础篇--关于机器学习的一些术语
Redis common interview questions
RPM package management
After opening the original normal project, the dependency package displays red and does not exist.
redis优化系列(三)解决主从配置后的常见问题
Minesweeping II of souI instance
Class loading process of JVM
One of the reasons why the WebView web page cannot be opened (and some WebView problem records encountered by myself)
SSDB基础
MySQL Téléchargement et installation de la version Linux
Practice of Druid SQL and security in meituan review
Implementation of TCP UDP communication with golang language
mysql_linux版本的下载及安装详解
MySQL学习第五弹——事务及其操作特性详解
WebView saves the last browsing location
ESP32 LVGL8. 1 - slider slider (slider 22)