Main Content

Data Preview Using Database Explorer App

Using the Database Explorer app, you can preview data in the Data Preview pane when you:

  • Select tables and columns in the Data Browser pane.

  • Create an SQL query using the buttons in the toolstrip.

  • Enter an SQL query manually.

After previewing the data, you can modify the SQL query or import the data into the MATLAB® Workspace.

Automatic Preview

The Database Explorer app previews data automatically, by default. With the Automatic Preview button toggled on in the Preview section and a valid SQL query in the SQL Query pane, the Database Explorer app executes the SQL query and previews the data in the Data Preview pane. You can control the number of rows displayed in this pane by entering a value in the Preview Size box in the toolstrip.

As you create an SQL query, the Data Preview pane updates the preview of the query results for each change you make to the query. When you change selections in the Data Browser pane, or add or remove a join, filter, or sort, the SQL Query pane updates along with the Data Preview pane.

If your SQL query takes a long time to execute or you know that the query results contain a large amount of data, you can stop the automatic preview of data. Click the Automatic Preview button in the Preview section of the toolstrip. When this button is toggled off, you can modify the query in the SQL Query pane without updating the preview of data. After you finish modifying the query, click Preview Query in the Preview section to see the updated query results in the Data Preview pane.

Preview Size

To see more rows in the Data Preview pane, enter a larger value in the Preview Size box in the Preview section. The number of rows in the Data Preview pane matches the entered value. However, if the number of rows in the SQL query results is less than the entered value, then all rows are displayed in the Data Preview pane.

To see the count of the total number of rows in the SQL query results, select the Show Row Count check box in the Preview section. The Data Preview pane displays the row count of the SQL query results. For example, using the sample database connection:

  1. In the Data Browser pane, select inventorytable. The SQL Query pane displays the SQL query that selects all data from the database table inventorytable.

  2. In the Preview section, select the Show Row Count check box. The Data Preview pane displays the row count 13 in the note within parentheses.

The Database Browser pane shows the selected table inventoryTable in the Database Explorer app. The SQL Query pane shows the SQL SELECT query that selects all rows from the inventoryTable and the Data Preview pane shows the first 10 rows of returned data out of 13 rows.

Preview Data by Creating SQL Query

After you connect to a database, the tables in the database are displayed in the Data Browser pane. Use this pane along with buttons in the toolstrip to view the database structure and create an SQL query.

  • Expand and collapse the tables to see the columns in each table.

  • Click the box next to a table name to see a quick preview of the data in the table. If the Automatic Preview button is toggled on, the Data Preview pane displays the first 10 rows of data automatically.

  • Click boxes next to column names to see a quick preview of data in those columns only.

  • Use the buttons in the toolstrip to exclude duplicate rows, join tables, filter data, and sort data.

After you create a valid SQL query in the SQL Query pane, the Database Explorer app executes the query and previews the results as described earlier in Automatic Preview.

Preview Data by Entering SQL Query Manually

You can enter an SQL query manually or by pasting text into the SQL Query pane. Or, you can modify an existing SQL query in the SQL Query pane. To enter or modify an SQL query, click Manual in the Edit section.

Note

When you enter or modify an SQL query manually, the Database Explorer app stops the automatic preview of data.

After you enter the SQL query, click Preview Query in the Preview section. The Data Preview pane displays the first 10 rows of data only after you click this button. If you modify the SQL query, then click Preview Query again to refresh the SQL query results.

See Also

Apps

Related Topics