亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch08.htm

?? 21精通SQL
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>
	
	<TITLE>Teach Yourself SQL in 21 Days, Second Edition -- Ch 8 -- Manipulating Data</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF">

<CENTER>
<H1><IMG SRC="sams.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR>
<FONT COLOR="#000077">Teach Yourself SQL in 21 Days, Second Edition</FONT></H1>
</CENTER>
<CENTER>
<P><A HREF="ch07.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/ch07.htm"><IMG SRC="previous.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="ch09.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/ch09.htm"><IMG
SRC="next.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/index-1.htm"><IMG SRC="contents.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> 
<HR>

</CENTER>
<CENTER>
<H1><FONT COLOR="#000077">- Day 8 -<BR>
Manipulating Data</FONT></H1>
</CENTER>
<H2><FONT COLOR="#000077">Objectives</FONT></H2>
<P>Today we discuss data manipulation. By the end of the day, you should understand:

<UL>
	<LI>How to manipulate data using the <TT>INSERT</TT>, <TT>UPDATE</TT>, and <TT>DELETE</TT>
	commands
	<P>
	<LI>The importance of using the <TT>WHERE</TT> clause when you are manipulating data
	<P>
	<LI>The basics of importing and exporting data from foreign data sources
</UL>

<H2><FONT COLOR="#000077">Introduction to Data Manipulation Statements</FONT></H2>
<P>Up to this point you have learned how to retrieve data from a database using every
selection criterion imaginable. After this data is retrieved, you can use it in an
application program or edit it. Week 1 focused on retrieving data. However, you may
have wondered how to enter data into the database in the first place. You may also
be wondering what to do with data that has been edited. Today we discuss three SQL
statements that enable you to manipulate the data within a database's table. The
three statements are as follows:

<UL>
	<LI>The <TT>INSERT</TT> statement
	<P>
	<LI>The <TT>UPDATE</TT> statement
	<P>
	<LI>The <TT>DELETE</TT> statement
</UL>

<P>You may have used a PC-based product such as Access, dBASE IV, or FoxPro to enter
your data in the past. These products come packaged with excellent tools to enter,
edit, and delete records from databases. One reason that SQL provides data manipulation
statements is that it is primarily used within application programs that enable the
user to edit the data using the application's own tools. The SQL programmer needs
to be able to return the data to the database using SQL. In addition, most large-scale
database systems are not designed with the database designer or programmer in mind.
Because these systems are designed to be used in high-volume, multiuser environments,
the primary design emphasis is placed on the query optimizer and data retrieval engines.</P>
<P>Most commercial relational database systems also provide tools for importing and
exporting data. This data is traditionally stored in a delimited text file format.
Often a format file is stored that contains information about the table being imported.
Tools such as Oracle's SQL*Loader, SQL Server's bcp (bulk copy), and Microsoft Access
Import/Export are covered at the end of the day.


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Today's examples were generated
	with Personal Oracle7. Please note the minor differences in the appearance of commands
	and the way data is displayed in the various implementations. 
<HR>


</BLOCKQUOTE>

<H2><FONT COLOR="#000077">The INSERT Statement</FONT></H2>
<P>The <TT>INSERT</TT> statement enables you to enter data into the database. It
can be broken down into two statements:</P>
<PRE><FONT COLOR="#0066FF">INSERT...VALUES
</FONT></PRE>
<P>and</P>
<PRE><FONT COLOR="#0066FF">INSERT...SELECT
</FONT></PRE>
<H3><FONT COLOR="#000077">The INSERT...VALUES Statement</FONT></H3>
<P>The <TT>INSERT...VALUES</TT> statement enters data into a table one record at
a time. It is useful for small operations that deal with just a few records. The
syntax of this statement is as follows:</P>
<H5>SYNTAX:</H5>
<PRE><FONT COLOR="#0066FF">INSERT INTO table_name
(col1, col2...)
VALUES(value1, value2...)
</FONT></PRE>
<P>The basic format of the <TT>INSERT...VALUES</TT> statement adds a record to a
table using the columns you give it and the corresponding values you instruct it
to add. You must follow three rules when inserting data into a table with the <TT>INSERT...VALUES</TT>
statement:

<UL>
	<LI>The values used must be the same data type as the fields they are being added
	to.
	<P>
	<LI>The data's size must be within the column's size. For instance, you cannot add
	an 80-character string to a 40-character column.
	<P>
	<LI>The data's location in the <TT>VALUES</TT> list must correspond to the location
	in the column list of the column it is being added to. (That is, the first value
	must be entered into the first column, the second value into the second column, and
	so on.)
</UL>

<H4><FONT COLOR="#000077">Example 8.1</FONT></H4>
<P>Assume you have a <TT>COLLECTION</TT> table that lists all the important stuff
you have collected. You can display the table's contents by writing</P>
<H5>INPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM COLLECTION;
</B></FONT></PRE>
<P>which would yield this:</P>
<H5>OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF">ITEM                     WORTH REMARKS
-------------------- --------- ----------------------------
NBA ALL STAR CARDS         300 SOME STILL IN BIKE SPOKES
MALIBU BARBIE              150 TAN NEEDS WORK
STAR WARS GLASS            5.5 HANDLE CHIPPED
LOCK OF SPOUSES HAIR         1 HASN'T NOTICED BALD SPOT YET
</FONT></PRE>
<P>If you wanted to add a new record to this table, you would write</P>
<H5><FONT COLOR="#000000">INPUTOUTPUT:</FONT></H5>
<PRE><FONT COLOR="#0066FF">SQL&gt;<B> INSERT INTO COLLECTION
</B>  2 <B> (ITEM, WORTH, REMARKS)
 </B> 3 <B> VALUES('SUPERMANS CAPE', 250.00, 'TUGGED ON IT');
</B>
1 row created.
</FONT></PRE>
<P>You can execute a simple <TT>SELECT</TT> statement to verify the insertion:</P>
<H5>INPUT/OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM COLLECTION;
</B>
ITEM                     WORTH REMARKS
-------------------- --------- ----------------------------
NBA ALL STAR CARDS         300 SOME STILL IN BIKE SPOKES
MALIBU BARBIE              150 TAN NEEDS WORK
STAR WARS GLASS            5.5 HANDLE CHIPPED
LOCK OF SPOUSES HAIR         1 HASN'T NOTICED BALD SPOT YET
SUPERMANS CAPE             250 TUGGED ON IT
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>The <TT>INSERT</TT> statement does not require column names. If the column names
are not entered, SQL lines up the values with their corresponding column numbers.
In other words, SQL inserts the first value into the first column, the second value
into the second column, and so on.
<H4><FONT COLOR="#000077">Example 8.2</FONT></H4>
<P>The following statement inserts the values from Example 8.1 into the table:</P>
<H5>INPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>INSERT INTO COLLECTION VALUES
</B>  2 <B> ('STRING',1000.00,'SOME DAY IT WILL BE VALUABLE');
</B></FONT></PRE>
<PRE><FONT COLOR="#0066FF"><B>     </B>1 row created.
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>By issuing the same <TT>SELECT</TT> statement as you did in Example 8.1, you can
verify that the insertion worked as expected:</P>
<H5>INPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM COLLECTION;</B></FONT></PRE>
<H5><FONT COLOR="#000000"><B>OUTPUT:</B></FONT></H5>
<PRE><FONT COLOR="#0066FF">ITEM                     WORTH REMARKS
-------------------- --------- ----------------------------
NBA ALL STAR CARDS         300 SOME STILL IN BIKE SPOKES
MALIBU BARBIE              150 TAN NEEDS WORK
STAR WARS GLASS            5.5 HANDLE CHIPPED
LOCK OF SPOUSES HAIR         1 HASN'T NOTICED BALD SPOT YET
SUPERMANS CAPE             250 TUGGED ON IT
STRING                    1000 SOME DAY IT WILL BE VALUABLE

6 rows selected.
</FONT></PRE>
<H3><FONT COLOR="#000077">Inserting NULL Values</FONT></H3>
<P>On Day 9, &quot;Creating and Maintaining Tables,&quot; you learn how to create
tables using the <TT>SQL CREATE TABLE</TT> statement. For now, all you need to know
is that when a column is created, it can have several different limitations placed
upon it. One of these limitations is that the column should (or should not) be allowed
to contain <TT>NULL</TT> values. A <TT>NULL</TT> value means that the value is empty.
It is neither a zero, in the case of an integer, nor a space, in the case of a string.
Instead, no data at all exists for that record's column. If a column is defined as
<TT>NOT NULL</TT> (that column is not allowed to contain a <TT>NULL</TT> value),
you must<B> </B>insert a value for that column when using the <TT>INSERT</TT> statement.
The <TT>INSERT</TT> is canceled if this rule is broken, and you should receive a
descriptive error message concerning your error.


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>WARNING:</B></FONT><B> </B>You could insert spaces for a
	null column, but these spaces will be treated as a value. <TT>NULL</TT> simply means
	nothing is there. 
<HR>
</P>

</BLOCKQUOTE>

<H5>INPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>insert into collection values</B>
  2  <B>('SPORES MILDEW FUNGUS', 50.00, ' ');</B></FONT></PRE>
<H5><FONT COLOR="#000000">OUTPUT:</FONT></H5>
<PRE><FONT COLOR="#0066FF"> 1 row inserted.
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>Using <TT>''</TT> instead of <TT>NULL</TT> inserted a space in the <TT>collection</TT>
table. You then can select the space.</P>
<H5>INPUT/OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>select * from collection</B>
  2  <B>where remarks = ' ';
</B>
ITEM                         WORTH    REMARKS
--------------------------- -------- ---------
SPORES MILDEW FUNGUS         50.00

1 row selected.
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>The resulting answer comes back as if a <TT>NULL</TT> is there. With the output
of character fields, it is impossible to tell the difference between a null value
and a mere space.</P>
<P>Assume the column <TT>REMARKS</TT> in the preceding table has been defined as
<TT>NOT NULL</TT>. Typing</P>
<H5>INPUT/OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>INSERT INTO COLLECTION</B>
  2 <B> VALUES('SPORES MILDEW FUNGUS',50.00,NULL);</B>
</FONT></PRE>
<P>produces the following error:</P>
<PRE><FONT COLOR="#0066FF">INSERT INTO COLLECTION
            *
ERROR at line 1:
ORA-01400: mandatory (NOT NULL) column is missing or NULL during insert
</FONT></PRE>


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Notice the syntax. Number data types
	do not require quotes; <TT>NULL</TT> does not require quotes; character data types
	do require quotes. 
<HR>


</BLOCKQUOTE>

<H3><FONT COLOR="#000077">Inserting Unique Values</FONT></H3>
<P>Many database management systems also allow you to create a <TT>UNIQUE</TT> column
attribute. This attribute means that within the current table, the values within
this column must be completely unique and cannot appear more than once. This limitation
can cause problems when inserting or updating values into an existing table, as the
following exchange demonstrates:</P>
<H5>INPUT:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>INSERT INTO COLLECTION VALUES('STRING', 50, 'MORE STRING');</B></FONT></PRE>
<H5><FONT COLOR="#000000">OUTPUT:</FONT></H5>
<PRE><FONT COLOR="#0066FF">INSERT INTO COLLECTION VALUES('STRING', 50, 'MORE STRING')
            *
ERROR at line 1:
ORA-00001: unique constraint (PERKINS.UNQ_COLLECTION_ITEM) violated
</FONT></PRE>
<H5>ANALYSIS:</H5>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩午夜在线观看视频| 日韩一区二区视频在线观看| 蜜桃视频第一区免费观看| 久久婷婷成人综合色| 91麻豆免费观看| 国产自产高清不卡| 亚洲韩国精品一区| 国产欧美日韩麻豆91| 欧美日韩国产综合草草| 成人av网站免费观看| 久久精品国产精品亚洲红杏| 亚洲一级片在线观看| 欧美经典一区二区三区| 欧美精品久久久久久久多人混战| 99久免费精品视频在线观看| 国产一区欧美日韩| 婷婷综合另类小说色区| 亚洲午夜久久久| 亚洲欧美日韩小说| 国产精品乱子久久久久| 欧美成人女星排行榜| 欧美日韩精品电影| 日本精品视频一区二区三区| 成人综合婷婷国产精品久久蜜臀 | 中文字幕一区二| 久久影院午夜片一区| 日韩欧美国产一区二区在线播放 | 成人av综合在线| 国内精品久久久久影院薰衣草| 天天色天天操综合| 亚洲成av人片观看| 亚洲图片一区二区| 亚洲一区二区三区影院| 洋洋av久久久久久久一区| 亚洲欧美色图小说| 亚洲欧美国产高清| 一卡二卡三卡日韩欧美| 亚洲综合色自拍一区| 亚洲成人av一区二区| 亚洲va国产天堂va久久en| 亚洲韩国精品一区| 日本中文字幕不卡| 蜜臀av一区二区在线免费观看 | 欧美一二三四区在线| 69堂国产成人免费视频| 在线电影院国产精品| 337p亚洲精品色噜噜| 91精品在线麻豆| 日韩欧美在线影院| 欧美mv日韩mv亚洲| 国产精品青草综合久久久久99| 国产精品全国免费观看高清| 中文字幕一区二区三区不卡在线| 亚洲柠檬福利资源导航| 亚洲国产一区二区三区青草影视| 亚洲国产精品久久人人爱蜜臀| 午夜电影网亚洲视频| 日本成人在线视频网站| 国产美女久久久久| 成人a级免费电影| 欧美性色黄大片手机版| 欧美一级电影网站| 国产情人综合久久777777| 国产精品黄色在线观看| 亚洲品质自拍视频网站| 亚洲va在线va天堂| 美女看a上一区| 成人在线一区二区三区| 色狠狠一区二区| 欧美一级艳片视频免费观看| 欧美一区二视频| 欧美极品少妇xxxxⅹ高跟鞋| 亚洲国产精品ⅴa在线观看| 亚洲欧美一区二区三区久本道91| 亚洲精品高清视频在线观看| 天天av天天翘天天综合网色鬼国产| 韩国午夜理伦三级不卡影院| 色综合中文字幕国产| 欧洲生活片亚洲生活在线观看| 欧美一卡二卡在线| 国产精品久久久久久妇女6080| 亚洲综合色网站| 国产在线播放一区| 色婷婷综合视频在线观看| 日韩女优av电影在线观看| 亚洲日本免费电影| 精品一区二区日韩| 在线这里只有精品| 久久亚洲综合av| 性久久久久久久久| 成人性生交大片免费| 久久精品国产一区二区| 亚洲天天做日日做天天谢日日欢 | 蜜桃久久精品一区二区| 日韩欧美一区二区在线视频| 日韩亚洲欧美在线观看| 亚洲嫩草精品久久| 国产在线播放一区二区三区| 国产亚洲一区二区在线观看| 久久成人综合网| 久久精品人人做人人爽97| 日日噜噜夜夜狠狠视频欧美人| 美腿丝袜亚洲三区| 91网页版在线| 欧美大片一区二区| 亚洲va天堂va国产va久| 国产91富婆露脸刺激对白 | 精品黑人一区二区三区久久| 亚洲一区免费在线观看| 最新成人av在线| 国产婷婷精品av在线| 欧美羞羞免费网站| 一区二区国产视频| 日本乱人伦aⅴ精品| 亚洲乱码国产乱码精品精的特点 | 中文字幕制服丝袜一区二区三区| 在线视频中文字幕一区二区| 中文字幕乱码亚洲精品一区| 韩国v欧美v亚洲v日本v| 制服丝袜av成人在线看| 一区二区三区精品| 色先锋资源久久综合| 国产精品久久午夜| 国产福利不卡视频| 精品99久久久久久| 久久国产成人午夜av影院| 在线成人高清不卡| 肉肉av福利一精品导航| 欧美日韩第一区日日骚| 亚洲国产精品久久艾草纯爱| 欧美体内she精高潮| 依依成人精品视频| 欧美三级中文字| 亚洲国产精品麻豆| 成人爽a毛片一区二区免费| 中文字幕日本乱码精品影院| 一本久道中文字幕精品亚洲嫩| 亚洲一线二线三线视频| 精品第一国产综合精品aⅴ| 91极品视觉盛宴| 久久66热偷产精品| 亚洲欧美一区二区久久| 91麻豆精品国产91久久久 | 欧美中文字幕一区二区三区亚洲 | 欧美日韩精品综合在线| 日本午夜一区二区| 亚洲美女少妇撒尿| 国产欧美精品一区| 日韩欧美一级二级| 91国在线观看| 精品免费国产二区三区| 欧美亚洲综合另类| 91网上在线视频| 另类欧美日韩国产在线| 亚洲码国产岛国毛片在线| 精品嫩草影院久久| ww久久中文字幕| 日韩中文字幕91| 欧美日韩国产小视频| 亚洲超碰97人人做人人爱| a4yy欧美一区二区三区| 亚洲图片欧美一区| 欧美电影免费观看高清完整版在| 韩国一区二区在线观看| 国产精品国产三级国产普通话三级 | 555夜色666亚洲国产免| 老鸭窝一区二区久久精品| 日本一区二区三区免费乱视频| 91视频在线观看免费| 日韩国产成人精品| 国产人成一区二区三区影院| 色婷婷激情综合| 久久99精品久久久久婷婷| 中文字幕一区二区不卡| 宅男噜噜噜66一区二区66| 国产盗摄视频一区二区三区| 亚洲最大色网站| 欧美大片一区二区三区| 97久久精品人人做人人爽50路| 天堂资源在线中文精品| 久久精品视频一区二区| 欧美亚一区二区| 国产很黄免费观看久久| 亚洲一二三四在线观看| 久久精品一区二区三区不卡牛牛| 色婷婷综合久久久久中文一区二区| 裸体健美xxxx欧美裸体表演| 日韩一区中文字幕| 日韩一级黄色大片| 91麻豆国产福利在线观看| 精品在线一区二区| 亚洲综合一区二区精品导航| 久久人人超碰精品| 欧美色老头old∨ideo| 东方欧美亚洲色图在线| 蜜桃视频在线观看一区| 亚洲免费观看高清完整版在线观看| 精品久久一区二区三区| 欧美色老头old∨ideo| 成人av网址在线观看|