Create Queries (Visual Database Tools)
Applies to:
SQL Server
Queries allow you to retrieve data from the tables and views in your database. You create and work with queries in Query and View Designer, which is composed of four panes: the Diagram Pane, the SQL Pane, the Criteria Pane, and the Results Pane.
To create a new query
In Object Explorer, expand the Tables node for the database you want to query. Right-click the table you want to query and click Open Table.
To add more tables to the query, on the Query Designer menu, select Add Table.
Note
If you do not see the Diagram, SQL, Criteria, or Results panes, from the Query Designer menu, point to Pane and click the pane you want to open.
In the Add Table dialog box, select the tables you want to query and click Add for each one.
Once you have added all the tables you want to query, click Close.
To add more tables later, right-click the open space in the Diagram pane and from the shortcut menu click Add Table.
In the Diagram Pane, check the boxes in the table-valued objects for each column you want to query.
From the Query Designer menu, choose Execute SQL to run your query.
To further refine your query, you can change the SQL code in the SQL Pane or choose options such as sort order and column aliases in the Criteria Pane.
See Also
Save Queries (Visual Database Tools)
Types of Queries (Visual Database Tools)
Specify Search Criteria (Visual Database Tools)
Summarize Query Results (Visual Database Tools)
Perform Basic Operations with Queries (Visual Database Tools)
Tilbakemeldinger
https://aka.ms/ContentUserFeedback.
Kommer snart: Gjennom 2024 faser vi ut GitHub Issues som tilbakemeldingsmekanisme for innhold, og erstatter det med et nytt system for tilbakemeldinger. Hvis du vil ha mer informasjon, kan du se:Send inn og vis tilbakemelding for