偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

SQL條件語(yǔ)句實(shí)例

數(shù)據(jù)庫(kù) SQL Server
下面為您舉例說(shuō)明SQL條件語(yǔ)句的用法,供您參考。SQL條件語(yǔ)句是SQL語(yǔ)句中最常見的語(yǔ)句,如果您對(duì)SQL語(yǔ)句感興趣的話,不妨一看。

在SQL語(yǔ)句中,SQL條件語(yǔ)句無(wú)疑是使用最廣,最常見的SQL語(yǔ)句之一,下面就將為您介紹幾個(gè)使用SQL條件語(yǔ)句,供您學(xué)習(xí)參考。

----查詢StudentMarks 最大的前三條記錄

select  top 3 StudentID,StudentName,Mark from StudentMarks order by Mark desc

----查詢StudentMarks 的第30~40條記錄

1、從前30條的后面, 取前10條

select top 10 * from StudentMarks where StudentID not in(select top 30 StudentID from StudentMarks)

2、先正序取40條, 再反序取10條

select top 10* from (select top 40* from StudentMarks order by Mark ) a
order by Mark desc

3、、利用臨時(shí)表
select top 40 * into #Stm from StudentMarks order by Mark

select top * from #Stm  order by Mark desc

----查詢和London同屬于一個(gè)國(guó)家的城市的客戶
select distinct * from customers where country in
( select country from customers where city='London')

----查詢和London,Paris同屬于一個(gè)國(guó)家的城市的客戶
select * from customers where country in
(select country from Customers where City in ('London','Paris'))

----查詢單價(jià)大于Dofu的產(chǎn)品名
select ProductName from Products where UnitPrice>
(select UnitPrice from Products where ProductName='Tofu')

 

 

 

【編輯推薦】
SQL整體更新的方法

逐條更新數(shù)據(jù)的SQL語(yǔ)句寫法

教您如何進(jìn)行SQL跨表更新

SQL中IS NULL的語(yǔ)法

SQL中if語(yǔ)句的用法示例

責(zé)任編輯:段燃 來(lái)源: 博客園
相關(guān)推薦

2010-09-26 10:08:43

sql條件語(yǔ)句

2010-09-13 17:11:42

sql server

2010-10-21 14:27:35

SQL Server時(shí)

2010-09-09 16:34:19

SQL循環(huán)while

2010-09-25 16:42:45

sql語(yǔ)句

2010-09-10 14:33:32

SQL循環(huán)語(yǔ)句

2010-09-07 14:56:49

SQL語(yǔ)句CASE WHEN

2010-09-03 14:56:12

SQLSELECT語(yǔ)句

2010-09-07 10:56:58

SQL語(yǔ)句

2011-08-18 14:25:26

OracleEXPLAIN PLA

2010-11-18 12:58:25

Oracle條件分支語(yǔ)

2024-10-05 00:00:10

SQL語(yǔ)句指定連接條

2010-07-16 08:47:53

Perl if語(yǔ)句

2010-10-22 11:47:30

sql server存

2009-09-15 09:45:23

Linq動(dòng)態(tài)條件

2010-05-18 09:02:55

MySQL條件查詢

2023-06-11 17:25:13

Rust條件語(yǔ)句

2021-07-21 10:18:21

Python條件語(yǔ)句Python基礎(chǔ)

2022-07-04 08:51:43

條件語(yǔ)句JavaScript

2010-11-24 17:36:02

MySQL條件查詢語(yǔ)句
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)