当前位置:网站首页>MySQL statement
MySQL statement
2022-07-24 07:28:00 【A little dish for learning programming】
What is? sql sentence
Structured query language , Is a special purpose programming language , For storing data and querying , Update and manage relational database system , It is also the extension of database script file .
frequently-used sql sentence
DDL( Data definition language )
Create a library create database Library name ;
Show all libraries show databases;
Delete a library drop database Library name ;
Use the library use Library name ;
Build table create table Table name ( Field name type attribute , Field name type attribute );
View all the tables in the library show tables;
View table structure desc Table name ;
View table structure show create table Table name ;
Delete table drop table Table name ;
Modify the name of the table alter table The old name of the table rename as The new name of the table ;
Modify fields alter table Table name modify Field name New data types New type length New default New notes ;
Add fields alter table Table name add Field name data type Type length The default value is notes ;
Modify fields alter table Table name change Old field name new field name
Delete field alter table Table name drop Field name
DML( Data operation language )
Add data insert into Table name ( Field name , Field name ... Field name )values ( value , value ... value );
Add multiple pieces of data at one time insert into Table name ( Field name , Field name )values( value , value ),( value , value );
Modifying data update Table name set Field name = value , Field name = value ...where Clause
Delete data delete from Table name where Clause
Delete all data in the table delete from Table name
Clear the table truncate Table name
DQL( Data control statement )
Inquire about select Field name ... Field name from Table name
Remove duplication select distinct Field name from Table name
The field is aliased select Field name as Alias from Table name
Conditions of the query select Field name from Table name where Clause
grouping group by
Conditions of the query having( Query with conditions after grouping )
Sort order by (desc Descending asc Ascending )
Pagination limit[n,m] n( The current page number -1)* Page capacity m Page capacity
Fuzzy query like (% Any number of any characters ) (_ An arbitrary character )
Find in a specific range in
Non equivalent associated query select * from Table name , Table name
Equivalent joint query select * from Table name 1, Table name 2 where surface 1. Field = surface 2. Field
Inline query select * from surface 1 inner join surface 2 on surface 1. Field = surface 2. Field
Outreach query ( Left query ) select * from surface 1( Main table )left join surface 2 on surface 1. Field = surface 2. Field
Outreach query ( Right query ) select * from surface 1 fight join surface 2( Main table ) on surface 1. Field = surface 2. Field
Merging and removing weights select Field name , Field name from Table name 1 union select Field name , Field name form Table name 2( When the number of columns of two tables queried is not equal , Will report a mistake )
Merge without redoing select Field name , Field name from Table name 1 union all select Field name , Field name form Table name 2
边栏推荐
- System integration project management engineer (soft test intermediate) key knowledge, recitation version
- My creation anniversary
- SPI - send 16 bit and 8-bit data
- Riotboard development board series notes (IX) -- buildreoot porting matchbox
- Unity中使用深度和法线纹理
- Harbor2.2 quick check of user role permissions
- Raspberry pie change source
- 周杰伦直播超654万人观看,总互动量破4.5亿,助力快手再破纪录
- Bookkeeping app: xiaoha bookkeeping 2 - production of registration page
- UNI-APP_小程序或h5页面背景音乐的播放与暂停
猜你喜欢

Deep learning two or three things - review those classical convolutional neural networks

单场GMV翻了100倍,冷门品牌崛起背后的“通用法则”是什么?

Compilation and debugging (GCC, g++, GDB)

SPI - send 16 bit and 8-bit data

Unity中使用深度和法线纹理

Decompress the anchor and enjoy 4000w+ playback, adding a new wind to the Kwai food track?

JS_实现多行文本根据换行分隔成数组

项目上线就炸,这谁受得了

论文阅读:HarDNet: A Low Memory Traffic Network

QoS服务质量四QoS边界行为之流量监管
随机推荐
Development system selection route
Write three piece chess in C language
24. Global event bus
项目中数据库插入大批量数据遇到的问题
【HiFlow】腾讯云HiFlow场景连接器实现校园信息管理智能化
Three implementation methods of single sign on
系统集成项目管理工程师(软考中级)重点知识、背诵版
Raspberry pie change source
C语言文件操作
23.组件自定义事件
Buffer overflow vulnerability of network security module B in national vocational college skills competition
The goal you specified requires a project to execute but there is no POM in this directory
The shortest distance of Y axis of 2D plane polyline
numpy.inf
R语言手写数字识别
剑指offer专项突击版第8天
开发系统选择路线
Learning strategies of 2D target detection overview (final chapter)
mysql查询当前节点的所有父级
归纳、概括、演绎