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

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

?? ch14.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 2 頁
字號(hào):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<TITLE>Teach Yourself SQL in 21 Days, Second Edition -- Ch 14 -- Dynamic Uses of SQL</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><CENTER><H1><IMG SRC="../buttonart/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="../ch13/ch13.htm"><IMG SRC="../buttonart/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../wk2rev/wk2rev.htm"><IMGSRC="../buttonart/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../buttonart/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><CENTER><H1><FONT COLOR="#000077">- Day 14 -<BR>Dynamic Uses of SQL</FONT></H1></CENTER><H2><FONT COLOR="#000077">Objectives</FONT></H2><P>The purpose of today's lesson is to show you where to start to apply what youhave learned so far. Today's lesson covers, in very broad strokes, practical applicationsof SQL. We focus on applications in the Microsoft Windows environment, but the principlesinvolved are just as applicable to other software platforms. Today you will learnthe following:<UL>	<LI>How various commercial products--Personal Oracle7, open database connectivity	(ODBC), InterBase ISQL, Microsoft's Visual C++, and Borland's Delphi--relate to SQL	<P>	<LI>How to set up your environment for SQL	<P>	<LI>How to create a database using Oracle7, Microsoft Query, and InterBase ISQL	<P>	<LI>How to use SQL inside applications written in Visual C++ and Delphi</UL><P>After reading this material, you will know where to start applying your new SQLskills.<H2><FONT COLOR="#000077">A Quick Trip</FONT></H2><P>This section examines several commercial products in the context of the MicrosoftWindows operating system and briefly describes how they relate to SQL. The principles,if not the products themselves, apply across various software platforms.<H3><FONT COLOR="#000077">ODBC</FONT></H3><P>One of the underlying technologies in the Windows operating system is ODBC, whichenables Windows-based programs to access a database through a driver. Rather thanhaving a custom interface to each database, something you might very well have towrite yourself, you can connect to the database of your choice through a driver.The concept of ODBC is very similar to the concept of Windows printer drivers, whichenables you to write your program without regard for the printer. Individual differences,which DOS programming forced you to address, are conveniently handled by the printerdriver. The result is that you spend your time working on the tasks peculiar to yourprogram, not on writing printer drivers.</P><P>ODBC applies this idea to databases. The visual part of ODBC resides in the controlpanel in Windows 3.1, 3.11, and Windows 95 and in its own program group in WindowsNT.</P><P>We cover ODBC in more detail when we discuss creating the database later today.<H3><FONT COLOR="#000077">Personal Oracle7</FONT></H3><P>Personal Oracle7 is the popular database's latest incursion into the personalPC market. Don't be put off by the number of programs that Oracle7 installs--we builtall the examples used in the first several days using only the Oracle Database Managerand SQL*Plus 3.3. SQL*Plus is shown in Figure 14.1.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 14.1.</B></A></P><P><I>Oracle7's SQL*Plus.</I></P><P><H3><FONT COLOR="#000077">INTERBASE SQL (ISQL)</FONT></H3><P>The tool used in the other examples is Borland's ISQL. It is essentially the sameas Oracle7 except that Oracle7 is character oriented and ISQL is more Windows-like.</P><P>An ISQL screen is shown in Figure 14.2. You type your query in the top edit box,and the result appears in the lower box. The Previous and Next buttons scroll youthrough the list of all the queries you make during a session.</P><P><A NAME="02"></A><A HREF="02.htm"><B>Figure 14.2.</B></A></P><P><I>InterBase's Interactive SQL.</I></P><P><H3><FONT COLOR="#000077">Visual C++</FONT></H3><P>Dozens of books have been written about Visual C++. For the examples in this book,we used version 1.52. The procedures we used are applicable to the 32-bit version,C++ 2.0. It is used here because of its simple interface with ODBC. It is not theonly compiler with the capability to connect to ODBC. If you use a different compiler,this section provides a good point of departure.</P><P>Visual C++ installs quite a few tools. We use only two: the compiler and the resourceeditor.<H3><FONT COLOR="#000077">Delphi</FONT></H3><P>The last tool we examine is Borland's Delphi, which is the subject of many newbooks. Delphi provides a scalable interface to various databases.</P><P>Delphi has two programs that we use: the InterBase Server (Ibmgr) and the WindowsISQL (Wisql).<H2><FONT COLOR="#000077">Setting Up</FONT></H2><P>Enough with the introductions--let's get to work. After you install your SQL engineor your ODBC-compatible compiler, you must do a certain amount of stage setting beforethe stars can do their stuff. With both Oracle7 and InterBase, you need to log onand create an account for yourself. The procedures are essentially the same. Thehardest part is sorting through the hard copy and online documentation for the defaultpasswords. Both systems have a default system administrator account. (See Figure14.3.)</P><P><A NAME="03"></A><A HREF="03.htm"><B>Figure 14.3.</B></A></P><P><I>InterBase Security manager screen.</I></P><P>After logging on and creating an account, you are ready to create the database.<H2><FONT COLOR="#000077">Creating the Database</FONT></H2><P>This step is where all your SQL training starts to pay off. First, you have tostart up the database you want to use. Figure 14.4 shows Oracle7's stoplight visualmetaphor.</P><P><A NAME="04"></A><A HREF="04.htm"><B>Figure 14.4.</B></A></P><P><I>Oracle7 Database Manager.</I></P><P>After you get the green light, you can open up the SQL*Plus 3.3 tool shown inFigure 14.5.</P><P><A NAME="05"></A><A HREF="05.htm"><B>Figure 14.5.</B></A></P><P><I>Oracle SQL*Plus.</I></P><P>At this point you can create your tables and enter your data using the <TT>CREATE</TT>and <TT>INSERT</TT> keywords. Another common way of creating tables and enteringdata is with a script file. A script file is usually a text file with the SQL commandstyped out in the proper order. Look at this excerpt from a script file deliveredwith Oracle7:</P><PRE><FONT COLOR="#0066FF">-------------------------------------------------------------- Script to build seed database for Personal Oracle------------------------------------------------------------ NTES     Called from buildall.sql-- MODIFICATIONS--   rs  12/04/94 - Comment, clean up, resize, for production------------------------------------------------------------startup nomount pfile=%rdbms71%\init.ora--  Create database for Windows RDBMScreate database oracle    controlfile reuse    logfile '%oracle_home%\dbs\wdblog1.ora' size 400K reuse,            '%oracle_home%\dbs\wdblog2.ora' size 400K reuse    datafile '%oracle_home%\dbs\wdbsys.ora' size 10M reuse    character set WE8ISO8859P1;</FONT></PRE><P>The syntax varies slightly with the implementation of SQL and the database youare using, so be sure to check your documentation. Select File | Open to load thisscript into your SQL engine.</P><P>Borland's InterBase loads data in a similar way. The following excerpt is fromone of the files to insert data:</P><PRE><FONT COLOR="#0066FF">/* *  Add countries.*/INSERT INTO country (country, currency) VALUES ('USA',         'Dollar');INSERT INTO country (country, currency) VALUES ('England',     'Pound');INSERT INTO country (country, currency) VALUES ('Canada',      'CdnDlr');INSERT INTO country (country, currency) VALUES ('Switzerland', 'SFranc');INSERT INTO country (country, currency) VALUES ('Japan',       'Yen');INSERT INTO country (country, currency) VALUES ('Italy',       'Lira');INSERT INTO country (country, currency) VALUES ('France',      'FFranc');INSERT INTO country (country, currency) VALUES ('Germany',     'D-Mark');INSERT INTO country (country, currency) VALUES ('Australia',   'ADollar');INSERT INTO country (country, currency) VALUES ('Hong Kong',   'HKDollar');INSERT INTO country (country, currency) VALUES ('Netherlands', 'Guilder');INSERT INTO country (country, currency) VALUES ('Belgium',     'BFranc');INSERT INTO country (country, currency) VALUES ('Austria',     'Schilling');INSERT INTO country (country, currency) VALUES ('Fiji',        'fdollar');</FONT></PRE><H5>ANALYSIS:</H5><P>This example inserts a country name and the type currency used in that countryinto the <TT>COUNTRY</TT> table. (Refer to Day 8, &quot;Manipulating Data,&quot;for an introduction to the <TT>INSERT</TT> command.)</P><P>There is nothing magic here. Programmers always find ways to save keystrokes.If you are playing along at home, enter the following tables:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">/* Table: CUSTOMER, Owner: PERKINS */<B>CREATE TABLE CUSTOMER (NAME CHAR(10),        ADDRESS CHAR(10),        STATE CHAR(2),        ZIP CHAR(10),        PHONE CHAR(11),        REMARKS CHAR(10));</B></FONT></PRE><H5><FONT COLOR="#000000">INPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">/* Table: ORDERS, Owner: PERKINS */<B>CREATE TABLE ORDERS (ORDEREDON DATE,        NAME CHAR(10),        PARTNUM INTEGER,        QUANTITY INTEGER,        REMARKS CHAR(10));</B></FONT></PRE><H5><FONT COLOR="#000000">INPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">/* Table: PART, Owner: PERKINS */<B>CREATE TABLE PART (PARTNUM INTEGER,        DESCRIPTION CHAR(20),        PRICE NUMERIC(9, 2));</B></FONT></PRE><P>Now fill these tables with the following data:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF"><B>SELECT * FROM CUSTOMER</B>NAME       ADDRESS    STATE  ZIP      PHONE       REMARKS========== ========== ====== ======   ========    ==========TRUE WHEEL 55O HUSKER NE     58702  	555-4545    	NONEBIKE SPEC  CPT SHRIVE LA     45678  	555-1234    	NONELE SHOPPE  HOMETOWN   KS     54678  	555-1278    	NONEAAA BIKE   10 OLDTOWN NE     56784  	555-3421    	JOHN-MGRJACKS BIKE 24 EGLIN   FL     34567  	555-2314    	NONE</FONT></PRE><H5><FONT COLOR="#000000">INPUT/OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF"><B>SELECT * FROM ORDERS</B>         ORDEREDON NAME           PARTNUM    QUANTITY REMARKS       =========== ========== =========== =========== =======15-MAY-1996 TRUE WHEEL          23           6 PAID19-MAY-1996 TRUE WHEEL          76           3 PAID 2-SEP-1996 TRUE WHEEL          10           1 PAID30-JUN-1996 TRUE WHEEL          42           8 PAID30-JUN-1996 BIKE SPEC           54          10 PAID30-MAY-1996 BIKE SPEC           10           2 PAID30-MAY-1996 BIKE SPEC           23           8 PAID17-JAN-1996 BIKE SPEC           76          11 PAID17-JAN-1996 LE SHOPPE           76           5 PAID 1-JUN-1996 LE SHOPPE           10           3 PAID 1-JUN-1996 AAA BIKE            10           1 PAID 1-JUL-1996 AAA BIKE            76           4 PAID 1-JUL-1996 AAA BIKE            46          14 PAID11-JUL-1996 JACKS BIKE          76          14 PAID</FONT></PRE><H5><FONT COLOR="#000000">INPUT/OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF"><B>SELECT * FROM PART</B>    PARTNUM DESCRIPTION                PRICE=========== ==================== ===========         54 PEDALS                     54.25         42 SEATS                      24.50         46 TIRES                      15.25         23 MOUNTAIN BIKE             350.45         76 ROAD BIKE                 530.00         10 TANDEM                   1200.00</FONT></PRE><P>After you enter this data, the next step is to create an ODBC connection. Openthe Control Panel (if you are in Win 3.1, 3.11, or Windows 95) and double-click theODBC icon.<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Several flavors of SQL engines load	ODBC. Visual C++, Delphi, and Oracle7 load ODBC as part of their setup. Fortunately,	ODBC is becoming as common as printer drivers. <HR></BLOCKQUOTE><P>The initial ODBC screen is shown in Figure 14.6.</P><P><A NAME="06"></A><A HREF="06.htm"><B>Figure 14.6.</B></A></P><P><I>ODBC's Data Sources selection.</I></P><P>This screen shows the current ODBC connections. You want to create a new connection.Assuming you used InterBase and called the new database TYSSQL (give yourself 10bonus points if you know what TYSSQL stands for), press the Add button and selectthe InterBase Driver, as shown in Figure 14.7.</P><P><A NAME="07"></A><A HREF="07.htm"><B>Figure 14.7.</B></A></P><P><I>Driver selection.</I></P><P>From this selection you move to the setup screen. Fill it in as shown in Figure14.8.</P><P><A NAME="08"></A><A HREF="08.htm"><B>Figure 14.8.</B></A></P><P><I>Driver setup.</I></P><P>You can use your own name or something short and easy to type, depending on theaccount you set up for yourself. The only tricky bit here, at least for us, was figuringout what InterBase wanted as a database name. Those of you coming from a PC or smalldatabase background will have to get used to some odd-looking pathnames. These pathnamestell the SQL engine where to look for the database in the galaxy of computers thatcould be connected via LANs.<H2><FONT COLOR="#000077">Using Microsoft Query to Perform a Join</FONT></H2><P>Now that you have made an ODBC connection, we need to make a slight detour toa rather useful tool called Microsoft Query. This program is loaded along with VisualC++. We have used it to solve enough database and coding problems to pay for thecost of the compiler several times over. Query normally installs itself in its ownprogram group. Find it and open it. It should look like Figure 14.9.</P><P><A NAME="09"></A><A HREF="09.htm"><B>Figure 14.9.</B></A></P><P><I>Microsoft Query.</I></P><P>Select File | New Query. Your TYSSQL ODBC link does not appear, so click the Otherbutton to bring up the ODBC Data Sources dialog box, shown in Figure 14.10, and selectTYSSQL.</P><P><A NAME="10"></A><A HREF="10.htm"><B>Figure 14.10.</B></A></P><P><I>Data Sources dialog box.</I></P><P>Click OK to return to the Select Data Source dialog box. Select TYSSQL and clickUse, as shown in Figure 14.11.</P><P><A NAME="11"></A><A HREF="11.htm"><B>Figure 14.11.</B></A></P><P><I>Select Data Source dialog box.</I></P><P>Again, small database users aren't accustomed to logging on. Nevertheless, typeyour password to move through the screen.</P><P>The Add Tables dialog box, shown in Figure 14.12, presents the tables associatedwith the database to which you are connected. Select <TT>PART</TT>, <TT>ORDERS</TT>,and <TT>CUSTOMER</TT>, and click Close.</P><P><A NAME="12"></A><A HREF="12.htm"><B>Figure 14.12.</B></A></P><P><I>Selecting tables in Query.</I></P><P>Your screen should look like Figure 14.13. Double-click <TT>ADDRESS</TT> and <TT>NAME</TT>from the <TT>CUSTOMER</TT> table. Then double-click <TT>ORDEREDON</TT> and <TT>PARTNUM</TT>from <TT>ORDERS</TT>.</P><P><A NAME="13"></A><A HREF="13.htm"><B>Figure 14.13.</B></A></P><P><I>Visual representation of a table in Query.</I></P><P>Now for some magic! Click the button marked SQL in the toolbar. Your screen shouldnow look like Figure 14.14.</P><P><A NAME="14"></A><A HREF="14.htm"><B>Figure 14.14.</B></A></P><P><I>The query that Query built.</I></P><P>This tool has two functions. The first is to check the ODBC connection. If itworks here, it should work in the program. This step can help you determine whether

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆成人免费电影| 国产精品天干天干在观线| 九九**精品视频免费播放| 欧美精品一区二区三区蜜臀| 99综合影院在线| 麻豆精品视频在线观看视频| 国产日韩精品一区| 欧美一区二区免费| 色婷婷av一区二区三区软件 | 精品国产免费一区二区三区四区| 风流少妇一区二区| 欧美bbbbb| 日韩二区在线观看| 亚洲电影一区二区| 夜夜亚洲天天久久| 亚洲一区二区三区小说| 国产精品久久777777| 欧美变态tickle挠乳网站| 欧美视频一区在线| 欧美色图12p| 色婷婷亚洲婷婷| 成人av网站免费观看| 国产一区视频在线看| 日本不卡123| 久久成人精品无人区| 日韩成人一级片| 久国产精品韩国三级视频| 日韩精品亚洲一区| 国内偷窥港台综合视频在线播放| 欧美日韩成人一区| 欧美这里有精品| 欧美一区二区啪啪| 久久精品日韩一区二区三区| 欧美成人伊人久久综合网| 精品日韩av一区二区| 久久久国际精品| 国产精品免费视频观看| 亚洲欧美国产毛片在线| 一区二区三区小说| 日韩一区精品字幕| 国产精品 欧美精品| 91麻豆免费看| 日韩午夜电影av| 国产精品女同一区二区三区| 亚洲三级电影全部在线观看高清| 午夜精品福利在线| 韩国一区二区视频| 91黄色免费版| 欧美变态tickling挠脚心| 亚洲三级免费观看| 国产在线视频不卡二| 在线欧美日韩精品| 亚洲国产精品国自产拍av| 亚洲精品视频一区二区| 激情文学综合丁香| 欧美高清性hdvideosex| 亚洲精品中文在线| 成人小视频在线| 337p粉嫩大胆噜噜噜噜噜91av| 国产精品久久午夜夜伦鲁鲁| 亚洲一二三区视频在线观看| 懂色av一区二区在线播放| 91精品视频网| 丝袜a∨在线一区二区三区不卡| 成人在线综合网| 国产亚洲欧美色| 国内精品伊人久久久久av一坑 | 国产ts人妖一区二区| 91精品国产高清一区二区三区蜜臀| 亚洲欧洲性图库| 国产精品影视在线观看| 日韩精品一区二区在线| 全部av―极品视觉盛宴亚洲| 欧美一区二区三区在线| 亚洲国产裸拍裸体视频在线观看乱了| 成人av高清在线| 亚洲欧洲精品一区二区三区 | 久久99久久久欧美国产| 欧美一区二区三区视频在线观看| 亚洲国产视频直播| 欧美一三区三区四区免费在线看| 日韩中文欧美在线| 精品国产乱码久久久久久影片| 午夜国产不卡在线观看视频| 欧美在线不卡一区| 久久国内精品自在自线400部| 久久综合色天天久久综合图片| 国产一区二区在线观看免费| 国产精品久久久久久久久免费桃花 | 在线精品视频一区二区| 三级欧美在线一区| 国产欧美一区二区精品忘忧草 | 欧美日韩国产综合视频在线观看 | 国产麻豆视频精品| 亚洲欧美一区二区在线观看| 在线观看一区不卡| 久久精品国产999大香线蕉| 亚洲欧美自拍偷拍| 欧美精品一区二区三区在线| 91在线视频18| 玖玖九九国产精品| 亚洲码国产岛国毛片在线| 日韩精品在线一区二区| 91福利在线免费观看| 国产风韵犹存在线视精品| 亚洲成人av免费| 成人免费小视频| 久久综合狠狠综合久久综合88 | 久久久久久久久久久久电影| 欧美亚洲一区三区| 91理论电影在线观看| 国产麻豆成人传媒免费观看| 午夜电影网一区| 日日摸夜夜添夜夜添精品视频| 日韩毛片视频在线看| 中文字幕乱码日本亚洲一区二区 | 欧美大尺度电影在线| 在线观看国产一区二区| 色婷婷久久99综合精品jk白丝| 成人av综合在线| av网站免费线看精品| 丁香天五香天堂综合| 国内国产精品久久| 国产91精品精华液一区二区三区 | 欧美电影免费观看高清完整版在线 | 一区二区三区国产精华| 综合亚洲深深色噜噜狠狠网站| 欧美国产日韩a欧美在线观看| 日韩精品一区国产麻豆| 久久伊人蜜桃av一区二区| 久久婷婷国产综合国色天香| 久久亚洲精品国产精品紫薇| 欧美一二三在线| 欧美精品一区二区高清在线观看| 久久综合狠狠综合久久激情| 国产色爱av资源综合区| 国产精品久久免费看| 亚洲成人自拍偷拍| 极品少妇一区二区三区精品视频 | 久久丝袜美腿综合| 日韩美女久久久| 久久99精品国产.久久久久久| 国产一区二区在线观看免费| jlzzjlzz欧美大全| 欧美精品在线视频| 久久婷婷成人综合色| 亚洲天堂2014| 久久超碰97中文字幕| 99热国产精品| 日韩亚洲欧美综合| 亚洲天堂精品在线观看| 麻豆91精品91久久久的内涵| 99久久精品免费观看| 91 com成人网| 成人免费小视频| 国产成人精品免费在线| 欧美一区二区女人| 亚洲444eee在线观看| 粉嫩aⅴ一区二区三区四区| 日韩精品中文字幕在线一区| 亚洲综合免费观看高清在线观看| 国产成a人亚洲| 欧美成人一区二区| 美女视频黄 久久| 7777精品伊人久久久大香线蕉超级流畅 | 国产成人精品亚洲日本在线桃色| 91精品一区二区三区久久久久久| 亚洲欧洲综合另类| 北条麻妃国产九九精品视频| 中文字幕欧美日韩一区| 国产精品77777竹菊影视小说| 欧美不卡一二三| 国产尤物一区二区| 欧美激情中文不卡| av在线播放一区二区三区| 亚洲国产精品99久久久久久久久| 麻豆91免费看| 国产欧美一区在线| 成人久久视频在线观看| 亚洲人成亚洲人成在线观看图片 | 国产精品一区二区三区四区| 久久亚区不卡日本| 成人h动漫精品| 亚洲一区二区三区精品在线| 69久久99精品久久久久婷婷| 久久99国产精品麻豆| 中文字幕一区在线| 欧美人体做爰大胆视频| 美女精品自拍一二三四| 国产欧美一区二区精品性色超碰| 成人动漫一区二区三区| 一区二区三区成人| 欧美一级片免费看| 91一区二区三区在线观看| 日日噜噜夜夜狠狠视频欧美人| 国产午夜亚洲精品羞羞网站| 色综合久久久久综合体桃花网| 亚洲福利电影网| 中文字幕二三区不卡| 欧美一级一区二区|