it-e-40 Algorithms and Flowcharts

The computer scientist Niklaus Wirth stated that:
Programs = Algorithms + Data
The algorithm is part of the blueprint or plan for the computer program; an algorithm is:
"An effective procedure for solving a problem in a finite number of steps."
It is effective, which means that an answer is found and it finishes, that is it has a finite
number of steps. A well-designed algorithm will always provide an answer, and it may not be the
answer you want but there will be an answer. It may be that the answer is that there is no answer.
A well-designed algorithm is also guaranteed to terminate.
The key features of an algorithm are:
Sequence (also known as Process),
Decision (also known as Selection)
Repetition (also known as Iteration or Looping)
In 1964 the mathematicians Corrado Bohm and Guiseppe Jacopini demonstrated that any
algorithm can be stated using sequence, decision and repetition. The work of Bohm and Jacopini
was of great importance since it eventually led to the disciplines of structured program design
that are much used today.
Sequence means that each step or process in the algorithm is executed in the specified order.
In an algorithm each process must be in the correct place, otherwise the algorithm will most
probably fail.
The Decision constructsIf ... then, If ... then ... else ...
In algorithms the outcome of a decision is either true or false, and there is no in between.
The outcome of the decision is based on some condition that can only result in a true or false
The decision takes the form: if proposition then process
A proposition in this sense is a statement, which can only be true or false. It is either true
that today is Wednesday or false that today is Wednesday. It can't be both true and false. If the
proposition is true then the process, which follows the then, is executed.
The decision can also be stated as:
if proposition
then process1
else process2
This is the if ... then ... else ... form of the decision. This means that if the proposition is true

then execute process1 else or otherwise execute process2.
The first form of the decision if proposition then process has a null else, that is, there is no
The Repetition constructsRepeat and While
Repetition takes two forms, the Repeat loop and the While loop.
The repeat loop is used to iterate or repeat a process or sequence of processes until some
condition becomes true. It has the general form:
Until proposition
The repeat loop does some processing before testing the state of the proposition.
The while loop is used to iterate or repeat a process or sequence of processes while some
condition becomes true. It has the general form:
While proposition
The while loop tests the state of the proposition first.
There are four different ways of stating algorithms: Step-Form, Pseudocode, Flowchart, and
The first two are written forms. The written form is just normal language.[2]A problem with
human language is that it can seem to be imprecise. In terms of meaning, what I write may not be
the same as what you read.[3]Pseudocode is also human language but tends toward more precision
by using a limited vocabulary.
The last two are graphically-oriented, that is they use symbols and language to represent
sequence, decision and repetition.
Flow charts are a graphical method of designing programs and once
the rules are learned they are very easy to draw. A well-drawn flow chart
is also very easy to read.
The major symbols are the DECISION (also known as selection)
and the SEQUENCE (or process) symbols. The START and STOP symbols are called the
terminals. The SUBPROCESS symbol is a variation on the sequence symbol.

1, imprecise  [,impri'sais]
adj. 不精确的;不严密的;不确切的

Continue reading it-e-40 Algorithms and Flowcharts


rar的官方网站 上有使用各种语言调用unrar.dll解压缩的例子,但是没有使用java的jni的例子。

“File is not valid RAR archive” 我也做不了别的,只是将这个异常反映到java异常信息中。


unrar with jni, a java library

Continue reading 使用jni调用unrar

it-e-39 Database New Horizon

The modern database era began in 1970, when E.F. Codd published his paper "A Relational
Model of Data for Large Shared Data Banks." His ideas enabled the logical manipulation of data
to be independent of its physical location, greatly simplifying the work of application developers.
Now we are poised for another leap forward. Databases will scale to gargantuan proportions,
span multiple locations and maintain information in heterogeneous formats. And they will be
autonomous and self-tuning. The major database vendors are pursuing these goals in different
Thirty years ago, IBM researcher Selinger invented "cost-based" query optimization, by
which searches against relational databases such as IBM's DB2 minimized computer resources by
finding the most efficient access methods and paths. Now Selinger is leading an effort at IBM
called Leo for Learning Optimizer that she says will push DB2 optimization into a new
Rather than optimizing a query once, when it's compiled, Leo will watch production queries
as they run and fine-tune them as it learns about data relationships and user needs. For example,
Leo would come to realize that a ZIP code can be associated with only one state, or that a Camry
is made only by Toyota, even if those rules aren't specified in advance.
Selinger says Leo will be most helpful in large and complex databases, and in databases
where interdata relationships exist but aren't explicitly declared by database designers. Leo is
likely to be included in commercial releases of DB2 in about three years, she says.
Whether the future of databases is the traditional, relational and SQL model with XML
technologies incorporated into it or a new XML-based model is a matter of debate. XML will
become the dominant format for data interchange with its flexibility and ability to provide
self-description, according to Don Chamberlin, a database technology researcher at IBM.
Relational databeses, he said, will be fitted with front ends to support XML and process
queries based on the XQuery standard. XML will become the "lingua franca" for exchange of
data. "We'll also see some large relational systems adapt to XML as a native format,"Chamberlin
said.Technologists are in the early stages of development of XML technologies. SQL will not go
away, but there are new data formats for which it just was not designed, he said.
Sun's Rick Cattell, a distinguished engineer at the company, had a less dominant outlook for
XML, saying very few people are going to store XQuery data in an XML format."I think the
momentum behind relational databases is insurmountable,"Cattell said, adding that he was
drawing on his experience with object-oriented databases, which were unable to unseat relational
databases in enterprise IT shops. Developers, Cattell said, will need tools to convert relational
data to XML and vice versa.
Currently, performance on the Web is hindered because of translations between Java and
XML data formats. Eventually, an extension of XQuery will replace both Java and SQL

according to some experts.
The next step in the evolution of databases is to provide a more powerful way to query them
than what is being done on search sites such as Google today.
Experts are expecting tuple space technology, which is intended to make it easier to store and
fetch data by recognizing patterns. And in-memory databases technology is a "no-brainer,"but there is
not enough memory available yet to accommodate it.
Microsoft Corp. says users will never be persuaded to dump everything e-mail, documents,
audio/video, pictures, spreadsheets and so on into one gigantic database. Therefore, the
software vendor is developing technology that will allow a user to seamlessly reach across
multiple, heterogeneous data stores with a single query.
Microsoft's Unified Data project involves three steps. First, the company will devise
"schema" based on XML that define data types. Then it will develop methods for relating
different data types to each other and finally develop a common query mechanism for distributed
databases. For example, I want to search for a document that references Microsoft, and the
document "tells" the query that there's also a media file in another place that references
The technology will appear in 18 months in SQL Server. It will be added to other Microsoft
products in ensuing years.
Oracle Corp. says its customers are moving toward data stores of huge size and complexity,
spread over multiple locations. The company says its products will not only evolve to handle
those kinds of jobs, but will also do them extraordinarily well. "Over the next couple of releases,
we'll see essentially fully autonomous databases," says Robert Shimp, vice president of database
Oracle also wants to facilitate collaboration for people in different companies with widely
varying information types."What doesn't exist today is the underlying infrastructure, or plumbing,
that's capable of managing all these diverse types of data,"Shimp says."What you need is the
ability to link all these clustered databases around the globe into a single, unified view for the
individual user."
Elsewhere, researchers are finding that the best design for some database applications isn't a
traditional database at all, but rather data streams. Researchers at Stanford University are working
on ways that continuous flows of information—such as Web site hits, stock trades or
telecommunications traffic—can be passed through queries and then archived or discarded. A
query might, for example, be written to look continuously for suspicious patterns in network
traffic and then spit out an alert.
The problem in handling some kinds of problems with a traditional database management
system is one of timeliness, says Jennifer Widom, a computer science professor at Stanford. "If
you want to put a stream of data into a DBMS, you have to at some point stop, create a load file,
load the data and then query it,"she says. "Data stream queries are continuous; they just sit there
and give you new answers automatically."

Widom and her colleagues are developing algorithms for stream queries, and she says her
group will develop a comprehensive data stream management system. A prototype of such a
system will take a number of years to develop, and the underlying technology will then be either
licensed or offered as freeware, she says.

1, poise  [pɔiz]
n. 平衡,姿势,镇静
v. 使...平衡,保持平衡,保持...姿势

2, leap  [li:p]
n. 跳跃,剧增,急变
v. 跳跃,跃过,猛冲
a. 闰年的
3, gargantuan  [gɑ:'gæntjuən]
a. 巨大的,庞大的
4, proportions  [prə'pɔ:ʃəns]
n. 比例;大小(proportion的复数形式)
5, insurmountable  [,insə'mauntəbl]
adj. 不能克服的;不能超越的;难以对付的
6, momentum  [məu'mentəm]
n. 势头;[物] 动量;动力;冲力
7, unseat  [,ʌn'si:t]
vt. 罢免;剥夺…的席位;使失去资格;使从座位上(或马背上)摔下
8, persuade  [pə'sweid]
vt. 说服,劝说;使某人相信;劝某人做(不做)某事
vi. 说服;被说服
adj. 空闲的,有闲的
9, gigantic  [dʒai'gæntik]
a. 巨大的
10, heterogeneous  [,hetərəu'dʒi:njəs]
adj. [化学] 多相的;异种的;[化学] 不均匀的;由不同成分形成的
11, ensue  [in'sju:]
vi. 跟着发生,接着发生;继起
vt. 追求
12, facilitate  [fə'siliteit]
vt. 促进;帮助;使容易
13, diverse  [dai'və:s, di-]
adj. 不同的;多种多样的;变化多的

Continue reading it-e-39 Database New Horizon

it-e-38 Applications of Database

Database systems are designed to manage large bodies of information. [1]Management of
data involves both defining structures for storage of information and providing mechanisms for
the manipulation of information. In addition, the database system must ensure the safety of the
information stored, despite system crashes or attempts at unauthorized access. If data are to be
shared among several users, the system must avoid possible anomalous results.
Because information is so important in most organizations, computer scientists have
developed a large body of concepts and techniques for managing data.
Databases are widely used. Here are some representative applications:
Banking: For customer information, accounts, and loans, and banking transactions.
Airlines: For reservations and schedule information Airlines were among the first to use
databases in a geographically distributed mannerêterminals situated around the world accessed
the central database system through phone lines and other data networks.
Universities: For student information, course registrations, and grades.
Credit card transactions: For purchases on credit cards and generation of monthly statements.
Telecommunication: For keeping records of calls made, generating monthly bills, maintaining
balances on prepaid calling cards, and storing information about the communication networks.
Finance: For storing information about holdings, sales, and purchases of financial instruments
such as stocks and bonds.
Sales: For customer, product, and purchase information.
Manufacturing: For management of supply chain and for tracking production of items in
factories, inventories of items in warehouses/stores, and orders for items.
Human Resources: For information about employees, salaries, payroll taxes and benefits,
and for generation of paychecks.
Databases form an essential part of almost all enterprises today.
Over the course of the last four decades of the twentieth century, use of databases grew in
all enterprises. In the early days, very few people interacted directly with database systems,
although without realizing it they interacted with databases indirectlyêthrough printed reports
such as credit card statements, or through agents such as bank tellers and airline reservation
agents. Then automated teller machines came along and let users interact directly with databases.
Phone interfaces to computers (interactive voice response systems) also allowed users to deal
directly with databasesêa caller could dial a number, and press phone keys to enter information
or to select alternative options, to find flight arrival/departure times, for example, or to register
for courses in a university.
The Internet revolution of the late 1990s sharply increased direct user access to databases.
Organizations converted many of their phone interfaces to databases into Web interfaces, and

made a variety of services and information available online. For instance, when you access an
online bookstore and browse a book or music collection, you are accessing data stored in a
database. When you enter an order online, your order is stored in a database. When you access a
bank Web site and retrieve your bank balance and transaction information, the information is
retrieved from the bank's database system. When you access a Web site, information about you
may be retrieved from a database, to select which advertisements should be shown to you.
Furthermore, data about your Web accesses may be stored in a database.
Thus, although user interfaces hide details of access to a database, and most people are not
even aware they are dealing with a database, accessing databases forms an essential part of
almost everyone's life today.
The importance of database systems can be judged in another way today, database system
vendors like Oracle are among the largest software companies in the world, and database systems
form an important part of the product line of more diversified companies like Microsoft and IBM.


1, despite  [dis'pait]
prep. 不管,尽管

2, anomalous  [ə'nɔmələs]
adj. 异常的;不规则的;不恰当的

3, payroll  ['peirəul]
n. 工资单(计算报告表)
4, diversified  [dai'və:sifaid, di-]
adj. 多样化的;各种的
v. 使…多样化(diversify的过去分词)

Continue reading it-e-38 Applications of Database


Locale Language code LCID string Decimal Hexadecimal Codepage

Afrikaans             af            af            1078       436         1252

Albanian              sq           sq           1052                       1250

Amharic               am          am          1118                      

Arabic - Algeria  ar            ar-dz      5121       1401       1256

Arabic - Bahrain                ar            ar-bh     15361                    1256

Arabic - Egypt    ar            ar-eg     3073                       1256

Arabic - Iraq        ar            ar-iq       2049       801         1256

Arabic - Jordan  ar            ar-jo      11265                    1256

Arabic - Kuwait  ar            ar-kw    13313    3401       1256

Arabic - Lebanon              ar            ar-lb       12289    3001       1256

Arabic - Libya     ar            ar-ly       4097       1001       1256

Arabic - Morocco              ar            ar-ma    6145       1801       1256

Arabic - Oman   ar            ar-om    8193       2001       1256

Arabic - Qatar    ar            ar-qa     16385    4001       1256

Arabic - Saudi Arabia       ar            ar-sa      1025       401         1256

Arabic - Syria      ar            ar-sy      10241    2801       1256

Arabic - Tunisia  ar            ar-tn      7169                       1256

Arabic - United Arab Emirates    ar            ar-ae     14337    3801       1256

Arabic - Yemen ar            ar-ye     9217       2401       1256

Armenian            hy           hy           1067                      

Assamese           as            as            1101                      

Azeri - Cyrillic     az            az-az      2092                       1251

Azeri - Latin        az            az-az      1068                       1254

Basque eu           eu           1069                       1252

Belarusian           be           be           1059       423         1251

Bengali - Bangladesh      bn           bn           2117       845        

Bengali - India    bn           bn           1093       445        

Bosnian                bs           bs           5146                      

Bulgarian             bg           bg           1026       402         1251

Burmese              my          my          1109       455        

Catalan ca            ca            1027       403         1252

Chinese - China zh           zh-cn     2052       804        

Chinese - Hong Kong SAR             zh           zh-hk     3076                      

Chinese - Macau SAR     zh           zh-mo   5124       1404      

Chinese - Singapore        zh           zh-sg     4100       1004      

Chinese - Taiwan              zh           zh-tw    1028       404        

Croatian               hr            hr            1050                       1250

Czech    cs            cs            1029       405         1250

Danish  da           da           1030       406         1252

Divehi; Dhivehi; Maldivian            dv           dv           1125       465        

Dutch - Belgium                nl            nl-be     2067       813         1252

Dutch - Netherlands       nl            nl-nl       1043       413         1252

Edo                                        1126       466        

English - Australia             en           en-au    3081                       1252

English - Belize  en           en-bz    10249    2809       1252

English - Canada               en           en-ca     4105       1009       1252

English - Caribbean          en           en-cb    9225       2409       1252

English - Great Britain     en           en-gb    2057       809         1252

English - India    en           en-in     16393    4009      

English - Ireland                en           en-ie     6153       1809       1252

English - Jamaica               en           en-jm    8201       2009       1252

English - New Zealand    en           en-nz    5129       1409       1252

English - Phillippines       en           en-ph    13321    3409       1252

English - Southern Africa               en           en-za     7177                       1252

English - Trinidad              en           en-tt      11273                    1252

English - United States   en           en-us    1033       409         1252

English - Zimbabwe         en                           12297    3009       1252

Estonian               et            et            1061       425         1257

Faroese                fo            fo            1080       438         1252

Farsi - Persian    fa            fa            1065       429         1256

Filipino                                  1124       464        

Finnish  fi             fi             1035                       1252

French - Belgium              fr             fr-be      2060                       1252

French - Cameroon         fr                             11276                   

French - Canada               fr             fr-ca       3084                       1252

French - Congo fr                             9228                      

French - Cote d'Ivoire    fr                             12300                   

French - France fr             fr-fr        1036                       1252

French - Luxembourg     fr             fr-lu       5132                       1252

French - Mali      fr                             13324                   

French - Monaco              fr                             6156                       1252

French - Morocco            fr                             14348                   

French - Senegal              fr                             10252                   

French - Switzerland       fr             fr-ch      4108                       1252

French - West Indies      fr                             7180                      

Frisian - Netherlands                                      1122       462        

FYRO Macedonia              mk          mk          1071                       1251

Gaelic - Ireland  gd           gd-ie      2108                      

Gaelic - Scotland               gd           gd           1084                      

Galician                gl                             1110       456         1252

Georgian             ka                           1079       437        

German - Austria             de           de-at     3079                       1252

German - Germany         de           de-de    1031       407         1252

German - Liechtenstein                de           de-li       5127       1407       1252

German - Luxembourg  de           de-lu     4103       1007       1252

German - Switzerland    de           de-ch    2055       807         1252

Greek   el            el            1032       408         1253

Guarani - Paraguay          gn           gn           1140       474        

Gujarati                gu           gu           1095       447        

Hebrew                he           he           1037                       1255

HID (Human Interface Device)                                   1279                      

Hindi      hi            hi            1081       439        

Hungarian           hu           hu           1038                       1250

Icelandic              is             is             1039                       1252

Igbo - Nigeria                                     1136       470        

Indonesian         id            id            1057       421         1252

Italian - Italy       it             it-it         1040       410         1252

Italian - Switzerland        it             it-ch       2064       810         1252

Japanese             ja            ja            1041       411        

Kannada              kn           kn           1099                      

Kashmiri               ks            ks            1120       460        

Kazakh  kk           kk           1087                       1251

Khmer  km          km          1107       453        

Konkani                                                1111       457        

Korean ko           ko           1042       412        

Kyrgyz - Cyrillic                                  1088       440         1251

Lao         lo            lo            1108       454        

Latin      la             la             1142       476        

Latvian  lv             lv             1062       426         1257

Lithuanian           lt             lt             1063       427         1257

Malay - Brunei   ms          ms-bn   2110                       1252

Malay - Malaysia              ms          ms-my  1086                       1252

Malayalam          ml           ml           1100                      

Maltese               mt          mt          1082                      

Manipuri                                              1112       458        

Maori    mi           mi           1153       481        

Marathi                mr          mr          1102                      

Mongolian          mn         mn         2128       850        

Mongolian          mn         mn         1104       450         1251

Nepali   ne           ne           1121       461        

Norwegian - Bokml         nb           no-no    1044       414         1252

Norwegian - Nynorsk     nn           no-no    2068       814         1252

Oriya     or            or            1096       448        

Polish    pl            pl            1045       415         1250

Portuguese - Brazil          pt            pt-br      1046       416         1252

Portuguese - Portugal    pt            pt-pt      2070       816         1252

Punjabi pa           pa           1094       446        

Raeto-Romance               rm          rm          1047       417        

Romanian - Moldova      ro            ro-mo   2072       818        

Romanian - Romania      ro            ro            1048       418         1250

Russian ru            ru            1049       419         1251

Russian - Moldova           ru            ru-mo   2073       819        

Sami Lappish                                      1083                      

Sanskrit                sa            sa            1103                      

Serbian - Cyrillic                sr            sr-sp      3098                       1251

Serbian - Latin   sr            sr-sp      2074                       1250

Sesotho (Sutu)                                  1072       430        

Setsuana             tn            tn            1074       432        

Sindhi    sd           sd           1113       459        

Sinhala; Sinhalese            si             si             1115                      

Slovak   sk            sk            1051                       1250

Slovenian            sl             sl             1060       424         1250

Somali   so           so           1143       477        

Sorbian sb           sb           1070                      

Spanish - Argentina         es           es-ar      11274                    1252

Spanish - Bolivia                es           es-bo    16394                    1252

Spanish - Chile   es           es-cl       13322                    1252

Spanish - Colombia          es           es-co     9226                       1252

Spanish - Costa Rica        es           es-cr      5130                       1252

Spanish - Dominican Republic     es           es-do    7178                       1252

Spanish - Ecuador            es           es-ec     12298                    1252

Spanish - El Salvador       es           es-sv     17418                    1252

Spanish - Guatemala      es           es-gt      4106                       1252

Spanish - Honduras         es           es-hn    18442                    1252

Spanish - Mexico              es           es-mx   2058                       1252

Spanish - Nicaragua         es           es-ni      19466                    1252

Spanish - Panama            es           es-pa     6154                       1252

Spanish - Paraguay          es           es-py     15370                    1252

Spanish - Peru   es           es-pe    10250                    1252

Spanish - Puerto Rico     es           es-pr     20490                    1252

Spanish - Spain (Traditional)        es           es-es     1034                       1252

Spanish - Uruguay           es           es-uy     14346                    1252

Spanish - Venezuela       es           es-ve     8202                       1252

Swahili  sw          sw          1089       441         1252

Swedish - Finland             sv            sv-fi       2077                       1252

Swedish - Sweden           sv            sv-se     1053                       1252

Syriac                                    1114                      

Tajik       tg            tg            1064       428        

Tamil     ta            ta            1097       449        

Tatar      tt             tt             1092       444         1251

Telugu  te            te            1098                      

Thai        th            th            1054                      

Tibetan bo           bo           1105       451        

Tsonga  ts            ts            1073       431        

Turkish tr             tr             1055                       1254

Turkmen              tk            tk            1090       442        

Ukrainian             uk           uk           1058       422         1251

Unicode                               UTF-8    0                              65001

Urdu      ur            ur            1056       420         1256

Uzbek - Cyrillic   uz           uz-uz     2115       843         1251

Uzbek - Latin      uz           uz-uz     1091       443         1254

Venda                                   1075       433        

Vietnamese       vi             vi             1066                       1258

Welsh   cy            cy            1106       452        

Xhosa    xh           xh           1076       434        

Yiddish  yi             yi             1085                      

Zulu       zu           zu           1077       435

Continue reading 地区语系简码表

it-e-37 What is .NET

.NET is both a business strategy from Microsoft and its collection of programming support
for what are known as Web services, the ability to use the Web rather than your own computer for
various services. Microsoft's goal is to provide individual and business users with a seamlessly
interoperable and Web-enabled interface for applications and computing devices and to make
computing activities increasingly Web browser-oriented. The .NET platform includes servers;
building-block services, such as Web-based data storage; and device software. It also includes
Passport, Microsoft's fill-in-the-form-only-once identity verification service.
The .NET platform is expected to provide:
The ability to make the entire range of computing devices work together and to have user
information automatically updated and synchronized on all of them.
Increased interactive capability for Web sites, enabled by greater use of XML (Extensible
Markup Language) rather than HTML.
A premium online subscription service, that will feature customized access and delivery of
products and services to the user from a central starting point for the management of various
applications, such as e-mail, for example, or software, such as Office .NET.
Centralized data storage, which will increase efficiency and ease of access to information, as
well as synchronization of information among users and devices.
The ability to integrate various communications media, such as e-mail, faxes, and
For developers, the ability to create reusable modules, which should increase productivity
and reduce the number of programming errors.
According to Bill Gates, Microsoft expects that .NET will have as significant an effect on
the computing world as the introduction of Windows. One concern being voiced is that
although .NET's services will be accessible through any browser, they are likely to function more
fully on products designed to work with .NET code.

The full release of .NET is expected to take several years to complete, with intermittent
releases of products such as a personal security service and new versions of Windows and Office
that implement the .NET strategy coming on the market separately. Visual Studio .NET is a
development environment that is now available. Windows XP supports certain .NET capabilities.


1, interoperable  [,intə'ɔpərəbl]
adj. 彼此协作的;能共同操作的;能共同使用的
2, intermittent  [,intə(:)'mitənt]
a. 间歇的,断断续续的

Continue reading it-e-37 What is .NET




			var head = document.getElementsByTagName("head")[0];			
			var j = document.createElement("script");
			j.type = "text/javascript";
			if (c){
				var id='tpc'+new Date().getTime();
				src += '&jsonpid='+id;
                        //the response should call the function passed by jsonpid  
				window[id] = function(r){c(r);window[id]=null;};				
			j.onload = j.onreadystatechange = function() {
				if ((!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {		
                              //ie hack
					j.onload = j.onreadystatechange = null;
					if (head && j.parentNode) {
			j.src = src + '&tmp=' + new Date().getTime();






Continue reading 自己动手写jsonp

it-e-36 Brief Introduction of SQL

SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to
communicate with a database. According to ANSI, it is the standard language for relational
database management systems. SQL statements are used to perform tasks such as update data on
a database, or retrieve data from a database. Some common relational database management
systems that use SQL are:Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc. [1]Although
most database systems use SQL, most of them also have their own additional proprietary
extensions that are usually only used on their system. However, the standard SQL commands
such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish
almost everything that one needs to do with a database.
A relational database system contains one or more objects called tables. The data or
information for the database are stored in these tables. Tables are uniquely identified by their
names and are comprised of columns and rows. Columns contain the column name, data type,
and any other attributes for the column. Rows contain the records or data for the columns. Here is
a sample table called "weather".
City, state, high, and low are the columns. The rows contain the data for this table:

The select statement is used to query the database and retrieve selected data that match the
criteria that you specify. Here is the format of a simple select statement:
select "column1"
from "tablename"
[where "condition"];
[] = optional

The column names that follow the select keyword determine which columns will be returned
in the results. You can select as many column names that you'd like, or you can use a "*" to
select all columns.
The table name that follows the keyword from specifies the table that will be queried to
retrieve the desired results.
The where clause (optional) specifies which data values or rows will be returned or
displayed, based on the criteria described after the keyword where.
The create table statement is used to create a new table. Here is the format of a simple create
table statement:
create table "tablename"
("column1" "data type",
"column2" "data type",
"column3" "data type");
Format of create table if you were to use optional constraints:
create table "tablename"
("column1" "data type"
"column2" "data type"
"column3" "data type"
[ ] = optional
Note: You may have as many columns as you'd like, and the constraints are optional.
create table employee
(first varchar(15),
last varchar(20),
age number(3),
address varchar(30),
city varchar(20),
state varchar(20));
[2]To create a new table, enter the keywords create table followed by the table name,
followed by an open parenthesis, followed by the first column name, followed by the data type
for that column, followed by any optional constraints, and followed by a closing parenthesis. It is
important to make sure you use an open parenthesis before the beginning table, and a closing
parenthesis after the end of the last column definition. Make sure you separate each column
definition with a comma. All SQL statements should end with a ";".
The table and column names must start with a letter and can be followed by letters, numbers,

or underscores ê not to exceed a total of 30 characters in length. Do not use any SQL reserved
keywords as names for tables or column names (such as "select", "create", "insert", etc).
Data types specify what the type of data can be for that particular column. If a column
called "Last_Name", is to be used to hold names, then that particular column should have a
"varchar" (variable-length character) data type.
Note:Here are the most common data types:
char(size) Fixed-length character string. Size is specified in parenthesis. Max 255 bytes.
varchar(size) Variable-length character string. Max size is specified in parenthesis.
number(size) Number value with a max number of column digits specified in parenthesis.
Date Date value
Number value with a maximum number of digits of "size" total, with a
maximum number of "d" digits to the right of the decimal.
What are constraints? When tables are created, it is common for one or more columns to
have constraints associated with them. A constraint is basically a rule associated with a column
that the data entered into that column must follow. For example, a "unique" constraint specifies
that no two records can have the same value in a particular column. They must all be unique. The
other two most popular constraints are "not null" which specifies that a column can't be left blank,
and "primary key". A "primary key" constraint defines a unique identification of each record (or
row) in a table.
The insert statement is used to insert or add a row of data into the table.
To insert records into a table, enter the key words insert into followed by the table name,
followed by an open parenthesis, followed by a list of column names separated by commas,
followed by a closing parenthesis, followed by the keyword values, followed by the list of values
enclosed in parenthesis. The values that you enter will be held in the rows and they will match up
with the column names that you specify. Strings should be enclosed in single quotes, and
numbers should not.
insert into "tablename"
values (first_value,...last_value);
In the example below, the column name first will match up with the value 'Luke', and the
column name state will match up with the value 'Georgia'.
insert into employee
(first, last, age, address, city, state)
values ('Luke', 'Duke', 45, '2130 Boars Nest',
'Hazard Co', 'Georgia');
Note: All strings should be enclosed between single quotes: 'string'

Updating Records
The update statement is used to update or change records that match a specified criteria.
This is accomplished by carefully constructing a where clause.
update "tablename"
set "columnname" =
[,"nextcolumn" =
where "columnname"
OPERATOR "value"
[and|or "column"
OPERATOR "value"];
[ ] = optional
update phone_book
set area_code = 623
where prefix = 979;
update phone_book
set last_name = 'Smith', prefix=555, suffix=9292
where last_name = 'Jones';
update employee
set age = age+1
where first_name='Mary' and last_name='Williams';
Deleting Records
The delete statement is used to delete records or rows from the table.
delete from "tablename"
where "columnname"
OPERATOR "value"
[and|or "column"
OPERATOR "value"];
[ ] = optional
delete from employee;
Note: if you leave off the where clause, all records will be deleted!
delete from employee
where lastname = 'May';
delete from employee
where firstname = 'Mike' or firstname = 'Eric';

To delete an entire record/row from a table, enter "delete from" followed by the table name,
followed by the where clause which contains the conditions to delete. If you leave off the where
clause, all records will be deleted.
The drop table command is used to delete a table and all rows in the table.
To delete an entire table including all of its rows, issue the drop table command followed by
the table name. Drop table is different from deleting all of the records in the table. Deleting all of
the records in the table leaves the table including column and constraint information. Dropping
the table removes the table definition as well as all of its rows.
drop table "tablename"
drop table myemployees_ts0211;



1, clause  [klɔ:z]
n. 分句,从句,条款,款项

2, parenthesis  [pə'renθisis]
n. 括弧,插入语,附带
3, criteria 
n. 标准

Continue reading it-e-36 Brief Introduction of SQL

it-e-35 National Geochemical Database

The broad objective of this project is to maintain and enhance the National Geochemical
Database (NGDB). The NGDB consists of 1) the original RASS and PLUTO data from the
USGS labs, which are now stored in a common format under the ORACLE relational database
management system; 2) the NURE data, which have been reformatted and reside currently on the
following web site: where downloads may be made on
the basis of 1:250,000-scale quadrangles; and 3) the newly generated data (approximately 1996þ
present) which reside on the Laboratory Information Management System. The enhancements to
the NGDB will enable both USGS scientists and external customers to more easily extract
immediately useable data on a national, regional, and local scale to help establish a baseline for
the abundance and spatial distribution of chemical elements in the Earth's surficial materials.
Specific short-term objective include:
Linking the newly developed ORACLE-based database to the Laboratory Information

Management System (LIMS) to provide for the smooth transfer of newly generated data from the
LIMS to the NGDB.
Implement the new Sample Submittal Information procedure on a nationwide basis
throughout the USGS. This procedure has only been implemented at this time (June 2002) in the
Central Region. Without this new system in place, it is possible that more errors and omissions
regarding the nature and location of samples may be generated.
Complete the re-formatting of the NURE HSSR database based on 1:250,000-scale
quadrangles, compile the quadrangle-based data into one large data set, and provide these data to
the public via a web site and CD/DVD.
Complete the upgrading of archival USGS geochemical data for Alaska and release these to
the public via a web site and CD/DVD.
Initiate the upgrading of the remainder (non-Alaska) portion of the USGS-generated data.
Generate subsets of the master databases containing data in a format more useful to geochemists so
they do not have to wade through the process of extracting the data they need from the entire database.
Communicate and coordinate the work within this Project with other data delivery efforts
within the Bureau such as NatWeb, GEODE, and Spatial Data Delivery.
Produce map representations of the database showing the spatial variation of chemical
species throughout the nation and within sub-regions that are of priority to the USGS.
Relevance and Impact
An accurate, easily accessible geochemical database containing multi-element information
on the surficial materials of the nation is vital if the USGS is to respond quickly to earth science
issues raised by Congress and land management and environmental protection agencies. A
nationally consistent geochemical database provides baseline information on the natural
abundance and spatial variation of chemical elements to which changes caused by agricultural
and irrigation practices, waste disposal, urbanization, industrial pollution, mineral exploration
and mining activities, environmental induced and restoration activities, and other land-use
practices can be compared. Human-induced chemical changes to the environment are
superimposed on a variable natural geochemical background where trace-element abundances
can range over several orders of magnitude within short distances. These variations are
inadequately documented and their existence is often overlooked in the setting of public policy.
Important aspects of change cannot be measured, or their consequences anticipated, unless the
present composition of the earth's surface materials is known. In her 2000 Presidential address to
the Geological Society of America, Mary Lou Zoback identified six "grand challenges in earth
and environmental science". The first of these was "recognizing the signal within the natural
variability". Zoback stated that "documenting and understanding natural variability is a vexing
topic in almost every environmental problem. How do we recognize and understand changes in
natural systems if we don't understand the range of baseline values?" Preserving and enhancing
the vast amount of geochemical data within MRP's databases will provide a powerful tool for
addressing this "grand challenge". The ultimate goal of producing and electronically

disseminating the vast amount of geochemical data within MRP's databases directly supports
many of the goals and objectives as stated in the Science Strategy of the Geologic Division
(Bohlen and others, 1999). These databases are essential for understanding the relationship
between geologic processes and human health, ecosystem structure and function, and the
distribution of energy and mineral resources. This project also serves as the focal point of
requests for geochemical data from outside customers. From June 2001 through May 2002, the
predecessor project (National Geochemical Database Project) received over 100 requests for data
from Federal, state, and local government clients; private sector clients; and internal USGS
clients. At a conservatively estimated cost of $300 per sample for collection, preparation, and
chemical analysis, the geochemical databases under MRP management represent an expenditure
of over $500 million of taxpayer money. To realize the fullest possible return for this investment,
these data must be archived in perpetuity in an easily accessible and user-friendly format for full
utilization by the wide array of customers that need geochemical data to accomplish their work.


1, geochemical  [,dʒi:ə'kemikəl]
adj. 地球化学的

2, spatial  ['speiʃəl]
a. 空间的

3, surficial  [sə:'fiʃəl]
adj. 地表的;地面的

4, omission  [əu'miʃən]
n. 疏忽,遗漏;省略;冗长
5, quadrangle  ['kwɔdræŋɡl]
n. 四边形;方院
6, wade  [weid]
v. 跋涉
7, portion  ['pɔ:ʃən]
n. 部分,份,命运
v. 将...分配,分配
8, species  ['spi:ʃiz]
n. 物种,种类
9, relevance 
n. 中肯,适当,关联,相关性
10, irrigation  [,iri'geiʃən]
n. 灌溉
11, urbanization  [,ə:bənai'zeiʃən, -ni'z-]
n. 都市化;文雅化
12, remediation  [ri,mi:di'eiʃən]
n. 补救;矫正;补习
13, induced 
14, vexing 
adj. 烦恼
15, ecosystem  [i:kə'sistəm]
n. 生态系统

16, geologic  [dʒiə'lɔdʒik]
a. 地质的

17, predecessor  ['pri:disesə, 'pre-]
n. 前任,前辈

18, expenditure  [iks'penditʃə, eks-]
n. (时间、劳力、金钱等)支出,使用,消耗

19, perpetuity  [,pəpi'tjuiti]
n. 永恒,永久

Continue reading it-e-35 National Geochemical Database


Total views.

© 2013 - 2023. All rights reserved.

Powered by Hydejack v6.6.1