JP2993530B2 - Sentence generator - Google Patents

Sentence generator

Info

Publication number
JP2993530B2
JP2993530B2 JP3151538A JP15153891A JP2993530B2 JP 2993530 B2 JP2993530 B2 JP 2993530B2 JP 3151538 A JP3151538 A JP 3151538A JP 15153891 A JP15153891 A JP 15153891A JP 2993530 B2 JP2993530 B2 JP 2993530B2
Authority
JP
Japan
Prior art keywords
join
sentence
database
search
clause
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP3151538A
Other languages
Japanese (ja)
Other versions
JPH052611A (en
Inventor
昭彦 湊
知樹 井上
正志 高井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP3151538A priority Critical patent/JP2993530B2/en
Publication of JPH052611A publication Critical patent/JPH052611A/en
Application granted granted Critical
Publication of JP2993530B2 publication Critical patent/JP2993530B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、データベースからデー
タを検索する文を自動生成する文生成装置であって、デ
ータベースを利用した検索システムにおいて、利用者が
簡単な指定のみで複雑な検索を行える文生成装置に関す
るものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a sentence generating apparatus for automatically generating a sentence for retrieving data from a database. In a search system using a database, a user can perform a complicated search only by a simple designation. The present invention relates to a sentence generation device.

【0002】[0002]

【従来の技術】一般のリレーショナル・データベース
は、問い合わせ言語(SQL)により、検索や登録など
を行う。SQL文を作成するためには、SQLの文法、
およびデータベース内のテーブル構造や複数テーブル間
のジョイン関係を把握していることが必要である。この
ため、リレーショナル・データベースの利用者は、専門
知識を有するものに限られ、一般の利用者はこの専門家
に依頼してSQL文を作成して検索などを行うようにし
ていた。
2. Description of the Related Art A general relational database performs a search, a registration, and the like in a query language (SQL). To create an SQL sentence, you need to use SQL grammar,
In addition, it is necessary to know the table structure in the database and the join relationship between a plurality of tables. For this reason, users of the relational database are limited to those who have specialized knowledge, and ordinary users request this expert to create an SQL sentence and perform a search or the like.

【0003】また、リレーショナル・データベースを利
用したデータベース検索システムの中には、SQL文を
自動的に生成するもの(例えば特開昭63−31153
1号)があるが、SQL文を生成できるリレーショナル
・データベース内の複数テーブル間のジョイン関係を簡
易なものに限定し、これらの間に限り、SQL文を自動
生成して検索するようにしていた。
Some database search systems that use a relational database automatically generate SQL statements (for example, Japanese Patent Application Laid-Open No. 63-31153).
No. 1), but the join relationship between a plurality of tables in a relational database that can generate SQL statements is limited to simple ones, and SQL statements are automatically generated and searched only between them. .

【0004】[0004]

【発明が解決しようとする課題】近年、上述したリレー
ションナル・データベースの問い合わせ言語であるSQ
Lが標準化されてきたが、この標準化されたSQLを使
用して検索などする場合、利用者に対して専門知識が要
求されてしまうという問題があった。また、上述したS
QL文を自動生成するシステムは、利用者の操作性を向
上させた代わりに、対象とするリレーションナル・デー
タベースの構造に制限が生じてしまうという問題があっ
た。これを解決するために、複雑な構造を持つリレーシ
ョンナル・データベースに対してもジョイン関係を含め
てSQL文などを自動生成することが要求されている。
Recently, SQ, which is a query language of the relational database described above, is used.
Although L has been standardized, there is a problem in that when searching is performed using this standardized SQL, the user is required to have specialized knowledge. In addition, the aforementioned S
A system that automatically generates a QL sentence has a problem in that the operability of the user is improved, but the structure of the target relational database is limited. In order to solve this, it is required to automatically generate an SQL statement and the like including a join relationship even for a relational database having a complicated structure.

【0005】本発明は、複数テーブル間のジョイン関係
を含めてデータベース検索用言語によるSQL文などを
自動生成し、簡易な操作のみで複雑な構造を持つリレー
ションナル・データベースのSQL文などを自動生成し
て検索可能にすることを目的としている。
The present invention automatically generates an SQL sentence or the like in a database search language including a join relationship between a plurality of tables, and automatically generates an SQL sentence or the like of a relational database having a complicated structure with only simple operations. It is intended to be searchable.

【0006】[0006]

【課題を解決するための手段】図1を参照して課題を解
決するための手段を説明する。図1において、データベ
ース情報3は、データベース7のテーブル名と当該テー
ブルの項目名の対に一意の番号を付与して予め登録した
ものである。
Means for solving the problem will be described with reference to FIG. In FIG. 1, the database information 3 is registered in advance by assigning a unique number to a pair of a table name of the database 7 and an item name of the table.

【0007】ジョインストリーム4は、データベース情
報3に予め登録した一意の番号の間のジョイン関係を抽
出してジョインのストリーム毎に設けたものである。文
生成部5は、検索条件、関係演算子、取り出し順番の入
力に対応して、データベース情報3およびジョインスト
リーム4を参照してデータベース7を検索する文(例え
ばSQL文)を生成するものである。
The join stream 4 is provided for each join stream by extracting a join relationship between unique numbers registered in advance in the database information 3. The sentence generation unit 5 generates a sentence (for example, an SQL sentence) for searching the database 7 with reference to the database information 3 and the join stream 4 in accordance with the input of the search condition, the relational operator, and the retrieval order. .

【0008】[0008]

【作用】本発明は、図1に示すように、予めデータベー
ス情報3およびジョインストリーム4を生成しておき、
検索画面上などから検索条件、関係演算子、取り出し順
番の入力に対応して、文生成部5がデータベース情報3
およびジョインストリーム4を参照してデーターベース
7を検索する検索用の文を生成するようにしている。こ
の際、検索用の文として、文生成部5がselect句
とパラメータ、from句とパラメータ、およびwhe
re句とパラメータからなるSQL文を生成するように
している。
According to the present invention, as shown in FIG. 1, database information 3 and join stream 4 are generated in advance,
In response to the input of a search condition, a relational operator, and a retrieval order from a search screen or the like, the sentence generator 5
Further, a search sentence for searching the database 7 with reference to the join stream 4 is generated. At this time, as a sentence for search, the sentence generation unit 5 sends the select clause and the parameter, the from clause and the parameter, and
An SQL statement including a re clause and parameters is generated.

【0009】従って、検索画面上などから検索条件、関
係演算子、取り出し順番を指定するという簡単な操作の
みで複雑な構造を持つデータベース7のSQL文などの
検索用文を自動生成することができる。そして、この自
動生成されたSQL文などの検索用文を用いてデータベ
ース7を検索などする。
Therefore, a search sentence such as an SQL sentence of the database 7 having a complicated structure can be automatically generated only by a simple operation of designating a search condition, a relational operator, and a retrieval order from a search screen or the like. . Then, the database 7 is searched using the automatically generated search sentence such as the SQL sentence.

【0010】[0010]

【実施例】次に、図1から図10を用いて本発明の実施
例の構成および動作を順次詳細に説明する。
Next, the configuration and operation of an embodiment of the present invention will be sequentially described in detail with reference to FIGS.

【0011】図1において、記憶装置1は、データ、プ
ログラムなどを格納するものであって、ここでは画面情
報2、データベース情報3、ジョインストリーム4、文
生成部5などを格納するものである。
In FIG. 1, a storage device 1 stores data, programs, and the like. Here, it stores screen information 2, database information 3, a join stream 4, a sentence generation unit 5, and the like.

【0012】画面情報2は、表示装置8の画面上に表示
する各種情報である。データベース情報3は、データベ
ース7を検索するための情報であって、テーブル名と当
該テーブル内の項目名との対に一意な番号を付与したも
のである(図2の(ロ)を用いて後述する)。
The screen information 2 is various information displayed on the screen of the display device 8. The database information 3 is information for searching the database 7, and is obtained by assigning a unique number to a pair of a table name and an item name in the table (to be described later with reference to FIG. Do).

【0013】ジョインストリーム4は、データベース7
のジョインのストリームを管理するものであって、例え
ば図2の(ロ)のジョインストリーム1、2、3などで
ある(図2の(ロ)を用いて後述する)。
The join stream 4 includes a database 7
And manages the join streams, for example, the join streams 1, 2, and 3 shown in (b) of FIG. 2 (described later using (b) of FIG. 2).

【0014】文生成部5は、検索画面上から利用者によ
って指定された検索条件、関係演算子、取り出し順番を
もとに、検索用文、ここではSQL文を自動生成するも
のである。
The sentence generator 5 automatically generates a search sentence, here an SQL sentence, based on a search condition, a relational operator, and a retrieval order specified by a user on a search screen.

【0015】プロセッサ6は、記憶装置1に格納された
プログラムをもとに各種処理、ここでは、文生成部5の
位置に格納されたプログラムに従って当該文生成部5の
処理を実行するものである。
The processor 6 executes various processes based on the programs stored in the storage device 1, here, the processes of the sentence generation unit 5 according to the programs stored at the positions of the sentence generation units 5. .

【0016】データベース7は、リレーションナル・デ
ータベースであって、テーブル名(例えば図2の(イ)
資料格納先、キーワード、従業員)と、当該テーブル内
の項目名(例えば資料番号、格納棚の名前など)を検索
可能な形で格納したものである。
The database 7 is a relational database, and has a table name (for example, (a) in FIG. 2).
The storage location of the material, the keyword, and the employee) and the item names (for example, the material number and the name of the storage shelf) in the table are stored in a searchable form.

【0017】表示装置8は、検索画面などを表示するも
のである。キーボード9は、検索画面などから検索条
件、関係識別子、取り出し順番などをキー入力したりな
どするものである。
The display device 8 displays a search screen and the like. The keyboard 9 is used for key input of a search condition, a relation identifier, a takeout order, and the like from a search screen or the like.

【0018】まず、図2を用いてジョインストリームに
よるデータ表現を説明する。図2の(イ)は、データベ
ース(リレーショナル・データベース)7内のテーブル
の例を示す。ここで、テーブル名は、“資料格納先”、
“キーワード”、“従業員”である。
First, data representation by a join stream will be described with reference to FIG. FIG. 2A shows an example of a table in the database (relational database) 7. Here, the table name is “data storage destination”,
“Keyword” and “Employee”.

【0019】項目名は、テーブル名“資料格納先”に格
納されている“資料番号”、“格納棚の名前”などであ
る。ジョインは、ここでは3つのテーブル名“資料格納
先”、“キーワード”、“従業員”の間の結合関係を表
わす。
The item names are "material number" stored in the table name "material storage destination", "storage shelf name" and the like. Here, the join represents a join relationship among three table names “material storage destination”, “keyword”, and “employee”.

【0020】ジョインストリームは、テーブル間のジョ
インをグループ化した名前である。例えばジョインスト
リーム1は、ここではジョインAのみのグループ名であ
って、図示のように“資料格納先”−ジョインA−“キ
ーワード”とジョイン関係を持つものである。
A join stream is a name that groups joins between tables. For example, the join stream 1 is a group name of only the join A here, and has a join relationship with "material storage destination" -join A- "keyword" as shown in the figure.

【0021】ジョインストリーム2は、ここではジョイ
ンAとジョインBのグループ名であって、図示のように
“資料格納先”−ジョインA−“キーワード”−ジョイ
ンB−“従業員”とジョイン関係を持つものである。
The join stream 2 is a group name of the join A and the join B in this case. As shown in the figure, a join relationship between “material storage destination”, “join A”, “keyword”, “join B”, and “employee” is shown. Have.

【0022】ジョインストリーム3は、ここではジョイ
ンAとジョインCのグループ名であって、図示のように
“資料格納先”−ジョインA−“キーワード”−ジョイ
ンC−“従業員””とジョイン関係を持つものである。
Here, the join stream 3 is a group name of the join A and the join C, and as shown in the drawing, a join relationship with "material storage destination" -join A- "keyword" -join C- "employee" With

【0023】ここで、ジョインストリームの定義方法を
以下に示す。 (1) データベース7内のテーブル間の全てのジョイ
ン関係を見つけだして図2の(イ)のように表現する。
Here, a method of defining a join stream will be described below. (1) Find all join relationships between tables in the database 7 and express them as shown in FIG.

【0024】(2) ジョインの経路を調べ、テーブル
名“資料格納先”のようにジョインが集中し、ジョイン
経路の始まりとなるテーブル名を1つ見つける。ここで
見つけたジョイン経路の出発点(頂点)となるテーブル
をメイン・テーブルと定義する。
(2) The path of the join is examined, and the joins are concentrated as in the table name “data storage destination”, and one table name that starts the join path is found. The table that is the starting point (vertex) of the join route found here is defined as the main table.

【0025】(3) メイン・テーブルからのジョイン
経路を全て調べ、グループ化する。このとき、図2の
(イ)のジョインBとジョインCのように、1つのテー
ブル名“キーワード”からジョイン経路が2つ以上に分
岐するときは、そのテーブルまでのジョイン経路を1つ
のグループとして定義する(後述する図2の(ロ)のジ
ョインストリーム1など参照)。
(3) Check all join paths from the main table and group them. At this time, when two or more join paths branch from one table name “keyword” as in the case of Join B and Join C in FIG. 2A, the join paths to that table are grouped as one group. (Refer to the join stream 1 in (b) of FIG. 2 described later).

【0026】図2の(ロ)は、ジョインストリームによ
るデータの表現例を示す。ここで、データベース情報3
は、テーブル名と当該テーブル内の項目名との対に一意
な番号を付与したものである。
FIG. 2B shows an example of expressing data by a join stream. Here, database information 3
Is obtained by assigning a unique number to a pair of a table name and an item name in the table.

【0027】ジョインストリーム1、2、3は、上述し
た図2の(イ)の(1)、(2)、(3)で説明したよ
うにして求めたジョインの1つのグループをジョインス
トリームとし、ジョイン元とジョイン先のデータベース
情報3中の一意な番号でジョイン関係を表現したもので
ある。例えばジョインストリーム1は、図2の(イ)で
記述したように、“資料格納先”−ジョインA−“キー
ワード”であるので、データベース情報3に点線で関係
づけたように、ジョイン元が番号“1”、ジョイン先が
番号“5”となる。
As the join streams 1, 2, and 3, one group of joins obtained as described in (1), (2), and (3) of FIG. The join relationship is represented by unique numbers in the database information 3 of the join source and the join destination. For example, the join stream 1 is “material storage destination” -join A- “keyword” as described in (a) of FIG. 2, so that the join source is numbered as related to the database information 3 by a dotted line. “1” and the join destination are number “5”.

【0028】同様に、ジョインストリーム2は、図2の
(イ)で記述したように、“資料格納先”−ジョインA
−“キーワード”−ジョインB−“従業員”であるの
で、ジョイン元が番号“1”、ジョイン先が番号
“5”、更にジョイン元の番号“7”、ジョイン先が番
号“11”となる。ここで、テーブル名“キーワード”
からテーブル名“従業員”のように2つ以上のジョイン
関係がある場合、ジョイン先のテーブル名に別名、ここ
では“作成従業員”を付与し、ジョイン先のテーブル名
を識別できるようにしておく。
Similarly, the join stream 2 is, as described in FIG. 2A, "material storage destination" -join A
-"Keyword" -Join B- "Employee", so the join source is number "1", the join destination is number "5", the join source number is "7", and the join destination is number "11". . Here, the table name "keyword"
If there is more than one join relationship such as the table name "Employee", an alias is given to the join destination table name, here "Create employee" so that the join destination table name can be identified. deep.

【0029】同様に、ジョインストリーム3は、図示の
ようになる。ここでは、2つ以上のジョイン関係がある
ので、ジョイン先のテーブル名に別名、ここでは“更新
従業員”を付与し、ジョイン先のテーブル名を識別でき
るようにしておく。
Similarly, the join stream 3 is as shown in the figure. Here, since there are two or more join relationships, an alias, "updated employee", is given to the join destination table name here so that the join destination table name can be identified.

【0030】以上の処理によって、本発明に係わるデー
タベース情報3およびジョインストリーム4を予め作成
する。次に、図3から図9を用い、検索画面から利用者
が検索条件、関係演算子、取り出し順番を入力したこと
に対応して、SQL文を自動生成する手順を順次詳細に
説明する。
With the above processing, the database information 3 and the join stream 4 according to the present invention are created in advance. Next, a procedure for automatically generating an SQL sentence in response to a user inputting a search condition, a relational operator, and a retrieval order from the search screen will be sequentially described in detail with reference to FIGS.

【0031】図3は、本発明の検索画面からの入力情報
説明図を示す。ここで、検索項目名は、検索画面上に表
示したものであって、既述した図2の(ロ)のデータベ
ース情報3のうちの検索対象の項目名を表わす番号、お
よびジョインストリーム4の番号に対応した検索対象の
項目名を表わす。
FIG. 3 is an explanatory diagram of input information from a search screen according to the present invention. Here, the search item name is displayed on the search screen, and is a number representing the item name of the search target in the database information 3 of FIG. Represents the item name of the search target corresponding to.

【0032】検索条件、関係演算子、取り出し順番は、
利用者が検索画面上からキー入力するフィールドであ
る。ここでは、図示のように、キー入力する。 “格納棚”の取り出し順番に“1” “格納引き出し”の取り出し順番に“2” “格納バインダ”の取り出し順番に“3” “資料名”の検索条件“X%”(X%はXで始まる任意
の文字列を表わす)、および関係演算子“like” “キーワード1”の検索条件“K”、および関係演算子
“=”(等しいを表わす) “作成者所属部名”の検索条件“A”、および関係演算
子“=” “作成者所属課名”の検索条件“B”、および関係演算
子“=” “更新者所属部名”の検索条件“C”、および関係演算
子“!=”(等しくないを表わす) データベース情報3の番号、ジョインストリーム4の番
号は、検索項目名に対応づけて内部で保持する情報であ
って、既述した図2の(ロ)のデータベース情報3中の
一意な番号およびジョインスリーム4の番号である。
The search condition, relational operator, and retrieval order are as follows:
This is a field for the user to enter a key on the search screen. Here, key input is performed as shown. "1" in the order of taking out the "storage shelf""2" in the order of taking out the "storage drawer""3" in the order of taking out the "storage binder""X%" (where X% is X) Starting character string) and the relational operator "like""Keyword1" search condition "K" and the relational operator "=" (representing equality) "creating department name" search condition ""A", search condition "B" of relational operator "=", "creator section name", search condition "C" of relational operator "=", "updater section name", and relational operator " The number of the database information 3 and the number of the join stream 4 are information held internally in association with the search item name, and the database information of FIG. 3 unique number and joins dream Which is a number.

【0033】以上のように検索画面上から利用者が表示
された検索項目名に対応づけて、検索条件、関係演算子
および取り出し順番のフィールドに図示のようにキー入
力すると、図1の文生成部5が、後述する図4のSQL
文を自動生成する。そして、この図4のSQL文を実行
すると、図1のデータベース7を検索し、後述する図1
0の検索結果を表示する。以下順次説明する。
As described above, when the user makes a key entry as shown in the search condition, relational operator, and retrieval order fields in association with the search item name displayed on the search screen, the sentence generation shown in FIG. The part 5 is an SQL of FIG.
Generate statements automatically. Then, when the SQL statement of FIG. 4 is executed, the database 7 of FIG. 1 is searched, and FIG.
The search result of 0 is displayed. This will be described sequentially below.

【0034】まず、図4を用いて自動生成する標準化さ
れたSQL文について説明する。図4において、SQL
文は、 select句+パラメータ from句+パラメータ where句+パラメータ で表現する。
First, a standardized SQL statement automatically generated will be described with reference to FIG. In FIG. 4, SQL
The statement is expressed by a select clause + parameter from clause + parameter where clause + parameter.

【0035】select句のパラメータには、図3で
キー入力した取り出し順番に、 “テーブル名.項目名” を自動作成する。ここでは、図示のように3組を自動作
成する(図6のフローチャートを用いて後述する)。
For the parameters of the select clause, "table name.item name" is automatically created in the order of retrieval by key input in FIG. Here, three sets are automatically created as shown (described later using the flowchart of FIG. 6).

【0036】where句のパラメータには、図3でキ
ー入力した検索条件および関係演算子などをもとに “テーブル名.項目名 関係演算子 ’検索条件’” を自動作成する(図7のフローチャートを用いて後述す
る)。別名があるときはテーブル名としてこの別名を優
先する。
As the parameters of the “where” clause, “table name.item name relational operator 'search condition'” is automatically created based on the search conditions and relational operators keyed in FIG. 3 (flow chart in FIG. 7). Will be described later). If there is an alias, this alias takes precedence as the table name.

【0037】from句のパラメータには、図3でキー
入力した検索条件および関係演算子などをもとに、検索
対象の全てのテーブル名を作成する(別名があるときは
別名も一緒に作成する)(図8のフローチャートを用い
て後述する)。
For the parameters of the from clause, all table names to be searched are created based on the search conditions and relational operators entered in FIG. 3 (if an alias exists, the alias is also created together). (This will be described later with reference to the flowchart of FIG. 8).

【0038】“テーブル名 別名” 以上の手順によって、図3の検索画面から入力された検
索条件、関係演算子および取り出し順番について行う
と、図4のSQL文が自動作成される。
"Table name alias" By the above procedure, when the search conditions, relational operators and retrieval order inputted from the search screen in FIG. 3 are performed, the SQL sentence in FIG. 4 is automatically created.

【0039】図5は、本発明の全体の動作説明フローチ
ャートを示す。図5において、S1は、検索画面(検索
項目の一覧)の表示を行う。これは、例えば図3の検索
項目名と、検索条件、関係演算子、取り出し順番のフィ
ールドを設けた検索画面を図1の表示装置8上に表示す
る。
FIG. 5 is a flowchart illustrating the overall operation of the present invention. In FIG. 5, S1 displays a search screen (list of search items). This displays a search screen provided with, for example, fields of the search item name of FIG. 3, a search condition, a relational operator, and a retrieval order on the display device 8 of FIG.

【0040】S2は、利用者による検索条件、関係演算
子、および取り出し順番の入力を行う。これは、S1で
表示した、例えば図3の検索条件、関係演算子、および
取り出し順番の入力フィールドに、利用者が図示によう
にキー入力する。
In step S2, the user inputs a search condition, a relational operator, and a retrieval order. For example, the user performs a key input as shown in the search condition, relational operator, and retrieval order input fields shown in FIG. 3 in S1.

【0041】S3は、セレクト・リスト(select
句のパラメータ)の作成を行う。このセレクト・リスト
は、検索結果についてデータベースから取り出す順番を
指定するものであって、後述する図6のフローチャート
の手順によって、図4のSQL文のselect句のパ
ラメータとして作成する。
S3 is a select list (select)
Clause parameters). This select list specifies the order in which search results are retrieved from the database, and is created as a parameter of the select clause of the SQL sentence of FIG. 4 by the procedure of the flowchart of FIG. 6 described later.

【0042】S4は、バインド・リスト(where句
のパラメータ)、およびバインド・ジョイン・リスト
(where句のパラメータ)の作成を行う。このバイ
ンド・リストは検索条件を指定、およびバインド・ジョ
イン・リストはバインド・リスト内のジョイン条件を指
定するものであって、後述する図7のフローチャートの
手順によって、図4のSQL文のwhere句のパラメ
ータとして作成する。
In step S4, a bind list (where clause parameter) and a bind join list (where clause parameter) are created. The bind list specifies a search condition, and the bind join list specifies a join condition in the bind list. The “where” clause of the SQL statement in FIG. Create as a parameter of.

【0043】S5は、テーブル・リスト(from句の
パラメータ)の作成を行う。このテーブル・リストは検
索対象のテーブルを指定するものであって、後述する図
8のフローチャートの手順によって、検索対象の全ての
テーブル(別名があるときは別名テーブルも一緒)のリ
ストをfrom句のパラメータとして作成する。
In step S5, a table list (from clause parameters) is created. This table list specifies a table to be searched, and a list of all tables to be searched (alias table together with an alias table, if any) is added to the list in the from clause by the procedure of the flowchart of FIG. Create as a parameter.

【0044】S6は、SQL文(select文)を完
成する。これは、後述する図9のフローチャートの手順
によって、select句+パラメータ、from句+
パラメータ、where句+パラメータを並べてSQL
文を作成する。
In step S6, the SQL sentence (select sentence) is completed. This is performed by the procedure of the flowchart of FIG.
SQL by arranging parameters, where clause + parameters
Create a statement.

【0045】S7は、SQL文(select文)の実
行を行い、データベース7から該当するデータを検索す
る。S8は、検索結果の表示を行う。これは、後述する
図10に示すように、検索結果を表示する。
In step S7, an SQL statement (select statement) is executed, and the corresponding data is retrieved from the database 7. In step S8, a search result is displayed. This displays a search result as shown in FIG. 10 described later.

【0046】図6は、本発明のセレクト・リスト(se
lect句のパラメータ)の作成フローチャートを示
す。これは、図5のS3の詳細手順を示し、検索結果を
データベース7から取り出す順番を指定するパラメータ
を作成する。以下説明文を簡単にするために、 DB番号:データベース番号 JS番号:ジョインストリーム番号 DB情報:データベース情報3 JS情報:ジョインストリーム4 とする。
FIG. 6 shows the select list (se
4 shows a flowchart for creating a parameter of a select clause. This shows the detailed procedure of S3 in FIG. 5, and creates a parameter that specifies the order in which search results are retrieved from the database 7. In order to simplify the description, DB number: database number JS number: join stream number DB information: database information 3 JS information: join stream 4

【0047】S31は、取り出し順番優先のDB番号と
JS番号を取り出す。これは、例えば図3の検索画面上
に入力された取り出し順番の優先、最初は1番のDB番
号“2”とJS番号“1”を取り出す。
In step S31, the DB number and the JS number with the priority of the take-out order are taken out. This means that, for example, the priority of the retrieval order input on the search screen in FIG. 3, the first DB number “2” and the JS number “1” are retrieved first.

【0048】S32は、DB情報から、DB番号のテー
ブル名、項目名を取り出す。このとき、JS情報から、
JS番号のテーブル別名があれば、優先的にテーブル名
として取り出す。例えばS31で取り出したDB番号
“2”をもとに、図2の(ロ)データベース情報3から
テーブル名“資料格納先”と項目名“格納棚”を取り出
す。このとき、S31で取り出したJS番号“1”をも
とに、図2の(ロ)のジョインストリーム1を参照する
が、ここでは別名テーブルが設定されていないので、何
もしない。
In step S32, the table name and the item name of the DB number are extracted from the DB information. At this time, from the JS information,
If there is a table alias of the JS number, it is preferentially taken out as the table name. For example, based on the DB number “2” extracted in S31, the table name “material storage destination” and the item name “storage shelf” are extracted from the (b) database information 3 of FIG. At this time, reference is made to the join stream 1 in (b) of FIG. 2 based on the JS number “1” extracted in S31, but here nothing is performed because the alias table is not set.

【0049】S33は、select句のパラメータと
して、“テーブル名.項目名”を設定する(例えば“資
料格納先.格納棚”)。例えば図4のの“資料格納
先.格納棚”を作成し、データベース7から最初に検索
結果として取り出す指定を行う。
In step S33, "table name. Item name" is set as a parameter of the select clause (for example, "material storage destination. Storage shelf"). For example, “material storage destination. Storage shelf” shown in FIG. 4 is created, and designation is first made to retrieve from the database 7 as a search result.

【0050】S34は、終わりか否かを判別する。YE
Sの場合には、終了する。NOの場合には、次の優先順
番について、S31からS33を繰り返し行い、結果と
して、 第1回目:図3の取り出し順番“1”につい
て、図4のの“資料格納先.格納棚”を作成する。
A step S34 decides whether or not it is the end. YE
In the case of S, the process ends. In the case of NO, S31 to S33 are repeated for the next priority order, and as a result, the first time: “material storage destination. Storage shelf” in FIG. 4 is created for the takeout order “1” in FIG. I do.

【0051】第2回目:図3の取り出し順番“2”につ
いて、同様に、“資料格納先.格納引き出し”を作成す
る。第3回目:図3の取り出し順番“3”について、同
様に、“資料格納先.格納バインダ”を作成する。
Second time: For the take-out order “2” in FIG. 3, “material storage destination. Storage drawer” is similarly created. Third time: For the extraction order “3” in FIG. 3, “material storage destination. Storage binder” is similarly created.

【0052】以上によって、利用者が図3の検索画面上
で検索結果の取り出し順番を指定することにより、その
検索結果の取り出し指定がselect句のパラメータ
(セレクト・リスト)として、図4の、およびこれに
続いて取り出し順に作成されることとなる。
As described above, when the user specifies the retrieval order of the retrieval results on the retrieval screen of FIG. 3, the retrieval of the retrieval results is specified as the parameter (select list) of the select clause in FIG. Following this, they are created in the order of extraction.

【0053】図7は、本発明のバインド・リスト(wh
ere句のパラメータ)およびバインド・ジョイン・リ
スト(where句のパラメータ)の作成フローチャー
トを示す。これは、図5のS4の詳細手順を示す。
FIG. 7 shows the bind list (wh
4 shows a flowchart for creating a bind clause (a parameter of a where clause) and a bind join list (a parameter of a where clause). This shows the detailed procedure of S4 in FIG.

【0054】S41は、検索条件が設定されているもの
の以下の取り出しを行う。 ・検索条件(例えば“X%”) ・関係演算子(例えば“like”) ・DB番号(例えばDB番号“6”) ・JB番号(例えばJS番号“1”) S42は、DB情報から、DB番号のテーブル名.項目
名を取り出す。このとき、JS情報から、JS番号のテ
ーブル別名があれば、優先的にテーブル名として取り出
す。例えばS41で取り出したDB番号“6”をもと
に、図2の(ロ)データベース情報3からテーブル名
“キーワード”と項目名“資料名”を取り出す。このと
き、S41で取り出したJS番号“1”をもとに、図2
の(ロ)のジョインストリーム1を参照するが、ここで
は別名テーブルが設定されていないので、何もしない。
In S41, the following retrieval is performed although the search condition is set. -Search condition (for example, "X%")-Relational operator (for example, "like")-DB number (for example, DB number "6")-JB number (for example, JS number "1") Number table name. Retrieve the item name. At this time, if there is a table alias of the JS number from the JS information, it is preferentially extracted as a table name. For example, based on the DB number “6” extracted in S41, the table name “keyword” and the item name “material name” are extracted from the (b) database information 3 of FIG. At this time, based on the JS number “1” extracted in S41, FIG.
Referring to the join stream 1 of (b), no operation is performed here because no alias table is set.

【0055】S43は、where句のパラメータとし
て、バインド・リスト(“テーブル名.項目名 関係演
算子 ’検索条件’”)を設定する(例えば図4のの
“キーワード.資料名 like ’X%’”)。
In step S43, a bind list ("table name. Item name relational operator 'search condition'") is set as a parameter of the "where" clause (eg, "keyword. Material name like" X% "in FIG. 4). ”).

【0056】S44は、where句のパラメータとし
て、バインド・ジョイン・リスト(“テーブル名.項目
名 = テーブル名.項目名)を設定する。例えば上述
したJS番号“1”から、図2の(ロ)のジョインスト
リーム1を見つけ、ジョイン関係にあるリストを、“キ
ーワード.資料番号 = 資料格納先.資料番号”とし
て設定する(図4の)。
In step S44, a bind join list ("table name.item name = table name.item name") is set as a parameter of the "where" clause. ) Is found, and the list related to the join is described as “keyword. Document number = Data storage location. It is set as "material number" (FIG. 4).

【0057】S45は、終りか否かを判別する。YES
の場合には、終了する。NOの場合には、次のものにつ
いて、S41からS44を繰り返し行い、結果として、
図3の検索項目名“資料名”について、図4の、を
作成する。同様に、図4に示すように、同じJS番号の
ものをまとめて作成する。
In the step S45, it is determined whether or not the processing is over. YES
In the case of, the process ends. In the case of NO, S41 to S44 are repeated for the following, and as a result,
For the search item name “material name” in FIG. Similarly, as shown in FIG. 4, those having the same JS number are collectively created.

【0058】以上によって、利用者が図3の検索画面上
で検索条件、関係演算子を指定することにより、whe
re句のパラメータ(バインド・リストおよびバインド
・ジョイン・リスト)が図4のJS番号毎に図示のよう
に作成されることとなる。
As described above, when the user specifies a search condition and a relational operator on the search screen of FIG.
The parameters of the re clause (the bind list and the bind join list) are created as shown for each JS number in FIG.

【0059】図8は、本発明のテーブル・リスト(fr
om句のパラメータ)の作成フローチャートを示す。こ
れは、図5のS5の詳細手順を示す。S51は、sel
ect句およびwhere句のパラメータ設定(作成)
で対象となったテーブル名、および、あればそのテーブ
ル別名から、from句のパタメータとして、テーブル
・リスト(テーブル名 テーブル別名)を設定する。こ
れは、例えば図3の作成者所属部名について、検索条件
“A”、関係演算子“=”を指定したとき、JS番号
“2”の図2の(ロ)ジョインストリーム2を参照した
ときにテーブル別名“作成従業員”が設定されているの
で、ここでは、テーブル・リスト“作業員 作成従業
員”を図4のに設定する。
FIG. 8 is a table list (fr) according to the present invention.
5 shows a flowchart for creating an om phrase parameter). This shows the detailed procedure of S5 in FIG. S51 is sel
Parameter setting (creation) of ect clause and where clause
A table list (table name table alias) is set as a parameter of the from clause from the target table name and the table alias, if any. This is, for example, when the search condition “A” and the relational operator “=” are specified for the creator affiliation name in FIG. 3, and when the (B) join stream 2 in FIG. In this example, the table list "Worker Created Employee" is set as shown in FIG.

【0060】S52は、終りか否かを判別する。YES
の場合には、終了する。NOの場合には、次のものにつ
いて、S51を繰り返し行う。以上によって、利用者が
図3の検索画面上で検索条件、関係演算子を指定するこ
とにより、select句およびwhere句のパラメ
ータ設定で対象となった全てのテーブル名および、あれ
ばテーブル別名がfrom句のパラメータとして作成さ
れることとなる。
A step S52 decides whether or not it is the end. YES
In the case of, the process ends. In the case of NO, S51 is repeated for the following items. As described above, when the user specifies the search condition and the relational operator on the search screen in FIG. 3, all the table names targeted for the parameter setting of the select clause and the where clause and the table aliases, if any, are set. It will be created as a parameter of the phrase.

【0061】図9は、本発明のSQL文(select
文)の完成フローチャートを示す。これは、図5のS6
の詳細手順を示す。 S61は、SQL文(select文) select句+パラメータ from句+パラメータ where句+パラメータ を作成する。これは、 図6で作成したselect句のパラメータ 図8で作成したfrom句のパラメータ 図7で作成したwhere句のパラメータ について、SQL文(select文)の順番に並び換
えたりし、図4のSQL文を作成する。
FIG. 9 shows an SQL statement (select) according to the present invention.
(Sentence) is shown below. This corresponds to S6 in FIG.
The detailed procedure will be described. In S61, an SQL sentence (select sentence) select clause + parameter from clause + parameter where clause + parameter is created. This is achieved by rearranging the parameters of the select clause created in FIG. 6, the parameters of the from clause created in FIG. 8, and the parameters of the where clause created in FIG. 7 in the order of the SQL sentence (select sentence). Create a statement.

【0062】図10は、本発明の検索結果の表示例を示
す。これは、図5のS8の検索結果の具体的な表示例を
示す。S71は、取り出し順番指定したテーブルの項目
について、検索結果を表示する。ここで表示した表示結
果は、図3の検索画面から図示のように設定し、図4の
SQL文を自動作成して実行し、その結果を表示したも
のである。
FIG. 10 shows a display example of the search result of the present invention. This shows a specific display example of the search result in S8 of FIG. In step S71, a search result is displayed for the item of the table whose extraction order is specified. The display results displayed here are set from the search screen of FIG. 3 as shown, automatically create and execute the SQL sentence of FIG. 4, and display the results.

【0063】[0063]

【発明の効果】以上説明したように、本発明によれば、
データベース7のテーブル名と当該テーブル内の項目名
の対に一意の番号を付与して登録するデータベース情報
3、およびジョイン関係を抽出したジョインストリーム
4を設け、検索画面上から利用者から指定された検索条
件、関係演算子、取り出し順番の入力に対応して、デー
タベース情報3およびジョインストリーム4を参照して
データベース7を検索する文を自動生成する構成を採用
しているため、検索条件、関係演算子、取り出し順番を
指定するという簡単な操作のみで、複雑な構造を持つデ
ータベース7を検索できるSQL文などの検索用文を自
動生成することができる。そして、この自動生成したS
QL文などの検索用文を実行し、データベース7を検索
してその検索結果を表示することが可能となる。
As described above, according to the present invention,
A database information 3 for registering a pair of a table name of the database 7 and an item name in the table by assigning a unique number thereto, and a join stream 4 in which a join relationship is extracted are provided, and are specified by a user on a search screen. Since a configuration for automatically generating a sentence for searching the database 7 by referring to the database information 3 and the join stream 4 in response to the input of the search condition, the relational operator, and the retrieval order is employed, the search condition and the relation operation A search sentence such as an SQL sentence that can search the database 7 having a complicated structure can be automatically generated only by a simple operation of designating a child and a retrieval order. And this automatically generated S
By executing a search sentence such as a QL sentence, it becomes possible to search the database 7 and display the search result.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の1実施例構成図である。FIG. 1 is a configuration diagram of one embodiment of the present invention.

【図2】本発明のジョインストリームによるデータ表現
図である。
FIG. 2 is a data representation diagram using a join stream according to the present invention.

【図3】本発明の検索画面からの入力情報説明図であ
る。
FIG. 3 is an explanatory diagram of input information from a search screen according to the present invention.

【図4】本発明のSQL文例である。FIG. 4 is an example of an SQL sentence according to the present invention.

【図5】本発明の全体の動作説明フローチャートであ
る。
FIG. 5 is a flowchart for explaining the overall operation of the present invention.

【図6】本発明のセレクト・リスト(select句の
パラメータ)の作成フローチャートである。
FIG. 6 is a flowchart for creating a select list (select clause parameter) according to the present invention.

【図7】本発明のバインド・リスト(where句のパ
ラメータ)およびバインド・ジョイン・リスト(whe
re句のパラメータ)の作成フローチャートである。
FIG. 7 shows a bind list (a parameter of a where clause) and a bind join list (a where clause) of the present invention.
9 is a flowchart for creating a parameter (re clause).

【図8】本発明のテーブル・リスト(from句のパラ
メータ)の作成フローチャートである。
FIG. 8 is a flowchart for creating a table list (from clause parameters) according to the present invention.

【図9】本発明のSQL文(select文)の完成フ
ローチャートである。
FIG. 9 is a completed flowchart of an SQL statement (select statement) according to the present invention.

【図10】本発明の検索結果の表示例である。FIG. 10 is a display example of a search result of the present invention.

【符号の説明】[Explanation of symbols]

1:記憶装置 2:画面情報 3:データベース情報 4:ジョインストリーム 5:文生成部 6:プロセッサ 7:データベース 8:表示装置 9:キーボード 1: Storage device 2: Screen information 3: Database information 4: Join stream 5: Sentence generator 6: Processor 7: Database 8: Display device 9: Keyboard

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 平1−181125(JP,A) 特公 平2−17815(JP,B2) (58)調査した分野(Int.Cl.6,DB名) G06F 17/30 G06F 12/00 512 ──────────────────────────────────────────────────続 き Continuation of the front page (56) References JP-A-1-181125 (JP, A) JP-B-2-17815 (JP, B2) (58) Fields investigated (Int. Cl. 6 , DB name) G06F 17/30 G06F 12/00 512

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】データベースからデータを検索する文を自
動生成する文生成装置において、 データベースのテーブル名と当該テーブル内の項目名
の対に一意の番号を付与して登録するデータベース情報
記憶部と、 前記データベース情報記憶部に登録した一意の番号の間
のジョイン関係を抽出し、複数のテーブルにわたるジョ
インのストリーム毎に設けた複数のジョインストリーム
と、 検索条件、関係演算子、取り出し順番の入力に対して、
上記データベース情報記憶部および前記複数のジョイン
ストリームに基づきデータベースを検索する文を生成す
る文生成とを備え、 この生成した文を出力するように構成したことを特徴と
する文生成装置
1. A sentence generating apparatus for automatically generating a sentence for retrieving data from a database, wherein a unique number is assigned to a pair of a database table name and each item name in the table and registered.
A storage unit , extracting a join relationship between the unique numbers registered in the database information storage unit , a plurality of join streams provided for each stream of the join over a plurality of tables , a search condition, and a relationship. For the operator and the input of the extraction order,
A sentence generation device, comprising: the database information storage unit; and a sentence generation unit that generates a sentence for searching a database based on the plurality of join streams , and configured to output the generated sentence.
【請求項2】上記生成した文として、文生成部がsel
ect句とパラメータ、from句とパラメータ、およ
複数のジョインストリームを含むwhere句とパラ
メータからなるSQL文を生成するように構成したこと
を特徴とする請求項第1項記載の文生成装置
2. A sentence generation unit according to claim 1, wherein
2. The sentence generating apparatus according to claim 1, wherein an SQL sentence including an ect clause and parameters, a from clause and parameters, and a where clause and parameters including a plurality of join streams is generated.
JP3151538A 1991-06-24 1991-06-24 Sentence generator Expired - Lifetime JP2993530B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3151538A JP2993530B2 (en) 1991-06-24 1991-06-24 Sentence generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3151538A JP2993530B2 (en) 1991-06-24 1991-06-24 Sentence generator

Publications (2)

Publication Number Publication Date
JPH052611A JPH052611A (en) 1993-01-08
JP2993530B2 true JP2993530B2 (en) 1999-12-20

Family

ID=15520704

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3151538A Expired - Lifetime JP2993530B2 (en) 1991-06-24 1991-06-24 Sentence generator

Country Status (1)

Country Link
JP (1) JP2993530B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3331233B2 (en) * 1993-03-31 2002-10-07 富士通株式会社 Interactive data retrieval and extraction system for relational databases
JPH0962695A (en) * 1995-08-24 1997-03-07 Fujitsu Social Sci Lab:Kk Data base retrieving device
JP2000067077A (en) * 1998-08-26 2000-03-03 Hitachi Information Systems Ltd Data base system and record medium recorded with program for processing chart division designation
JP5033322B2 (en) * 2005-11-10 2012-09-26 株式会社日立製作所 Information management method and apparatus using connection relation information
JP4787935B2 (en) * 2007-02-22 2011-10-05 日本電信電話株式会社 Database search support method, apparatus and program thereof
JP5136133B2 (en) * 2007-08-29 2013-02-06 富士通株式会社 Integrated rule creation support program, integrated rule creation support system, and integrated rule creation support method

Also Published As

Publication number Publication date
JPH052611A (en) 1993-01-08

Similar Documents

Publication Publication Date Title
US5471677A (en) Data retrieval using user evaluation of data presented to construct interference rules and calculate range of inputs needed for desired output and to formulate retrieval queries
JP3311540B2 (en) Data management system
JPH05128157A (en) Document retrieval system
EP1447757A2 (en) Declarative sequenced report parameterization
JP2993530B2 (en) Sentence generator
JPH09212517A (en) Method and device for information substitutional retrieval
JPH0581326A (en) Data base retrieving device
JPH08272818A (en) Information retrieval system
JPH08329101A (en) Data base system
JPH05266085A (en) Method and device for similar retrieval using dynamic concept dictionary
JPH1069487A (en) Managing method for information with ambiguous name
JP4568320B2 (en) Processing procedure generation apparatus and processing procedure generation method
JPS6325774A (en) Information registering/retrieving device
JPH10260992A (en) Database processor and storage medium
JPH01244521A (en) Data manipulation system
JPH02158870A (en) Data base retrieving system
JPH05314181A (en) Information retrieving device
JPH0916624A (en) Method for retrieving hierarchical data
JPH07105223A (en) Data base retrieval device
JP2000003401A (en) Form preparation processing system
JPH10171815A (en) Integrated retrieving device
JPH06230915A (en) Interaction supporting system
JP2001337988A (en) Similar candidate narrowing system and similar candidate narrowing method
JPH09259183A (en) Family register report input method
JPH04365172A (en) Retrieving device

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19990907

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20071022

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081022

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081022

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091022

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091022

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101022

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101022

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111022

Year of fee payment: 12

EXPY Cancellation because of completion of term
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111022

Year of fee payment: 12