Electronic apparatus and method for generating structured query language code
The electronic device simplifies SQL code generation through a graphical interface with selectable objects and blocks, addressing the complexity and accuracy issues in managing database systems by automating the process and lowering the coding threshold for administrators.
Patent Information
- Application Number
- JP2024142001
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-12
- Filing Date
- 2024-08-23
- Publication Date
- 2025-10-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Database administrators face challenges in managing complex SQL commands due to varying syntax across different database systems, requiring significant time and effort, and there is a lack of effective methods to ensure syntactic accuracy and maintainability of SQL commands, especially in multi-administrator environments.
An electronic device and method that utilizes a graphical user interface to provide selectable objects and blocks, allowing users to generate SQL code through drop-down menus and drag-and-drop operations, leveraging a lookup table to map objects to source code, thereby simplifying the code generation process.
The solution provides a user-friendly method for generating SQL code, reducing the coding burden on administrators and ensuring accurate and efficient management of database systems by automating the generation of SQL commands.
Smart Images

Figure 2025161695000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to coding techniques, and more particularly to an electronic device and method for generating structured query language code. [Background technology]
[0002] To manage a database system, administrators must have coding skills in structured query language (SQL). When a database stores a large amount of data, administrators must spend considerable time and effort coding SQL commands to process complex query requests. Furthermore, different database systems may support different SQL syntax or rules, and compatibility issues exist between database systems. Currently, there is no effective way to check the syntactic accuracy of SQL commands generated by administrators. When a database system is managed by multiple people, it is important to maintain the readability and maintainability of SQL commands. Given these factors, providing a simple and convenient SQL code generation method has become a key challenge in this field. Summary of the Invention [Problem to be solved by the invention]
[0003] The present invention provides an electronic device and method for generating Structured Query Language code that can generate SQL code according to a user's commands. [Means for solving the problem]
[0004] The present invention provides an electronic device for generating structured query language code, including a transceiver and a processor connected to the transceiver, configured to: provide a plurality of first-level objects via a graphical user interface; receive a first user command via the transceiver to select the first object from the plurality of first-level objects; provide a plurality of second-level objects corresponding to the first object via the graphical user interface in response to selecting the first object; receive a second user command via the transceiver to select a second object from the plurality of second-level objects; generate structured query language code according to the first objects and the second objects; and output the structured query language code via the transceiver, wherein the structured query language code includes first source code corresponding to the first object and second source code corresponding to the second object.
[0005] In one embodiment of the present invention, the processor is further configured to provide, via the graphical user interface, a first drop-down menu including a plurality of first level options corresponding respectively to a plurality of first level objects.
[0006] In one embodiment of the present invention, the processor is further configured to provide, via the graphical user interface, a second drop-down menu in response to selection of a first option from the plurality of first level options that corresponds to a first object, the second drop-down menu including a plurality of second level options that respectively correspond to a plurality of second level objects.
[0007] In one embodiment of the present invention, the electronic device further includes a storage medium coupled to the processor and configured to store a lookup table, the lookup table including a mapping relationship between the first object and the first source code, and the processor configured to query the lookup table in response to the first option being selected to obtain the first source code corresponding to the first object.
[0008] In one embodiment of the present invention, the processor is further configured to provide, via a graphical user interface, a plurality of first level blocks corresponding respectively to a plurality of first level objects and a plurality of second level blocks corresponding respectively to a plurality of second level objects.
[0009] In one embodiment of the present invention, the processor is further configured to provide an operation area via a graphical user interface; drag a first block of the plurality of first level blocks into the operation area based on a first user command, the first block corresponding to a first object; drag a second block of the plurality of second level blocks into the operation area based on a second user command to combine with the first block to generate a combined block, the second block corresponding to a second object; and generate structured query language code based on the combined block.
[0010] In one embodiment of the present invention, the electronic device further includes a storage medium connected to the processor and configured to store a lookup table, the lookup table including a mapping relationship between a first object and a first source code, and the processor is further configured to query the lookup table in response to the first block being dragged into the operation area to obtain the first source code corresponding to the first object.
[0011] In one embodiment of the present invention, the processor is further configured to: access, via the transceiver, a data source to retrieve data based on a structured query language; and generate key-value pairs based on the data.
[0012] In one embodiment of the present invention, the processor is further configured to: provide a plurality of application skins for selection via the graphical user interface; and in response to a selection of a first application skin of the plurality of application skins, display a graphical template of the first application skin, the graphical template including editable objects; update the graphical template by specifying key-value pairs for the editable objects; and generate an application based on the updated graphical template.
[0013] In one embodiment of the invention, the plurality of first level objects correspond to phrases of a structured query language.
[0014] A method for generating structured query language code of the present invention includes providing a plurality of first-level objects via a graphical user interface, receiving a first user command, and selecting a first object from the plurality of first-level objects; in response to selecting the first object, providing a plurality of second-level objects corresponding to the first object via the graphical user interface; receiving a second user command, and selecting a second object from the plurality of second-level objects; generating structured query language code according to the first objects and the second objects; and outputting the structured query language code, wherein the structured query language code includes a first source code corresponding to the first object and a second source code corresponding to the second object. [Effects of the Invention]
[0015] Based on the above, the present invention provides users with a simple and convenient SQL code generation method, eliminating the need for users to manually write complex SQL code. The present invention can lower the coding ability threshold for database system administrators, allowing users to accurately and efficiently manage database systems through SQL code. [Brief explanation of the drawings]
[0016] [Figure 1] FIG. 1 is a schematic diagram of an electronic device for generating SQL code according to one embodiment of the present invention. [Figure 2] FIG. 1 is a flow diagram for generating SQL code according to one embodiment of the present invention. [Figure 3A] FIG. 2 is a schematic diagram of a graphical user interface providing a drop-down menu according to one embodiment of the present invention. [Figure 3B] FIG. 2 is a schematic diagram of a graphical user interface providing a drop-down menu according to one embodiment of the present invention. [Figure 4] FIG. 2 is a schematic diagram of a graphical user interface providing graphic blocks according to one embodiment of the present invention; [Figure 5] FIG. 1 is a flow diagram for generating an application according to one embodiment of the present invention. [Figure 6A] FIG. 2 is a schematic diagram of a graphic template for an application skin according to one embodiment of the present invention. [Figure 6B] FIG. 2 is a schematic diagram of a graphic template for an application skin according to one embodiment of the present invention. [Figure 7] FIG. 2 is a flow diagram of a method for generating SQL code according to one embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0017] 1 is a schematic diagram of an electronic device 100 for generating SQL code according to one embodiment of the present invention. The electronic device 100 may include a processor 110, a storage medium 120, and a transceiver .
[0018] The processor 110 may be, for example, a central processing unit (CPU) or other programmable general-purpose or special-purpose microcontroller unit (MCU), microprocessor, digital signal processor (DSP), programmable controller, application specific integrated circuit (ASIC), graphics processing unit (GPU), image signal processor (ISP), image processing unit (IPU), arithmetic logic unit (ALU), complex programmable logic device (CPLD), field programmable gate array (FPGA), or other similar component, or a combination of the above components. The processor 110 is connected to the storage medium 120 and the transceiver 130 and can access and execute multiple modules and various applications stored in the storage medium 120.
[0019] Storage medium 120 may be, for example, any type of fixed or removable random access memory (RAM), read-only memory (ROM), flash memory, hard disk drive (HDD), solid state drive (SSD), or similar element or combination of the above elements used to store multiple modules or various applications that can be executed by processor 110. In one embodiment, storage medium 120 may store lookup table 121. Lookup table 121 may store a mapping relationship between objects (e.g., options in a drop-down menu or graphic blocks) and source code.
[0020] The transceiver 130 transmits or receives signals wirelessly or via a wire. The transceiver 130 may further perform, for example, low-noise amplification, impedance matching, frequency mixing, frequency up-conversion or down-conversion, filtering, amplification, and similar operations. The processor 110 may communicate with an external electronic device (e.g., a terminal device, a database system, or a cloud server) via the transceiver 130. For example, a user may operate a terminal device connected to the transceiver 130 to input user commands to the electronic device 100.
[0021] 2 is a flow diagram for generating SQL code according to one embodiment of the present invention, where the flow of FIG. 2 can be implemented by the electronic device 100 shown in FIG.
[0022] In step S201, processor 110 can output a graphical user interface via transceiver 130 and provide a plurality of Nth-level objects (N is a positive integer) for user selection via the graphical user interface. The objects correspond to source code of a specific SQL clause (e.g., source code of a WHERE clause), and the objects can be editable. Processor 110 can receive a user command via transceiver 130 and select an Nth-level object from the plurality of Nth-level objects according to the user's instructions. After obtaining the selected Nth-level object, processor 110 can query lookup table 121 to obtain source code corresponding to the selected Nth-level object.
[0023] In one embodiment, processor 110 may provide a drop-down menu for user selection via a graphical user interface, where the drop-down menu may include a plurality of Nth-level options corresponding to a plurality of Nth-level objects, and the user may select a selected Nth-level object from the plurality of Nth-level options via a user command.
[0024] 3A and 3B are schematic diagrams of a graphical user interface 200 providing a drop-down menu according to an embodiment of the present invention. Taking FIG. 3A as an example, the processor 110 can provide a drop-down menu 310 for a user selection via the graphical user interface 200. Here, the drop-down menu 310 can include a plurality of first-level options corresponding to a plurality of first-level objects, respectively. For example, the user can select "employee (table)" from the drop-down menu 310 via a user command as the selected first-level object. After obtaining the selected first-level object "employee," the processor 110 can query the lookup table 121 to obtain source code for selecting "employee."
[0025] In one embodiment, the processor 110 may provide, via the graphical user interface 200, a plurality of graphic blocks corresponding to a plurality of source codes, for user selection. Specifically, the graphical user interface 200 may provide a plurality of Nth-level blocks corresponding to a plurality of Nth-level objects, respectively, and a plurality of (N+1)th-level blocks corresponding to a plurality of (N+1)th-level objects, respectively, for user selection. The graphical user interface 200 may provide an operation area. A user may drag a specific block of the Nth-level blocks to the operation area through a user command, and the specific block corresponds to the selected Nth-level object. After dragging the specific block to the operation area, the processor 110 may query the lookup table 121 to obtain source code corresponding to the selected Nth-level object (or the specific block).
[0026] FIG. 4 is a schematic diagram of a graphical user interface 200 for providing graphic blocks according to an embodiment of the present invention. Taking FIG. 4 as an example, the graphical user interface 200 may provide a graphic block list 210 and an operation area 220. Here, the graphic block list 210 may include graphic blocks of different levels. For example, a first level block 400 may include a second level block, e.g., second level block 410, corresponding to one or more second-level objects. The second level block 410 may include a third level block, e.g., third level block 411, corresponding to one or more third-level objects. The graphical user interface 200 may provide a plurality of graphic blocks, including the first level block 400, the second level block 410, or the third level block 411, for user selection via the graphic block list 210. A user may drag the first level block 400 from the graphic block list 210 to the operation area 220 via a user command. When the first level block 400 is dragged from the graphic block list 210 to the operation area 220, the appearance of the first level block 400 may or may not change. After the first level block 400 is dragged from the graphic block list 210 to the operation area 220, the processor 110 may query the lookup table 121 to obtain the source code corresponding to the first level block 400.
[0027] 2, in step S202, processor 110 can provide a plurality of (N+1)th-level objects corresponding to the selected Nth-level object for user selection via graphical user interface 200. Processor 110 can receive a user command via transceiver 130 and select the selected (N+1)th-level object from the plurality of (N+1)th-level objects in accordance with the user's instructions. After obtaining the selected (N+1)th-level object, processor 110 can query lookup table 121 to obtain source code corresponding to the selected (N+1)th-level object.
[0028] Taking FIG. 3A as an example, after obtaining a selected first-level object “employee,” the graphical user interface 200 can provide a drop-down menu 321 (or a drop-down menu 322) corresponding to the selected first-level object “employee” for user selection. Here, the drop-down menu 321 (or a drop-down menu 322) can include multiple second-level options corresponding to second-level objects, respectively. For example, the user can select “employee.Fname” as the selected second-level object from the drop-down menu 321 via a user command, or the user can select “employee.Salary” as the selected second-level object from the drop-down menu 322 via a user command. Based on a similar method, after obtaining a selected second-level object “employee.Salary,” the graphical user interface 200 can provide a drop-down menu 331 (or a drop-down menu 332) corresponding to the selected second-level object “employee.Salary” for user selection. The options in the drop-down menus can be edited. For example, an option in the drop-down menu 331 may include an editable blank field. A user may enter the number "30000" into the blank field in an option in the drop-down menu 331 via a user command.
[0029] 4 as an example, after dragging the first level block 400 to the operation area 220, the user can drag the second level block 410 belonging to the first level block 400 from the graphic block list 210 to the operation area 220 via a user command, thereby combining the first level block 400 and the second level block 410 in the operation area 220 to generate a combined block. Based on a similar method, after dragging the second level block 410 to the operation area 220, the user can drag the third level block 411 belonging to the second level block 410 from the graphic block list 210 to the operation area 220 via a user command, thereby combining the first level block 400, the second level block 410, and the third level block 411 in the operation area 220 to generate a combined block. Each of the graphic blocks may be editable. For example, the third level block 411 may include an editable blank field. The user can input the number "30000" into the blank field of the third level block 411 via a user command.
[0030] 2, in step S203, processor 110 can generate SQL code according to the selected Nth-level object and the selected (N+1)th-level object. The SQL code may include source code corresponding to the selected Nth-level object and source code corresponding to the selected (N+1)th-level object. In step S204, processor 110 can output the SQL code via transceiver 130. The SQL code output by processor 110 may include, but is not limited to, the following SQL commands: select command, insert command, update command, or delete command.
[0031] Taking Figures 3A and 3B as an example, after selecting an option provided by drop-down menus 310, 321, 322, 331, or 332, processor 110 can generate SQL code 390 based on the source code corresponding to each selected option, as shown in Figure 3B.
[0032] Taking FIG. 4 as an example, after generating a combined block including a first level block 400, a second level block 410, and a third level block 411, the processor 110 can generate SQL code based on the combined block.
[0033] It should be noted that different database systems may have different SQL syntax rules or characteristics, and therefore each step in the flow of Figure 2 may be adaptively adjusted depending on the SQL syntax supported by the database system so that the SQL code generated by electronic device 100 is applied to the currently accessed database.
[0034] 5 is a flow diagram for generating an application according to one embodiment of the present invention, where the flow of FIG. 5 can be implemented by the electronic device 100 shown in FIG.
[0035] In step S501, processor 110 may provide a plurality of application skins for user selection via graphical user interface 200. Graphical user interface 200 may provide a graphic template of the selected application skin for user reference. For example, graphical user interface 200 may provide graphic template 600, such as that shown in FIG. 6A, for user reference. Graphic template 600 may include one or more editable objects, such as editable object 610, editable object 620, or editable object 630.
[0036] In step S502, the processor 110 can access a data source (for example, an external database system) based on the generated SQL code to obtain data. Then, the processor 110 can generate one or more key-value pairs based on the data. Note that step S502 may be executed before step S501, and the present invention is not limited thereto.
[0037] In step S503, processor 110 can update graphic template 600 by assigning key-value pairs to editable objects of graphic template 600 according to a user's instruction. Taking FIG. 6B as an example, processor 110 can assign a key-value pair corresponding to the text data “Food A” to editable object 610, assign a key-value pair corresponding to the text data “Production Date: OOOO / OO” to editable object 620, and assign a key-value pair corresponding to the text data “Shelf Life: XXXX / XX” to editable object 630 to update graphic template 600.
[0038] In step S504, the processor 110 may generate an application based on the updated graphic template 600. The application skin generated by the processor 110 may include information related to the key-value pairs obtained in step S502. The processor 110 may output the generated application via the transceiver 130. For example, the processor 110 may upload the application to a cloud server via the transceiver 130.
[0039] FIG. 7 is a flow diagram of a method for generating SQL code according to an embodiment of the present invention. The method can be implemented by the electronic device 100 shown in FIG. In step S701, a plurality of first-level objects are provided via a graphical user interface, and a first user command is received to select the first object from the plurality of first-level objects. In step S702, in response to the selection of the first object, a plurality of second-level objects corresponding to the first object are provided via the graphical user interface. In step S703, a second user command is received to select a second object from the plurality of second-level objects. In step S704, structured query language code is generated according to the first object and the second object, and the structured query language code is output. Here, the structured query language code includes a first source code corresponding to the first object and a second source code corresponding to the second object.
[0040] In summary, the electronic device of the present invention can provide a drop-down menu or graphic blocks corresponding to specific source code for user selection. By selecting options from the drop-down menu or dragging the graphic blocks, the user can combine different levels of source code to generate SQL code. The present invention provides users with a simple and convenient method for generating SQL code. Users do not need to manually write complex SQL code. The present invention can lower the coding ability threshold for database system administrators and enable users to accurately and efficiently manage database systems through SQL code. [Industrial Applicability]
[0041] The electronic device and method for generating structured query language code of the present invention can be applied to applications related to database management. [Explanation of symbols]
[0042] 100:Electronic equipment 110: Processor 120:Storage medium 121: Lookup table 130: Transmitter / Receiver 200: Graphical User Interface 210: Graphic block list 220: Operation area 310, 321, 322, 331, 332: Drop-down menu 390:SQL code 400: First level block 410: Second level block 411: Third level block 600: Graphic Templates 610, 620, 630: Editable objects S201, S202, S203, S204, S501, S502, S503, S504, S701, S702, S703, S704: Process
Claims
1. 1. An electronic device for generating structured query language code, comprising: A transmitter / receiver, a processor coupled to the transceiver, providing a plurality of first level objects via a graphical user interface and receiving a first user command via the transceiver to select a first object from the plurality of first level objects; responsive to the first object being selected, providing, via the graphical user interface, a plurality of second level objects corresponding to the first object; receiving a second user command via the transceiver to select a second object from the plurality of second level objects; generating structured query language code according to the first object and the second object, the structured query language code including a first source code corresponding to the first object and a second source code corresponding to the second object, and outputting the structured query language code via a transceiver; the processor configured to execute 2. An electronic device comprising:
2. The processor: providing, via the graphical user interface, a first drop-down menu including a plurality of first level options corresponding respectively to the plurality of first level objects; further configured to perform The electronic device of claim 1 .
3. The processor: providing, via the graphical user interface, a second drop-down menu including a plurality of second level options corresponding respectively to the plurality of second level objects in response to a selection of a first option among the plurality of first level options corresponding to the first object; further configured to perform 3. The electronic device of claim 2.
4. a storage medium coupled to the processor, the storage medium storing a lookup table including a mapping relationship between the first object and the first source code; The processor: In response to the first option being selected, querying the lookup table to obtain the first source code corresponding to the first object; further configured to perform The electronic device according to claim 3,
5. The processor: providing, via the graphical user interface, a plurality of first level blocks corresponding respectively to the plurality of first level objects and a plurality of second level blocks corresponding respectively to the plurality of second level objects; further configured to perform The electronic device of claim 1 .
6. The processor: providing an operation area via the graphical user interface; Dragging a first block corresponding to the first object among the plurality of first level blocks into the operation area based on the first user command; based on the second user command, dragging a second block corresponding to the second object among the plurality of second level blocks into the operation area to combine it with the first block to generate a combined block; generating the structured query language code based on the combined blocks; further configured to perform 6. The electronic device of claim 5.
7. a storage medium coupled to the processor, the storage medium storing a lookup table including a mapping relationship between the first object and the first source code; The processor: In response to the first block being dragged into the manipulation area, querying the lookup table to obtain the first source code corresponding to the first object; further configured to perform 7. The electronic device of claim 6.
8. The processor: accessing a data source to obtain data based on the structured query language via the transceiver; generating key-value pairs based on said data; further configured to perform The electronic device of claim 1 .
9. The processor: providing a plurality of application skins for selection via said graphical user interface; In response to a selection of a first application skin of the plurality of application skins, displaying a graphic template of the first application skin, the graphic template including an editable object; updating the graphic template by assigning the key-value pairs to the editable object; generating an application based on the updated graphic template; further configured to perform 9. The electronic device of claim 8.
10. the plurality of first-level objects correspond to phrases of a structured query language; The electronic device of claim 1 .
11. providing a plurality of first level objects via a graphical user interface and receiving a first user command to select a first object from the plurality of first level objects; responsive to the first object being selected, providing, via the graphical user interface, a plurality of second level objects corresponding to the first object; receiving a second user command to select a second object from the plurality of second level objects; generating structured query language code according to the first object and the second object, the structured query language code including a first source code corresponding to the first object and a second source code corresponding to the second object, and outputting the structured query language code; 1. A method for generating structured query language code, comprising:
Citation Information
Patent Citations
Database management system
JP1998320247A
SQL statement generating software using GUI
JP2007018221A