How To Create Queries In The Database

Table of contents:

How To Create Queries In The Database
How To Create Queries In The Database

Video: How To Create Queries In The Database

Video: How To Create Queries In The Database
Video: Access: Designing a Simple Query 2024, November
Anonim

One of the most widely used database management systems (DBMS) today is MySQL. Last but not least, its popularity is facilitated by the well-designed and actively developing application PhpMyAdmin, which allows you to manage databases directly through the browser. Its fairly simple interface makes it possible to compose the necessary SQL queries even without knowledge of this language.

How to create queries in the database
How to create queries in the database

Instructions

Step 1

Download the PhpMyAdmin interface, log in and click the one in which you want to create an SQL query in the list of databases. This list is placed in the left frame of the application interface. The sequence of further actions depends on what kind of request you want to create.

Step 2

If the query is to search for the value you specified in all the fields of the tables of the selected database, then click the "Search" tab in the menu of the right frame. In the text box, enter the value that should be sent in the query, in the Search box, select one of the search options, and in the list of tables for this database, select all or only a part of the tables that should make up the search scope. Then click the "OK" button and the application, based on the data you entered, will compose one request for each of the selected tables and send them all to the server. The result for each table will be summarized in one general table, and by clicking the "Browse" button in any line you will see the text of the SQL query compiled for the selected table and the search results in it. If necessary, this program-generated request code can be copied and used at your discretion.

Step 3

If the query should add a new row to any of the tables, then select the table and click on the "Insert" tab in the menu of the right frame. In the opened page with the form, fill in the values of the fields corresponding to the fields of the table and click "OK". PhpMyAdmin will compose a query, send it to the server and show you the SQL query itself and a report on its execution. This request can also be copied and used in the future, for example, for pasting a PHP script working with a database into the code.

Step 4

If the query should simply receive data of a certain number of rows from any database table, then select the required table and click on the "Browse" tab. The application will compose a request, send it to the server, and then show the request itself, as well as the received response in tabular form.

Step 5

If you want to enter the query text yourself, then select the "SQL" link. The program will present you with a multi-line text field for entering a query, into which a template will be placed - a variant of the simplest, but most frequently used query that selects table rows. After modifying the stub as needed, click the "OK" button to send it to the SQL server.

Recommended: