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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch09.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 -- Day 9 -- Creating and Maintaining Tables</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="ch08.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/ch08.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="ch10.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/ch10.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 9 -<BR>
Creating and Maintaining Tables</FONT></H1>
</CENTER>
<H2><FONT COLOR="#000077">Objectives</FONT></H2>
<P>Today you learn about creating databases. Day 9 covers the <TT>CREATE DATABASE</TT>,
<TT>CREATE TABLE</TT>, <TT>ALTER TABLE</TT>, <TT>DROP TABLE</TT>, and <TT>DROP DATABASE</TT>
statements, which are collectively known as data definition statements. (In contrast,
the <TT>SELECT</TT>, <TT>UPDATE</TT>, <TT>INSERT</TT>, and <TT>DELETE</TT> statements
are often described as data manipulation statements.) By the end of the day, you
will understand and be able to do the following:

<UL>
	<LI>Create key fields
	<P>
	<LI>Create a database with its associated tables
	<P>
	<LI>Create, alter, and drop a table
	<P>
	<LI>Add data to the database
	<P>
	<LI>Modify the data in a database
	<P>
	<LI>Drop databases
</UL>

<P>You now know much of the SQL vocabulary and have examined the SQL query in some
detail, beginning with its basic syntax. On Day 2, &quot;Introduction to the Query:
The <TT>SELECT</TT> Statement,&quot; you learned how to select data from the database.
On Day 8, &quot;Manipulating Data,&quot; you learned how to insert, update, and delete
data from the database. Now, nine days into the learning process, you probably have
been wondering just where these databases come from. For simplicity's sake, we have
been ignoring the process of creating databases and tables. We have assumed that
these data objects existed currently on your system. Today you finally create these
objects.</P>
<P>The syntax of the <TT>CREATE</TT> statements can range from the extremely simple
to the complex, depending on the options your database management system (DBMS) supports
and how detailed you want to be when building a database.


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The examples used today were generated
	using Personal Oracle7. Please see the documentation for your specific SQL implementation
	for any minor differences in syntax. 
<HR>


</BLOCKQUOTE>

<H2><FONT COLOR="#000077">The CREATE DATABASE Statement</FONT></H2>
<P>The first data management step in any database project is to create the database.
This task can range from the elementary to the complicated, depending on your needs
and the database management system you have chosen. Many modern systems (including
Personal Oracle7) include graphical tools that enable you to completely build the
database with the click of a mouse button. This time-saving feature is certainly
helpful, but you should understand the SQL statements that execute in response to
the mouse clicks.</P>
<P>Through personal experience, we have learned the importance of creating a good
SQL install script. This script file contains the necessary SQL code to completely
rebuild a database or databases; the script often includes database objects such
as indexes, stored procedures, and triggers. You will see the value of this script
during development as you continually make changes to the underlying database and
on occasion want to completely rebuild the database with all the latest changes.
Using the graphical tools each time you need to perform a rebuild can become extremely
time-consuming. In addition, knowing the SQL syntax for this procedure enables you
to apply your knowledge to other database systems.</P>
<P>The syntax for the typical <TT>CREATE DATABASE</TT> statement looks like this:</P>
<H5>SYNTAX:</H5>
<PRE><FONT COLOR="#0066FF">CREATE DATABASE database_name
</FONT></PRE>
<P>Because the syntax varies so widely from system to system, we will not expand
on the <TT>CREATE DATABASE</TT> statement's syntax. Many systems do not even support
an SQL <TT>CREATE DATABASE</TT> command. However, all the popular, more powerful,
relational database management systems (RDBMSs) do provide it. Instead of focusing
on its syntax, we will spend some time discussing the options to consider when creating
a database.
<H3><FONT COLOR="#000077">CREATE DATABASE Options</FONT></H3>
<P>The syntax for the <TT>CREATE DATABASE</TT> statement can vary widely. Many SQL
texts skip over the <TT>CREATE DATABASE</TT> statement and move directly on to the
<TT>CREATE TABLE</TT> statement. Because you must create a database before you can
build a table, this section focuses on some of the concepts a developer must consider
when building a database. The first consideration is your level of permission. If
you are using a relational database management system (RDBMS) that supports user
permissions, you must make sure that either you have system administrator-level permission
settings or the system administrator has granted you <TT>CREATE DATABASE</TT> permission.
Refer to your RDBMS documentation for more information.</P>
<P>Most RDBMSs also allow you to specify a default database size, usually in terms
of hard disk space (such as megabytes). You will need to understand how your database
system stores and locates data on the disk to accurately estimate the size you need.
The responsibility for managing this space falls primarily to system administrators,
and possibly at your location a database administrator will build you a test database.</P>
<P>Don't let the <TT>CREATE DATABASE</TT> statement intimidate you. At its simplest,
you can create a database named <TT>PAYMENTS</TT> with the following statement:</P>
<H5>SYNTAX:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE DATABASE PAYMENTS;</B>
</FONT></PRE>


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Again, be sure to consult your database
	management system's documentation to learn the specifics of building a database,
	as the <TT>CREATE DATABASE</TT> statement can and does vary for the different implementations.
	Each implementation also has some unique options. 
<HR>


</BLOCKQUOTE>

<H3><FONT COLOR="#000077">Database Design</FONT></H3>
<P>Designing a database properly is extremely important to the success of your application.
The introductory material on Day 1, &quot;Introduction to SQL,&quot; touched on the
topics of relational database theory and database normalization.</P>
<P><I>Normalization</I> is the process of breaking your data into separate components
to reduce the repetition of data. Each level of normalization reduces the repetition
of data. Normalizing your data can be an extremely complex process, and numerous
database design tools enable you to plan this process in a logical fashion.</P>
<P>Many factors can influence the design of your database, including the following:

<UL>
	<LI>Security
	<P>
	<LI>Disk space available
	<P>
	<LI>Speed of database searches and retrievals
	<P>
	<LI>Speed of database updates
	<P>
	<LI>Speed of multiple-table joins to retrieve data
	<P>
	<LI>RDBMS support for temporary tables
</UL>

<P>Disk space is always an important factor. Although you may not think that disk
space is a major concern in an age of multigigabyte storage, remember that the bigger
your database is, the longer it takes to retrieve records. If you have done a poor
job of designing your table structure, chances are that you have needlessly repeated
much of your data.</P>
<P>Often the opposite problem can occur. You may have sought to completely normalize
your tables' design with the database and in doing so created many tables. Although
you may have approached database-design nirvana, any query operations done against
this database may take a very long time to execute. Databases designed in this manner
are sometimes difficult to maintain because the table structure might obscure the
designer's intent. This problem underlines the importance of always documenting your
code or design so that others can come in after you (or work with you) and have some
idea of what you were thinking at the time you created your database structure. In
database designer's terms, this documentation is known as a data dictionary.
<H3><FONT COLOR="#000077">Creating a Data Dictionary</FONT></H3>
<P>A data dictionary is the database designer's most important form of documentation.
It performs the following functions:

<UL>
	<LI>Describes the purpose of the database and who will be using it.
	<P>
	<LI>Documents the specifics behind the database itself: what device it was created
	on, the database's default size, or the size of the log file (used to store database
	operations information in some RDBMSs).
	<P>
	<LI>Contains SQL source code for any database install or uninstall scripts, including
	documentation on the use of import/export tools, such as those introduced yesterday
	(Day 8).
	<P>
	<LI>Provides a detailed description of each table within the database and explains
	its purpose in business process terminology.
	<P>
	<LI>Documents the internal structure of each table, including all fields and their
	data types with comments, all indexes, and all views. (See Day 10, &quot;Creating
	Views and Indexes.&quot;)
	<P>
	<LI>Contains SQL source code for all stored procedures and triggers.
	<P>
	<LI>Describes database constraints such as the use of unique values or <TT>NOT NULL</TT>
	values. The documentation should also mention whether these constraints are enforced
	at the RDBMS level or whether the database programmer is expected to check for these
	constraints within the source code.
</UL>

<P>Many computer-aided software engineering (CASE) tools aid the database designer
in the creation of this data dictionary. For instance, Microsoft Access comes prepackaged
with a database documenting tool that prints out a detailed description of every
object in the database. See Day 17, &quot;Using SQL to Generate SQL Statements,&quot;
for more details on the data dictionary.


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Most of the major RDBMS packages
	come with either the data dic-tionary installed or scripts to install it. 
<HR>


</BLOCKQUOTE>

<H3><FONT COLOR="#000077">Creating Key Fields</FONT></H3>
<P>Along with documenting your database design, the most important design goal you
should have is to create your table structure so that each table has a primary key
and a foreign key. The primary key should meet the following goals:

<UL>
	<LI>Each record is unique within a table (no other record within the table has all
	of its columns equal to any other).
	<P>
	<LI>For a record to be unique, all the columns are necessary; that is, data in one
	column should not be repeated anywhere else in the table.
</UL>

<P>Regarding the second goal, the column that has completely unique data throughout
the table is known as the <I>primary key field</I>. A <I>foreign key field</I> is
a field that links one table to another table's primary or foreign key. The following
example should clarify this situation.</P>
<P>Assume you have three tables: <TT>BILLS</TT>, <TT>BANK_ACCOUNTS</TT>, and <TT>COMPANY</TT>.
Table 9.1 shows the format of these three tables.
<H4><FONT COLOR="#000077">Table 9.1. Table structure for the PAYMENTS database.</FONT></H4>
<P>
<TABLE BORDER="1">
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT"><B>Bills</B></TD>
		<TD ALIGN="LEFT"><B>Bank_Accounts</B></TD>
		<TD ALIGN="LEFT"><B>Company</B></TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT"><TT>NAME, CHAR(30)</TT></TD>
		<TD ALIGN="LEFT"><TT>ACCOUNT_ID, NUMBER</TT></TD>
		<TD ALIGN="LEFT"><TT>NAME, CHAR(30)</TT></TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT"><TT>AMOUNT, NUMBER</TT></TD>
		<TD ALIGN="LEFT"><TT>TYPE, CHAR(30)</TT></TD>
		<TD ALIGN="LEFT"><TT>ADDRESS, CHAR(50)</TT></TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT"><TT>ACCOUNT_ID, NUMBER</TT></TD>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩 欧美一区二区三区| 国产亚洲婷婷免费| 久久亚洲私人国产精品va媚药| 国产亚洲精久久久久久| 亚洲精品日韩专区silk| 麻豆精品国产91久久久久久| jvid福利写真一区二区三区| 欧美久久久久久久久中文字幕| 久久久久国产精品麻豆| 一区二区三区中文在线观看| 国内精品免费**视频| 日本伦理一区二区| 欧美成人乱码一区二区三区| 依依成人综合视频| 国内精品视频666| 欧洲精品一区二区| 国产欧美一区二区精品仙草咪| 亚洲国产aⅴ天堂久久| 国产精品香蕉一区二区三区| 欧美色综合网站| 欧美国产激情一区二区三区蜜月 | 国产成人无遮挡在线视频| 日本国产一区二区| 久久久久久9999| 视频在线观看91| 99精品久久免费看蜜臀剧情介绍| 日韩一区二区三区电影| 亚洲欧美日韩国产手机在线| 麻豆精品视频在线观看| 欧洲激情一区二区| 国产精品久久久久久久久晋中| 免费高清在线一区| 在线免费视频一区二区| 中文字幕电影一区| 久久99精品久久久久久动态图| 色美美综合视频| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 95精品视频在线| 精品美女在线播放| 天堂成人免费av电影一区| 91亚洲男人天堂| 国产日韩欧美高清| 美女网站视频久久| 欧美日本乱大交xxxxx| 亚洲免费观看高清完整版在线观看 | 欧美性感一区二区三区| 中文字幕 久热精品 视频在线| 久久99精品国产.久久久久久| 欧美色图在线观看| 亚洲女同ⅹxx女同tv| 国产一区999| 亚洲精品在线免费播放| 日韩av在线播放中文字幕| 欧美日韩另类一区| 亚洲精品视频免费观看| 91女神在线视频| 国产精品乱人伦中文| 国产大片一区二区| 国产午夜精品在线观看| 国产一区欧美日韩| 久久久www免费人成精品| 精品在线播放免费| 久久影院午夜片一区| 狠狠久久亚洲欧美| 久久综合久久鬼色中文字| 六月丁香婷婷久久| 欧美大片一区二区三区| 久久精品国产久精国产| 日韩视频免费直播| 激情六月婷婷久久| 久久先锋影音av| 国产精品自拍网站| 中文字幕二三区不卡| 成年人午夜久久久| 国产精品久久久久久久久搜平片 | 国产精品婷婷午夜在线观看| 国产剧情一区二区三区| 欧美韩国日本一区| 99久久99久久免费精品蜜臀| 中文字幕一区二区三区视频| 一本到不卡免费一区二区| 一区二区三区免费| 欧美日韩视频在线一区二区| 三级一区在线视频先锋 | 国产综合久久久久影院| 国产视频一区二区在线| 成人午夜免费视频| 一区二区三区自拍| 欧美二区三区91| 国产一区二区在线影院| 国产精品久久看| 欧美私人免费视频| 久久精品国产久精国产爱| 国产婷婷一区二区| 色视频一区二区| 强制捆绑调教一区二区| 久久久激情视频| 色猫猫国产区一区二在线视频| 天堂蜜桃91精品| 久久久蜜臀国产一区二区| 99精品久久只有精品| 五月激情综合网| 久久色.com| 91网站最新网址| 亚洲成人tv网| 2021中文字幕一区亚洲| 色域天天综合网| 美女视频一区在线观看| 国产精品色噜噜| 欧美人与禽zozo性伦| 国产精品亚洲专一区二区三区| 亚洲美女在线国产| 日韩欧美国产一区二区在线播放 | 亚洲欧美日韩国产综合| 9191国产精品| 丁香一区二区三区| 亚洲bdsm女犯bdsm网站| 久久精品网站免费观看| 欧美美女激情18p| 国产999精品久久| 香蕉影视欧美成人| 国产精品三级av| 日韩一区二区三区视频在线观看 | 亚洲精品日日夜夜| 精品福利一区二区三区免费视频| 99久久精品久久久久久清纯| 免费高清成人在线| 亚洲欧美韩国综合色| 久久综合网色—综合色88| 欧美撒尿777hd撒尿| 成人av在线网站| 美女www一区二区| 亚洲欧美国产毛片在线| 久久久久久久综合色一本| 欧美日韩国产欧美日美国产精品| 国产成人亚洲综合a∨婷婷| 午夜免费欧美电影| 中文字幕一区二区三区不卡在线| 日韩视频一区二区在线观看| 在线观看av一区| 波多野结衣精品在线| 久久97超碰国产精品超碰| 亚洲综合无码一区二区| 中文在线免费一区三区高中清不卡 | 亚洲综合精品久久| 国产欧美精品一区二区色综合| 欧美肥妇free| 欧美午夜电影网| 99re在线视频这里只有精品| 国产综合久久久久影院| 日本vs亚洲vs韩国一区三区二区| 一区二区三区小说| 国产精品久久免费看| 久久精品夜色噜噜亚洲a∨| 日韩三级在线观看| 欧美视频第二页| 在线中文字幕一区二区| www.在线欧美| 成人精品免费网站| 成人午夜电影网站| 国产综合久久久久影院| 美女一区二区久久| 免费精品视频最新在线| 日本亚洲三级在线| 日韩电影在线一区二区三区| 亚洲自拍偷拍综合| 一区二区成人在线观看| 亚洲视频一区二区在线| 国产精品国产三级国产有无不卡| 久久久一区二区| 久久美女高清视频| 久久欧美一区二区| 亚洲精品在线免费播放| 久久久久久免费| 国产女主播在线一区二区| 久久伊人蜜桃av一区二区| www激情久久| 国产亚洲一区二区在线观看| 国产日韩欧美激情| 国产精品久久三区| 亚洲桃色在线一区| 亚洲精品亚洲人成人网 | 欧美久久久影院| 欧美日韩黄视频| 欧美一卡二卡三卡| 日韩三级伦理片妻子的秘密按摩| 欧美一区二区视频观看视频| 欧美xxxxx牲另类人与| 久久欧美中文字幕| 国产精品毛片大码女人| 亚洲日本在线观看| 亚洲成av人片一区二区三区| 日韩综合一区二区| 黄色资源网久久资源365| 国产美女一区二区三区| av在线不卡免费看| 91成人免费在线视频| 欧美精品精品一区| 精品三级在线观看| 国产欧美一区二区精品秋霞影院|