选择SQL query Daquan(SQL查询语句大全)

sql查询语句大全  时间:2021-02-27  阅读:()

SQL query Daquan SQL查询语句大全

SQL statement Daquan, .Txt iron rice bowl true meaning, not ina place to eat a lifetime of rice, but a lifetime towhere thereis rice to eat. It is a piece of shit, also have met shikelangday. So you don't have to worry too much about yourself today.SQL query Daquan

Statement function

1, data operation

Select --retrieve data rows and columns from a database tableInsert -- adding new data rows to a database table

Delete -- deletes rows of data from the database tableUpdate -- update the data in the database table

2, data definition

Create TABLE - create a database table

Drop TABLE -- delete tables from the database

Alter TABLE - modify the database table structure

Create VIEW - create a view

Drop VIEW -- delete views from the database

Create INDEX -- creates an index for the database tableDrop INDEX -- removes indexes from the database

Create PROCEDURE - creates a stored procedure

Drop PROCEDURE -- deletes stored procedures from the databaseCreate TRIGGER - create a trigger

Drop TRIGGER -- removes triggers from the database

Create SCHEMA -- add a new schema to the database

Drop SCHEMA -- deletes a schema from the database

Create DOMAIN - creates a data range

Alter DOMAIN - change domain definitions

Drop DOMAIN -- deletes a domain from the database

3, data control

GRANT - Grant user access rights

DENY - deny user access

REVOKE - relieves user access rights

4, transaction control

COMMIT - end the current transaction

ROLLBACK - aborts the current transaction

SET TRANSACTION- def ines the current transaction data accessfeature

5, programmed SQL

DECLARE -- sets the cursor for the query

EXPLAN -- describes data access plans for queries

OPEN -- retrieve the query results and open a cursor

FETCH -- retrieve a row of query results

CLOSE - close the cursor

PREPARE - prepares SQL statements for dynamic executionEXECUTE - dynamically executing SQL statements

DESCRIBE -- describes the prepared query

6, local variables

Declare @id char (10)

--set @id =' 10010001'

Select @id =' 10010001'

7, global variables

- must be at the beginning of @ @8, IF statement

Declare, @x, int, @y, int, @z, intSelect @x = 1, @y = 2 @z=3

If @x > @y

Print'x > Y'- print string'x > Y'Else, if, @y > @z

Print'y > z'

Else, print, ' z > Y'

9, CASE statement

Use Pangu

Update employee

Set e_wage =

Case

When job_level = ' 1' then e_wage*1.08

When job_level = '2' then e_wage*1.07

When job_level = '3' then e_wage*1.06

Else e_wage*1.05

End

10, WHILE, CONTINUE, BREAK statement

Declare, @x, int, @y, int, @c, int

Select @x = 1 @y=1

While @x < 3

Begin

Print @x -- print the value of the variable xWhile @y < 3

Begin

Select @c =100*@x+ @y

Print @c -- print the value of the variable C

Select @y = @y + 1

End

Select @x = @x + 1

Select @y = 1

End

11, WAITFOR statement

-wait for 1 hours, 2 minutes, 3 seconds to execute the Selectstatement

WAITFOR DELAY的01:02:03”

从雇员中选择*

——例等到晚上11点零8分后才执行选择语句

等待时间的23:08:00”

从雇员中选择*

12、选择语句

选择* 列名从table_name 表名在column_name算子值例 宿主

SELECT * FROM stock_information哪里StockID中= str NIDs tockname = “str_name”

s tockname像“%发现这%stockname如[A-Za-z] % ---------  [ ]指定值的范围s tockname喜欢[ ^调频] % --------- ^排除指定范围

---------只能在使用像关键字的哪里子句中使用通配符

或stockpath = “stock_path”

或sto cknumb er1000

和股票指数= 24

不stocksex = '人's tocknumber之间的20和100

在sto cknumb er 10、 20、 30

通过StockID中倒序ASC ---------排序 desc -降序 ASC升序由1,2 ---------通过列号秩序stockname = 选择从哪里stockname stock_information StockID中= 4

---------子查询

---------除非能确保内层选择只返回一个行的值

---------否则应在外层哪里子句中用一个在限定符

选择不同的c o lumn_name形式tab l e_name ---------不同指定检索独有的列值不重复

选择s tocknumber “s tocknumber + 10 + 10 = sto cknumb er从t ab l e_n ame

选择stockname “stocknumber” =数*从table_name组s tockname---------组将表按行分组指定列中有相同的值

具有计数* = 2 ---------具有选定指定的组

选择*

从表1表2

在table1. id * = tabl e2. id --------左外部连接表1中有的而表中没有得以空表示table1. id = * table2. id --------右外部连接

选择s tockname从表1

联盟[全部] -----联盟合并查询结果集全保留重复行

选择s tockname从表2

13、插入语句

插入tab l e_names toc k_names toc k_numb er值 “XXX” 、 “XXXX” 值选择stockname stocknumber从stock_tabl e2 ---价值为选择语句

14、更新语句

更新tabl e_name集stockname = “XXX” [ 3 ]在Stock ID中=s tockname =默认stockname = nulls tocknumber = st ockname + 4

15、删除语句

删除从table_name哪里StockID中= 3

截断t ab l e_n ame -----------删除表中所有行仍保持表的完整性表t ab l e_nam e---------------完全删除表

16、 ALTER TABLE *** ---修改数据库表结构

修改表database.owner。

妮妮云香港CTG云服务器1核 1G 3M19元/月

香港ctg云服务器香港ctg云服务器官网链接 点击进入妮妮云官网优惠活动 香港CTG云服务器地区CPU内存硬盘带宽IP价格购买地址香港1核1G20G3M5个19元/月点击购买香港2核2G30G5M10个40元/月点击购买香港2核2G40G5M20个450元/月点击购买香港4核4G50G6M30个80元/月点击购买香...

GigsGigsCloud 春节优惠2022 指定云服务器VPS主机85折循环优惠码

GigsGigsCloud商家在之前介绍的还是比较多的,因为之前我一直有几台机器在使用,只是最近几年网站都陆续转型删除掉不少的网站和闲置域名,包括今年也都减少网站开始转型自媒体方向。GigsGigsCloud 商家产品还是比较有特色的,有提供香港、新加坡等亚洲机房的云服务器、VPS和独立服务器等。第一、新春优惠活动优惠码:CNY2022-15OFF截止到正月初二,我们可以使用上述优惠码在购买指定G...

TTcloud:日本独立服务器促销活动,价格$70/月起,季付送10Mbps带宽

ttcloud怎么样?ttcloud是一家海外服务器厂商,运营服务器已经有10年时间,公司注册地址在香港地区,业务范围包括服务器托管,机柜托管,独立服务器等在内的多种服务。我们后台工单支持英文和中文服务。TTcloud最近推出了新上架的日本独立服务器促销活动,价格 $70/月起,季付送10Mbps带宽。也可以跟进客户的需求进行各种DIY定制。点击进入:ttcloud官方网站地址TTcloud拥有自...

sql查询语句大全为你推荐
pwPW考试是指什么arm开发板新手入门应如何选择 ARM 开发板?彩信中心移动的短信中心号码是多少开机滚动条谁会调开机的滚动条开机滚动条怎么减少开机滚动条?bt封杀北京禁用BT下载,是真的吗?为什么?分词技术怎么在SEO中学会运用关键词分词技术srv记录如何验证是否为域控制器创建了 SRV DNS 记录铁路客服中心铁路客户服务中心怎么订票微信怎么看聊天记录什么方法可以知道微信的聊天记录
cpanel php主机 谷歌香港 网站保姆 godaddy域名转出 tightvnc 建站代码 论坛空间 tna官网 万网空间购买 跟踪路由命令 万网主机管理 空间申请 国内空间 phpinfo 塔式服务器 websitepanel 美国十大啦 linux服务器系统 此网页包含的内容将不使用安全的https 更多