Sunday, October 24, 2010

When DB2 database query associated with the basic syntax



DB2 provides a relational database query language sql (structured query language), is a very colloquial, not only to learn it to understand syntax. This language is almost every database system must be provided to indicate the connection type, and contains a data definition (ddl), and data processing (dml). sql original spell sequel, the language of the prototype "system r" in the name of San Jose Laboratory ibm, ibm internal and the other through the use and efficiency of many tests, the results were satisfactory, and decided to Systems developed the technical basis of r ibm products. And the American National Standards Institute (ansi) and the International Organization for Standardization (iso) in 1987, followed by an almost standard ibm sql-based language of the definition of relational data.

First, data to define DDL (data definition language)

Data set language is that the format and form of information to define the language, he is every time the database should be established when the first had to confront that whenever the form data be divided relationship, what form of a bar-bit host key, forms and mutual relationship between the reference form, etc., all in the beginning of the planning that must be good.

1, built form:

create table table_name (column1 datatype [not null] [not null primary key], column2 datatype [not null], ...)

Description:

datatype - is the data format, see Table.

nut null - Can allow the information free of the (not yet have information to fill in).

primary key - primary key of this table.

2, change the form

alter table table_name add column column_name datatype

Description: Add a field (not delete a field syntax.

alter table table_name add primary key (column_name)

Note: change the definition of the table have a field to set the primary key.

alter table table_name drop primary key (column_name)

Note: the definition of the primary key to delete.

3, indexing

create index index_name on table_name (column_name)

Note: The fields of a table index to increase query speed.

4, delete

drop table_name drop index_name

Second, DDL Information form datatypes

smallint 16-bit integer.

interger 32-bit integer.

decimal (p, s) p s exact value and the size of a decimal integer, the exact value of p is the number of all there are several (digits) size value, s is some number after the decimal point. If not specified, the system will be set to p = 5; s = 0.

float 32-bit real number.

double 64-bit real number.

char (n) n-length string, n can not be more than 254.

varchar (n) length is not fixed and the maximum string length n, n can not be more than 4000.

graphic (n) and char (n) the same, but the unit is two words per double-bytes, n can not be more than 127. This form is to support the length of words per font, such as Chinese characters.

vargraphic (n) variable length and its maximum length n of the two-character string, n can not be more than 2000.

date contains the year, month, date.

time includes the hours, minutes, seconds.

timestamp contains the year, month, day, hour, minute, second, millisecond.

Third, data manipulation DML (data manipulation language)

Information after the definition of good is the information the next operation. Information on the operation of no more than increase the data (insert), query data (query), change the data (update), delete (delete) the four models, the following were to introduce their syntax:

1, additional information:

insert into table_name (column1, column2 ,...) values (value1, value2, ...)

Description:

1. If the column is not specified, the system will be in accordance with the order form fill in the information field.

2. Field data form and fill in the information which must be consistent.

3.table_name can also be a landscape view_name.

insert into table_name (column1, column2 ,...) select columnx, columny, ... from another_table

Note: You can also go through a sub-query (subquery) to fill in other forms of information.

2, the query information:

Basic Query

select column1, columns2, ... from table_name

Note: the table_name field-specific information to list out

select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table_name where column1 = xxx [and column2> yyy] [or column3 <> zzz]

Description:

1 .''''*'''' that all fields are listed.

2.where followed by conditional access, to meet the requirements of the information listed.

select column1, column2 from table_name order by column2 [desc]

Description: order by is specified to do a column sort, [desc] is the big to small order, if not specified, it is ordered from small to large

Combined query

Combination query is the query to information sources are not only a single form, but more than one form joint can get results.

select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table1, table2 where table1.colum1 = table2.column1

Description:

1. Query two tables in one of the column1 value of the same information.

2. Of course, comparing the two form fields, the information must be the same shape.

3. A complex query into the form of its use may be many months.

Integrated query:

select count (*) from table_name where column_name = xxx

Note: Query data meet the requirements of a few there.

select sum (column1) from table_name

Note: 1. Calculate the sum of the selected field must be countable number of forms.

2. In addition there are avg () is the calculation of the average, max (), min () minimum value of integration for calculating the maximum query.

select column1, avg (column2) from table_name group by column1 having avg (column2)> xxx

Description: 1.group by: to column1 column2 calculated as the average of a group must avg, sum and so integrated with the use of the keyword query.

2.having: must be used together as an integrated group by the restrictions.

Compound query

select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table_name1 where exists (select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table_name2 where conditions)

Description: 1.where the conditions can be another's query.

2.exists refers to the existence of.

select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table_name1 where column1 in (select column1 from table_name2 where conditions)

Note: 1. In the back then was a collection that exists column1 set inside.

2. Select out the information form must be consistent with column1.

Other inquiries

select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table_name1 where column1 like''''x %''''

Description: like to be and behind''''x %'''' echoes that start with x as string.

select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table_name1 where column1 in ('''' xxx'''','''' yyy'''',..)

Note: in the back then is a collection of collections that exist inside column1.

select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from table_name1 where column1 between xx and yy

Note: between the values that column1 between between xx and yy.

3, change the data:

update table_name set column1 ='''' xxx''''where conditoins

Description:

1. To change a field to set the value of''''xxx''''銆?br />
2.conditions is to be consistent with the conditions, if there is no where for the entire table of the field will all be changed.

4, delete:

delete from table_name where conditions

Description: Remove matching information.

Note: where the conditions on the back if the comparison includes the date, different databases have different expressions. As follows:

(1) If access the database, was: where mydate> # 2000-01-01 #

(2) If the oracle database, was: where mydate> cast ('''' 2000-01-01''''as date)

Or: where mydate> to_date ('''' 2000-01-01'''','''' yyyy-mm-dd'''')

Is written in delphi: thedate ='''' 2000-01-01'''';

query1.sql.add ('''' select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from abc where mydate> cast (''''+''''''''' '''''''+ thedate +''''''''''''''''+'''' as date )'''');

銆??濡傛灉姣旇緝鏃ユ湡鏃堕棿鍨嬶紝鍒欎负锛歸here mydatetime&gt;to_date(''''2000-01-01 10:00:01'''',''''yyyy-mm-dd hh24:mi:ss'''')







相关链接:



Enjoys a bandwidth 10M 20M 20M EXCLUSIVE exclusive special price



QT To WMV



3G: meat AND potatoes or hot potato



Intel shares NVIDIA?



WMV to QT



Easy File And Disk Management



Set number format to solve such problems arise when



Anti-Virus Tools Catalogs



FLV to SWF



Strategy And War Games Report



MAC and IP addresses tied to theft are no longer



Commfree 2006 Working Conference



Huang Guangyu has sent PEOPLE pretending to do retail Bureau of Zhongguancun



how to create PARTITION db2 database



UTM Revolution - Who can not have both fish and bear's paw?



Tuesday, October 19, 2010

"Cottage" can be "regularized"?



This reporter recently visited the "cottage phone" gathered in Shenzhen Huaqiang North Electronics Street, found that these low prices, looks like "name brand" to attract a large number of mobile phone consumers. At the same time, of those fake victory, "cottage" for infringement of intellectual property, quality, insecurity and so on, caused widespread doubts in the industry.

"Cottage" what should we do? Some experts suggested that should the "cottage" category-regulation, to encourage strong "cottage business" by adding "regular."

"Cottage" sales hot in Shenzhen a "cottage Street"

Spring Festival, reporters visited Shenzhen Huaqiang North Commercial Street, large and small, mobile communications market and found that each mobile communication market is surging crowd, a babel of voices. Many customers are working in the Shenzhen migrant workers, their purpose is very clear: to spend three or four hundred dollars, buy a glossy appearance, feature-rich "cottage" to the relatives and friends during Chinese New Year, "Xiu Xiu."

Futian, Shenzhen Bureau of Trade and Industry Branch of the relevant official told reporters, did not get mobile phone licenses (or record) in the domestic mobile phone production collectively referred to as "cottage." According to the statistics branch of the investigation to the end of 2007, Huaqiang North already has a communications and electronic manufacturing market 39, of which 10,000 square meters in size more than 35 electronic communications market, Huaqiang North peripheral aggregation and cell phone-related businesses more than 1000 , employing 20 people. While the market boom, "cottage" start breeding flooding. Today, almost every mobile phone, Huaqiang North telecommunications market have become a "cottage" in the world, only through the digital city of the Ming, Yuan Wang Digital Mall will have over 90 brands of the 5000 variety of "cottage" sales. One was selling "cottage" industry sources have told reporters, Huaqiang North's "cottage" with ten thousands of many.

Sales staff told reporters, buy "cottage" of consumers to low-income people, "some students, they catch the trend of constantly changing cell phones, this phone for a few hundred dollars they had." Reporter Yuan Wang Digital Mall to see a selection of mobile phones are being buried Zhou Hua, Zhou Hua, Shenzhen City, Bagualing a garment factory worker, he told reporters, his cell phone is the main entertainment, a market he could not resist a new "early adopters "Therefore, the past two years he has been replaced four phones.

And "cottage" is relatively hot sales, domestic mobile phone brand's market share shrinking, sales dropped significantly. Huaqiang North Although there are many brands mobile phone shop, but reporters saw the door, many consumers ask "Is there cottage", when the brand mobile phone shop attendant said "no", they turned away. Dongguan, China-made mobile phone brands, a survey said: "The cottage" accounted for 34% of domestic mobile phone market around. In the "cottage" of cheap campaign, the current number of domestic mobile phone brands with the basic operation is difficult to support, not to mention continue to invest funds to develop new products, build its own brand.

"Cottage" appeal: low prices, follow the trend of fast

"Cottage" of attractiveness? Reporter learned that "cottage" to bypass network detection limit, get rid of fast, cheap mobile phones produced, only one-third of mobile phone brand, price Most of 400 yuan, or even as low as 200.

In addition to cheap, the "cottage" the most attractive place to be "beside name brand", which follow the trend of the speed is really astounding. Longsheng engaged in wholesale mobile phone sales Song Zhang showed reporters a "cottage" version of the "iphone", which in appearance with the real "iphone" almost exactly the same screen on a real machine, accessories, weight, interface, memory Dengjun to 1:1 copy, with a finger touch screen, "album", "music", "games" and other icons, interface demonstrated one by one. But for the color screen and a real machine out there, this "cottage" really real ones had. This "cottage" the price is 780 yuan, but with a "iphone" real machine sells for more than 4000 yuan.

Huaqiang North reporter saw all kinds of mobile phone communications market, "Pong Brand" and "cottage", which in appearance and name brand mobile phones are very close, in order to avoid intellectual property issues, some of these phones is not printed on the brand identity, and some logo and brand to make the nuances of mobile phone: If "Dopuda" made "Donoda", "Samsung" made "Sumsung" and so on. In addition, some "cottage" in the counterfeit brand name, the on-screen settings, the keyboard's keys layout have also been slightly altered.

"Cottage" manufacturers A Strong told reporters that such "Pong brand" phone call "high imitation machine", its production chain in order to develop the mold of some leading enterprises specializing in mold development and production of popular models and mass production mobile phone accessories, plus a number of underground workshops only have a simple production tools can phone assembly. General brand new phone within 15 days of launch, "high imitation machines" can be mounted on the counter mobile communications market. "Cottage" factory was responsible for gathering information, was very sensitive, or even just play some brand mobile advertising, has not officially on the market, "cottage" factory had a "high imitation of" the same style of phone.

Experts suggest the "cottage" category-regulation

This reporter has learned, and now has formed around the Huaqiang North, a very large and complete "cottage" industry chain, include the composition of any one part of a mobile phone from the program design, software development, mold making, board accessories supply assembly processing, printing and packaging, to marketing, logistics, after-sales service nothing is there.

This complete industry chain Why did not into the "regular army" ranks, but insisted on a "cottage" service? "Cottage" A strong manufacturer told us that his cell phone and regular phone manufacturing production process compared to only just short of "corporate record" and "test sample network," these two links. A strong Why do not mobile phones, "regularization"? Because mobile networks have a tripartite test to test a model of mobile phone production, need to collect 50 phone sample test, detection time takes 1 month to 3 months , each test would cost mobile phone for more than 300,000 yuan. Detection of high costs and long test time strongly discouraged to A, so A strong despite their "cottage" status is not willing to, but still has yet to join the "regular army" ranks.

Futian, Shenzhen Bureau of Trade and Industry Deputy Chief of Branch of economic checks Yaoxue Xiong spoke in an interview in today's market and introduce new high speed mobile phone is an invaluable asset in the market, too long really test may force some companies to avoid network testing procedures and launched the "cottage." Yao Xuexiong that mobile phone technology into the basic shape has a new phone primarily in the appearance and add functionality to break through, network test threshold can be reduced to encourage more businesses to "regular."

Yao Xuexiong that the current "cottage" industry in both small workshops and also have a certain strength of large companies should be monitoring the implementation of classification, and can be "regularized" part of "cottage business" to boot. According to Yao Xuexiong introduction, Huaqiang North's "cottage" ABC can be divided into three categories: A class of machines including the lease of a corporate brand licensing, OEM mobile phone, "OEM machine," fake "OEM machine", and site without indicating the name of "light trigger" three; B class of machine is specially selling fake brand cell phone models "high imitation machines"; C class machine is a "refurbished aircraft," buy "high imitation of" famous brand mobile phones shell, set the old mobile phone chip board assembly is made.

Yao Xuexiong suggestions: for those who counterfeit brand to others, against the legal rights of others, to make illegal profits in the B, C class machines, we must resolutely combat; while those for "high threshold" and strayed into heterodox school of the A class machines, should be taken a more lenient policy, test results on product quality based on the quality of qualified encouraged to join the "regular army" substandard quality of the firm clean up the market.







Recommended links:



SWF to MP4



Mr. Chen: to gamble, it is worth doing the business of life



Green Manufacturing MES successes



PDM selection: impact of selection of the "ways of the world" elements



What conditions should be maliciously registered domain name?



Languages Education Expert



Flash To MPEG



DVR-MS to MPG



Evaluate Religion



Bohai Shipbuilding Heavy Industry UNDER the overall management planning branch of the digitization p



NAVIGATION car, continued to be the leading share of a firm business plan



Jscript Runtime Error 800a138f Object Clean Now



SOME tips on data collection



Confessions of an Advertising teachers: "Most people I did not tell him"



Specialist Remote Computing



The basic concepts of object-oriented



Tuesday, October 5, 2010

Column to add or modify the rules



Adding columns to a table of rules

What can home at any time is not specified as NOT NULL columns.

How to increase the NOT NULL column?

Click these steps:

1, increasing the column, but not set to NOT NULL.

2, this column data in each row are added.

3, this series was revised to NOT NULL.

Modify the rules set out:

Character at any time to increase the width of the column

Increase in number at any time, type out the number of bits

Can increase or decrease at any time type of the column number of digits after the decimal point

When the table is empty

Can change the data type

Reduce the column width of character

Small number can type out the median.

Re-create or delete table.







Recommended links:



pocket electronic translator as our assistant



SWF to MPEG4



3GP To MOV



FLV to M4V