{"id":1121,"date":"2023-03-23T19:07:59","date_gmt":"2023-03-23T19:07:59","guid":{"rendered":"https:\/\/datacrow.org\/?post_type=docs&#038;p=1121"},"modified":"2026-12-01T20:03:43","modified_gmt":"2026-12-01T20:03:43","password":"","slug":"database-editor","status":"publish","type":"docs","link":"https:\/\/datacrow.org\/es\/docs\/database-editor\/","title":{"rendered":"Query Tool"},"content":{"rendered":"<p class=\"wp-block-paragraph\"><em>Menu path: Tools &gt; Query Tool<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"878\" height=\"761\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-192.png\" alt=\"\" class=\"wp-image-2281\" style=\"width:768px;height:auto\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-192.png 878w, https:\/\/datacrow.org\/wp-content\/uploads\/image-192-300x260.png 300w, https:\/\/datacrow.org\/wp-content\/uploads\/image-192-768x666.png 768w\" sizes=\"(max-width: 878px) 100vw, 878px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Query Tool offers a quick and direct way to look at the data in the database, and to change it. It overrides all checks on data, so it should be handled with care. The Query Tool is for administrators and is shown at the expert experience level.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are not familiar with SQL, you would be better off not using the Query Tool as you might make unwanted changes. You will also need to familiarise yourself with the syntax of <a href=\"https:\/\/hsqldb.org\/doc\/guide\/\">HSQL DB<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When Data Crow is connected to a server the Query Tool is available as well, but it is read only: see <a href=\"#querytool-server\">Client-server<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The window<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the left is the <em>Database schema<\/em> and, on a tab next to it, the <em>Saved SQL statements<\/em>. On the right you enter the query and see its result. The toolbar above the query has the buttons to run, stop, clear, save, format and export (see <a href=\"#querytool-buttons\">The buttons<\/a>).<\/p>\n\n\n\n<h2 id=\"querytool-schema\" class=\"wp-block-heading\">Database schema<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"346\" height=\"572\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-193.png\" alt=\"\" class=\"wp-image-2283\" style=\"width:301px;height:auto\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-193.png 346w, https:\/\/datacrow.org\/wp-content\/uploads\/image-193-181x300.png 181w\" sizes=\"(max-width: 346px) 100vw, 346px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The schema shows all tables of the database, each with its columns, the data type, the primary key and the references to other tables. The tables and columns of the modules and fields you created yourself show the name of the module and of the field, so you can recognize them. Point at a table or a column to see this information in a tooltip.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tables of which the name starts with <em>X_<\/em> (such as X_SOFTWARE_CATEGORIES) are link tables. They connect the items of a module to the items of a field which can hold several references, such as the categories of a software item. The tooltip of a table shows the module it belongs to.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"477\" height=\"130\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-194.png\" alt=\"\" class=\"wp-image-2284\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-194.png 477w, https:\/\/datacrow.org\/wp-content\/uploads\/image-194-300x82.png 300w\" sizes=\"(max-width: 477px) 100vw, 477px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <em>Filter<\/em> field at the top finds a table or a column on the name of the table or column, or on the name of the module or field. <strong>Double-click<\/strong> on a name (or select it and press Enter) to place it in the query.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"370\" height=\"472\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-195.png\" alt=\"\" class=\"wp-image-2285\" style=\"width:336px;height:auto\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-195.png 370w, https:\/\/datacrow.org\/wp-content\/uploads\/image-195-235x300.png 235w\" sizes=\"(max-width: 370px) 100vw, 370px\" \/><\/figure>\n\n\n\n<h2 id=\"querytool-query\" class=\"wp-block-heading\">Creating and executing a SQL statement<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Enter a SQL statement in the query input and press <em>Run<\/em> to execute it. The SQL is shown with syntax highlighting: keywords, strings, numbers and comments each have their own colour. Errors are shown if the query was incorrect (these messages are not generated by Data Crow but by the database engine).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Suggestions.<\/strong> Press <em>Ctrl+Space<\/em> while typing for suggestions of the names of tables and columns (and of SQL keywords). After a table name or an alias (such as <em>m.<\/em> for <em>MOVIE m<\/em>) the columns of that table are suggested.<br><img loading=\"lazy\" decoding=\"async\" width=\"350\" height=\"237\" class=\"wp-image-2286\" style=\"width: 350px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/query_hint.png\" alt=\"\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/query_hint.png 327w, https:\/\/datacrow.org\/wp-content\/uploads\/query_hint-300x203.png 300w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/li>\n\n\n\n<li><strong>A part of the query.<\/strong> When you select a part of the text, only the selection is executed instead of the whole query.<br><img loading=\"lazy\" decoding=\"async\" width=\"250\" height=\"61\" class=\"wp-image-2288\" style=\"width: 250px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/query_exec_part.png\" alt=\"\"><\/li>\n\n\n\n<li><strong>Formatting.<\/strong> <em>Format<\/em> places the main parts of the query (SELECT, FROM, WHERE and so on) on their own lines and aligns them. It formats the selected text, or the whole query when nothing is selected. You can also right-click in the query and choose Format, or press <em>Ctrl+Shift+F<\/em>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A query is executed in the background: the window stays usable while it runs and the status line says so. Press <em>Stop<\/em> to stop it. Closing the window stops a running query as well.<\/p>\n\n\n\n<h2 id=\"querytool-result\" class=\"wp-block-heading\">The result<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"565\" height=\"401\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-202.png\" alt=\"\" class=\"wp-image-2306\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-202.png 565w, https:\/\/datacrow.org\/wp-content\/uploads\/image-202-300x213.png 300w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The result of a select query is shown in the result table. A query shows at most 1000 rows; the status line tells the number of rows and the time it took, and says when there are more rows than the ones shown. Point at the header of a column to see its name and, on the second line, the label of its field (such as the name you gave to a field you created yourself).<\/p>\n\n\n\n<h2 id=\"querytool-buttons\" class=\"wp-block-heading\">The buttons<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The buttons are above the query:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><img loading=\"lazy\" decoding=\"async\" width=\"24\" height=\"24\" class=\"wp-image-2216\" style=\"width: 24px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/openapplication-1.png\" alt=\"\"> <strong>Run<\/strong>: runs the SQL query as entered in the query input (or the selected text).<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"24\" height=\"24\" class=\"wp-image-2292\" style=\"width: 24px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/stop-1.png\" alt=\"\"> <strong>Stop<\/strong>: stops the query which is running.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"24\" height=\"24\" class=\"wp-image-2291\" style=\"width: 24px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/searchreset.png\" alt=\"\"> <strong>Clear<\/strong>: clears all data from the screen.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"24\" height=\"24\" class=\"wp-image-2261\" style=\"width: 24px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/save-1.png\" alt=\"\"> <strong>Save<\/strong>: saves the query under a name (see <a href=\"#querytool-saved\">Saved SQL statements<\/a>).<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"24\" height=\"24\" class=\"wp-image-2294\" style=\"width: 24px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/wizard-1.png\" alt=\"\"> <strong>Format<\/strong>: formats the query (Ctrl+Shift+F).<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"24\" height=\"24\" class=\"wp-image-2293\" style=\"width: 24px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/tips.png\" alt=\"\"> <strong>Examples<\/strong>: example queries for the table or the column which is selected in the database schema. Select a table or a column first.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"24\" height=\"24\" class=\"wp-image-2290\" style=\"width: 24px;\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/itemexport.png\" alt=\"\"> <strong>Export CSV<\/strong>: exports the rows shown in the result to a CSV file. Data Crow asks before it replaces a file which exists already.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"querytool-examples\" class=\"wp-block-heading\">Example queries<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"510\" height=\"336\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-197.png\" alt=\"\" class=\"wp-image-2297\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-197.png 510w, https:\/\/datacrow.org\/wp-content\/uploads\/image-197-300x198.png 300w\" sizes=\"(max-width: 510px) 100vw, 510px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <em>Examples<\/em> button shows queries which are made for the table or the column you selected in the schema. For a table, for example: the first 100 rows, the number of rows of the table (or of all tables), and all rows with the items they refer to (an inner or an outer join), also with the labels of the fields as names. For a column: the number of rows per value, the values which occur more than once and the rows without a value. A chosen example is placed in the query input; it is not executed until you press Run.<\/p>\n\n\n\n<h2 id=\"querytool-saved\" class=\"wp-block-heading\">Saved SQL statements<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"187\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-199.png\" alt=\"\" class=\"wp-image-2300\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-199.png 372w, https:\/\/datacrow.org\/wp-content\/uploads\/image-199-300x151.png 300w\" sizes=\"(max-width: 372px) 100vw, 372px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The tab <em>Saved SQL statements<\/em> has two groups:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Saved<\/strong>: the queries to which you gave a name with the <em>Save<\/em> button. Data Crow asks for the name, and asks whether to replace a query which has the same name.<\/li>\n\n\n\n<li><strong>Recently executed<\/strong>: the queries you executed lately (the last 50, the latest first). The same query is only kept once.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Double-click on a query (or select it and press Enter) to place it in the query input. A right-click gives the options <em>Load<\/em> and <em>Delete<\/em>; the Delete key deletes the selected query as well, after a confirmation. Point at a query to see its SQL.<\/p>\n\n\n\n<h2 id=\"querytool-changes\" class=\"wp-block-heading\">Changing data<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In a stand-alone installation you can change data too. A statement which changes data is not final right away: Data Crow shows how many rows were affected and asks whether to <em>commit<\/em> the changes or to <em>roll them back<\/em> (the default). A change or a delete without a WHERE clause gets an extra warning, as it applies to all rows of the table.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"265\" src=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-200.png\" alt=\"\" class=\"wp-image-2301\" srcset=\"https:\/\/datacrow.org\/wp-content\/uploads\/image-200.png 580w, https:\/\/datacrow.org\/wp-content\/uploads\/image-200-300x137.png 300w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A statement which changes the structure or the settings of the database cannot be rolled back. Data Crow asks for confirmation before it executes such a statement. Make a backup first when you are not sure.<\/p>\n\n\n\n<h2 id=\"querytool-server\" class=\"wp-block-heading\">Client-server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When Data Crow is connected to a server, administrators can use the Query Tool as well. It is then read only: the server only executes queries (SELECT), one statement at a time. Changes to the data have to be made in stand-alone mode. A query which takes more than 20 seconds is stopped by the server, and when too many queries are running at the same time you have to wait until one has finished.<\/p>","protected":false},"excerpt":{"rendered":"<p>Menu path: Tools &gt; Query Tool The Query Tool offers a quick and direct way to look at the data in the database, and to&hellip;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_customify_content_layout":"","_customify_sidebar":"","_customify_page_header_display":"default","_customify_disable_header":"","_customify_disable_header_top":"","_customify_disable_header_main":"","_customify_disable_header_bottom":"","_customify_disable_page_title":"","_customify_disable_content_vertical_padding":"","_customify_disable_footer_top":"","_customify_disable_footer_main":"","_customify_disable_footer_bottom":"","_customify_breadcrumb_display":"default","_customify_header_transparent_display":"","footnotes":""},"doc_category":[19],"doc_tag":[],"class_list":["post-1121","docs","type-docs","status-publish","hentry","doc_category-system-tools"],"year_month":"2026-12","word_count":1095,"total_views":"488","reactions":{"happy":"0","normal":"0","sad":"1"},"author_info":{"name":"Robert Jan","author_nicename":"infodatacrow-org","author_url":"https:\/\/datacrow.org\/es\/author\/infodatacrow-org\/"},"doc_category_info":[{"term_name":"System Tools","term_url":"https:\/\/datacrow.org\/es\/docs-category\/system-tools\/"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/docs\/1121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/comments?post=1121"}],"version-history":[{"count":8,"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/docs\/1121\/revisions"}],"predecessor-version":[{"id":2307,"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/docs\/1121\/revisions\/2307"}],"wp:attachment":[{"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/media?parent=1121"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/doc_category?post=1121"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/datacrow.org\/es\/wp-json\/wp\/v2\/doc_tag?post=1121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}