You can us the SQL Query Builder to also create INSERT,
UPDATE, DELETE, FULLSELECT, or WITH statements by selecting the statement
type in the New SQL or XQuery Script window.
For this tutorial, you will create a SELECT statement for the VIDEOS
database
To create a SELECT statement:
- In the Data Project Explorer view,
expand theVideoStoreProject project, right click
on the SQL Scripts directory , and select New > SQL
or XQuery Script. The New
SQL or XQuery Script window will open.
- In the New SQL or XQuery Script window,
type customerRentals for the statement name.
- Under Edit using, select the SQL
Query Builder radio button option. The SELECT
statement type is selected by default.
- Click Finish
The SELECT statement is created from the template and opens
in the
SQL Query Builder, which has three panes:
- SQL Source
- The top pane shows the SQL source for your statement as it is
being built.
- Tables
- The middle pane shows the tables and table columns that are added
to the statement.
- Design
- The bottom pane is used to provide details for statement clauses.
This pane changes depending on the statement type being edited.
You will use all of these panes throughout this
tutorial.
In addition to the Data Project Explorer view,
you can use the following three views with the SQL Query
Builder:
- Outline
- Shows the statement that you are currently working on. For more
complex statements such as WITH and FULLSELECT that can include sub
selects and common table expressions, the Outline view
shows the structure of the statement.
- Data Source Explorer
- Each defined data connection is shown in this view. You can use
the Tables folder under a connection as a source
for adding tables to an SQL statement in the SQL Query
Builder.
- SQL Results
- Shows the messages, parameters, and results that are related to
running your SQL statement.
Although this tutorial only goes through creating
a SELECT statement, you can also use the SQL Source pane,
the Tables pane, and the Design pane
of the SQL Query Builder to create INSERT,
UPDATE, DELETE, FULLSELECT, and WITH SQL statements.