📄 t_sql.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>Transact-SQL </title>
<meta name="generator" content="Namo WebEditor v3.0">
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p align="center" style="line-height:130%;"><font size="5"><b>Transact-SQL </b></font></p>
<p style="line-height:130%;"><font size="2" color="navy"><b>SQL</b></font><font
size="2"> : ANSI ( American National Standard Institute )俊辑 瘤沥茄 RDBMS甫
力绢窍扁 困茄 钎霖 攫绢.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"><b>Transact-SQL</b></font><font
size="2"> : ANSI SQL俊 MS SQL 辑滚父狼 眠啊利牢 扁瓷 眠啊.</font></p>
<p style="line-height:130%;"><b>SQL巩狼 辆幅</b>
<ol style="line-height:130%;">
<li style="line-height:130%;"><font size="2"> Data Control
Language(DCL) : GRANT, REVOKE, DENY</font>
<li style="line-height:130%;"><font size="2"> Data Definition
Language(DDL) : CREATE, ALTER, DROP</font>
<li style="line-height:130%;"><font size="2"> Data Manipulation
Language(DML) : SELECT, INSERT, DELETE, UPDATE</font>
</ol>
<p style="line-height:130%;"> </p>
<p align="left" style="line-height:130%;"><font size="4"><b>I. SELECT
(单捞鸥 啊廉坷扁)</b></font></p>
<ul>
<p style="line-height:130%;"><font size="2">SELECT 巩篮 单捞磐甫 努扼捞攫飘俊霸
焊咯林扁 困秦 荤侩登哥 老馆利栏肺 抛捞喉俊辑 单捞磐甫 啊廉坷扁 困秦 荤侩窍绰
疙飞绢肺 促剧茄 炼扒阑 烹秦辑 荤侩磊啊 盔窍绰 抛捞喉狼 拿烦苞 饭内靛甫 急琶秦辑
阂矾棵 荐 乐促.</font></p>
</ul>
<p style="line-height:130%;"><font size="2"> </font><font size="2"
color="red"><b>Syntax </b></font><font size="2"><b>SELECT</b></font><font
size="2"> select_list </font><font size="2"><b>FROM</b></font><font
size="2"> table_name [ </font><font size="2"><b>WHERE</b></font><font
size="2"> search_conditions ]</font></p>
<p style="line-height:130%;"><font size="2" color="red"><b>
角 嚼</b></font></p>
<p style="line-height:130%;"><font size="2"> 1. publishers
抛捞喉狼 葛电 拿烦阑 焊咯霖促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
* FROM publishers</font></p>
<p style="line-height:130%;"><font size="2"> 2. 漂沥 抛捞喉俊辑
急琶等 拿烦 单捞磐 啊廉坷扁 </font></p>
<p style="line-height:130%;"><font size="2" color="navy"> USE
PUBS</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id, pub_name FROM publishers</font></p>
<p style="line-height:130%;"><font size="2"> 3. 漂沥 Row狼
单捞磐 啊廉坷扁 (WHERE)</font></p>
<p style="line-height:130%;"><font size="2"> pub_id
蔼捞 '1000' 焊促 累篮 巴父 啊廉柯促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id , pub_name FROM publishers WHERE pub_id < '1000'</font></p>
<p style="line-height:130%;"><font size="2"> 裹困
楷魂磊 BETWEEN 荤侩 : pub_name捞 'F' 客 'H' 荤捞狼 蔼牢 巴父 啊廉柯促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id , pub_name FROM publishers WHERE pub_name BETWEEN 'F'
and 'H'</font></p>
<p style="line-height:130%;"><font size="2"> 府胶飘
(list) 楷魂磊 IN : pub_id 拿烦 蔼捞 '1234', '1622', '1756' 吝狼 窍唱牢
蔼阑 啊廉柯促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id , pub_name FROM publishers WHERE pub_id IN ('1234',
'1622', '1756')</font></p>
<p style="line-height:130%;"><font size="2"> 漂沥
巩磊凯 茫扁 (LIKE) : pub_name俊 'Pub'扼绰 巩磊凯捞 甸绢乐绰 饭内靛甫 茫酒辰促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id , pub_name FROM publishers WHERE pub_name LIKE '%Pub%'</font></p>
<p style="line-height:130%;"><font size="2"> NULL
蔼 促风扁 (ISNULL) : state 拿烦俊 绢恫 蔼捞电 甸绢乐绰 row甫 啊廉柯促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id , pub_name FROM publishers WHERE state IS NOT NULL</font></p>
<p style="line-height:130%;"><font size="2"> pub_id
蔼捞 '1000' 焊促 农绊, country 蔼捞 'USA' 捞芭唱 city 蔼捞 B肺 矫累登绰 row甫
啊廉柯促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
* FROM publishers WHERE pub_id > '1000' and country = 'USA' or
city LIKE 'B%'</font></p>
<p style="line-height:130%;"><font size="2"> 4. 免仿鉴辑 沥窍扁
( ORDER BY )</font></p>
<p style="line-height:130%;"><font size="2"> 孽府
搬苞肺 唱坷绰 row甫 沥纺茄促. ( ASC : 坷抚瞒鉴 / DESC : 郴覆瞒鉴 )</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id , pub_name, city, state, country </font></p>
<p style="line-height:130%;"><font size="2" color="navy"> FROM
publishers ORDER BY country, city ASC</font></p>
<p style="line-height:130%;"><font size="2"> 5. 孽府 搬苞 歹窍扁
( UNION ) : 辑肺 炼扒捞 促弗 孽府狼 搬苞甫 钦茄促.</font></p>
<p style="line-height:130%;"><font size="2"> </font><font size="2" color="navy"> SELECT
pub_id , pub_name FROM publishers WHERE pub_id = '0736' </font></p>
<p style="line-height:130%;"><font size="2" color="navy"> UNION
</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> SELECT
pub_id , pub_name FROM publishers WHERE pub_name LIKE 'Binnet%'</font></p>
<p style="line-height:130%;"> </p>
<p style="line-height:130%;"><font size="4"><b>II. INSERT</b></font><font size="2">
</font></p>
<ul>
<p style="line-height:130%;"><font size="2">INSERT 巩篮 瘤沥等 抛捞喉俊
货肺款 饭内靛甫 眠啊窍搁辑 瘤沥等 拿烦俊 蔼阑 措涝茄促.</font></p>
</ul>
<p style="line-height:130%;"><font size="2"> </font><font
size="2" color="red"><b>Syntax </b></font><font size="2"> </font><font
size="2"><b>INSERT</b></font><font size="2"> [INTO] table_name
[ (column_list) ] </font><font size="2"><b>VALUES</b></font><font
size="2"> (values_list)</font></p>
<p style="line-height:130%;"><font size="2"> ...... INSERT
巩 角嚼俊 菊辑 pubs 单捞磐海捞胶俊 促澜苞 鞍捞 货肺款 抛捞喉阑 窍唱 父电促 ......</font></p>
<ul>
<ul>
<p style="line-height:12%;"><font size="2" color="navy">use PUBS</font></p>
<p style="line-height:12%;"><font size="2" color="navy">CREATE TABLE
pub</font></p>
<p style="line-height:12%;"><font size="2" color="navy">(</font></p>
<p style="line-height:12%;"><font size="2" color="navy"> pub_id
char
(4) primary
key,</font></p>
<p style="line-height:12%;"><font size="2" color="navy"> pub_name
varchar (40) NULL,</font></p>
<p style="line-height:12%;"><font size="2" color="navy"> city
varchar
(20) NULL,</font></p>
<p style="line-height:12%;"><font size="2" color="navy"> state
char
(2) NULL,</font></p>
<p style="line-height:12%;"><font size="2" color="navy"> country
varchar
(30) NULL DEFAULT ('KOR')</font></p>
<p style="line-height:12%;"><font size="2" color="navy">)</font></p>
</ul>
</ul>
<p style="line-height:130%;"><font size="2"> </font><font
size="2" color="red"><b>角 嚼</b></font></p>
<p style="line-height:130%;"><font size="2"> pub 抛捞喉俊
饭内靛甫 眠啊茄促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> INSERT
INTO pub ( pub_id, pub_name, city, state, country ) </font></p>
<p style="line-height:130%;"><font size="2" color="navy"> VALUES
( '9901', 'SQL BOOKS', 'SEOUL', 'AB', 'KOR' )</font></p>
<p style="line-height:130%;"><font size="2"> 火涝等 饭内靛甫
犬牢茄促 : </font><font size="2" color="navy">SELECT * FROM
pub</font></p>
<p style="line-height:130%;"> </p>
<p style="line-height:130%;"><font size="4"><b>III. UPDATE</b></font></p>
<ul>
<p style="line-height:130%;"><font size="2">抛捞喉俊 甸绢啊 乐绰 拿烦蔼阑
荐沥茄促.</font></p>
</ul>
<p style="line-height:130%;"><font size="2"> </font><font
size="2" color="red"><b>角 嚼</b></font></p>
<p style="line-height:130%;"><font size="2" color="navy"> UPDATE
pub SET pub_name = 'SQL BOOKS 1' WHERE pub_id
= '9901'</font></p>
<p style="line-height:130%;"><font size="2"> 荐沥等 饭内靛甫
犬牢茄促 : </font><font size="2" color="navy">SELECT * FROM
pub WHERE pub_id = '9901'</font></p>
<p style="line-height:130%;"> </p>
<p style="line-height:130%;"><font size="4"><b>IV. DELETE</b></font></p>
<ul>
<p style="line-height:130%;"><font size="2">抛捞喉俊 甸绢啊 乐绰 肺快甫
昏力茄促.</font></p>
</ul>
<p style="line-height:130%;"><font size="2"> </font><font
size="2" color="red"><b>角 嚼</b></font></p>
<p style="line-height:130%;"><font size="2"> pub_id =
'9905' 炼扒阑 父练窍绰 饭内靛甫 昏力茄促.</font></p>
<p style="line-height:130%;"><font size="2" color="navy"> DELETE
FROM pub WHERE pub_id = '9905'</font></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -