Book Image

Mastering QGIS

Book Image

Mastering QGIS

Overview of this book

Table of Contents (18 chapters)
Mastering QGIS
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating queries and views


DB Manager has a SQL window that allows SQL queries to be executed against the database. This section will explain how to use the SQL window to query a table and create a spatial view in SpatiaLite.

Tip

Different databases support different SQL commands. SQLite supports much of, but not all, the standard SQL. For a complete listing of supported SQL operations, visit http://www.sqlite.org/sessions/lang.html.

Creating a SQL query

To create a SQL query, perform the following steps:

  1. Open DB Manager by clicking on DB Manager under Database.

  2. In the Tree panel, navigate to and select the database on which you wish to perform a SQL query.

  3. Navigate to Database | SQL window, or press F2 on your keyboard, to open the SQL window.

  4. Enter a SQL query in the textbox at the top. Click on the Execute button or F5 on your keyboard to execute the SQL query against the database. The results of the query will be displayed in the results box at the bottom, and the number of affected rows and...