当前位置:网站首页>SQL quick query
SQL quick query
2020-11-08 16:57:00 【Irving the procedural ape】
1、 explain : Create database CREATE DATABASE database-name2、 explain : Delete database drop database dbname3、 explain : Backup sql server--- establish Backup data deviceUSE masterEXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'--- Start Backup BACKUP DATABASE pubs T
- relational database , Based on the relational model , Use relationship ( surface ) Store the data , At the same time, the integrity constraint is defined . Common relational database systems include :Oracle、MySQL/MariaDB、SQL Server、PostgreSQL wait .
- SQL, Structured query language , Standard language for accessing and manipulating relational databases .SQL It's declarative , Is a set oriented programming language .
1、 Single table query
SELECT col1, col2 AS c2 -- Column alias FROM t; -- The basic query SELECT * FROM t; -- Query all fields SELECT col1, col2, … FROM t WHERE conditions; -- Filter conditions SELECT col1, col2, … FROM t ORDER BY col1 ASC, col2 DESC; -- Sort SELECT col1, col2, … FROM t ORDER BY col1 ASC, col2 DESC OFFSET m ROWS FETCH FIRST n ROWS ONLY; -- Limit the number of LIMIT n OFFSET m; -- Non standard implementation SELECT col1, col2, agg_fun() -- Aggregate functions FROM t GROUP BY col1, col2 -- Group summary HAVING conditions; -- Filter after grouping
2、 Multiple table joins
SELECT t1.col1, t2.col2, … FROM t1 INNER JOIN t2 ON conditions; -- Internal connection SELECT t1.col1, t2.col2, … FROM t1 LEFT JOIN t2 ON conditions; -- Left connection SELECT t1.col1, t2.col2, … FROM t1 RIGHT JOIN t2 ON conditions; -- The right connection SELECT t1.col1, t2.col2, … FROM t1 FULL JOIN t2 ON conditions; -- Full connection SELECT t1.col1, t2.col2, … FROM t1 CROSS JOIN t2 ON conditions;-- Cross connect SELECT a.col1, b.col2, … FROM t1 a -- Table alias JOIN t1 b ON conditions; -- Self join
3、 Set operations
SELECT col1, col2, … FROM t1 UNION [ALL]SELECT c1, c2, … FROM t2; -.........
版权声明
本文为[Irving the procedural ape]所创,转载请带上原文链接,感谢
边栏推荐
- 习题五
- Talk about go code coverage technology and best practices
- 性能压测时,并发压力增加,系统响应时间和吞吐量如何变化
- 佛萨奇forsage以太坊智能合约是什么?以太坊全球滑落是怎么回事
- PHP generates unique strings
- 构建者模式(Builder pattern)
- Framework - SPI four modes + general device driver implementation - source code
- Interesting article sharing: what is the difference between C language and C + +, C?
- 契约式设计(Dbc)以及其在C语言中的应用
- Use markdown
猜你喜欢

IT行业薪资一直遥遥领先!十年后的程序员,是否还是一个高薪职业?

Dev-c++在windows环境下无法debug(调试)的解决方案

Five phases of API life cycle

11 important operations of Python list

Function classification big PK! How to use sigmoid and softmax respectively?

Tips and skills of CSP examination

How to make a correct summary for 7 years?
![[open source]. Net uses ORM to access Huawei gaussdb database](/img/f8/50715c25a9d49b010cba2ff442c04e.jpg)
[open source]. Net uses ORM to access Huawei gaussdb database

基于阿里云日志服务快速打造简版业务监控看板

Learn to record and analyze
随机推荐
Dev-c++在windows环境下无法debug(调试)的解决方案
Improvement of rate limit for laravel8 update
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
jsliang 求职系列 - 07 - Promise
laravel8更新之速率限制改进
京东落地DevOps平台时爆发的冲突如何解决?
Liteos message queuing actual combat
When to write disk IO after one byte of write file
How much faster is a server equipped with a SSD than a mechanical hard disk
Recurrence of Apache kylin Remote Code Execution Vulnerability (cve-2020-1956)
Arduino ide build esp8266 development environment, slow file download solution | esp-01 make WiFi switch tutorial, transform dormitory lights
The birth of a new integrated memory and computing chip is conducive to the application of artificial intelligence~
使用K3S创建本地开发集群
总结: 10月海外DeFi新项目,更多资管策略来了!
Function classification big PK! How to use sigmoid and softmax respectively?
Mac环境安装Composer
第五章编程题
Talk about go code coverage technology and best practices
Summary of rendering of water wave and caustics (etching) in webgl
Examples of unconventional aggregation