Developers can use queries to retrieve data from the tables and views in their database. They can 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. When developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to create a new query, they should follow the next steps:
1. In Object Explorer, expand the Tables node for the database they want to query. Right-click the table they want to query and click Open Table.
2. To add more tables to the query, on the Query Designer menu, select Add Table. If developers don’t see the Diagram, SQL, Criteria, or Results panes, from the Query Designer menu, they should point to Pane and click the pane they want to open.
3. In the Add Table dialog box, select the tables they want to query and click Add for each one.
4. Once they have added all the tables they want to query, click Close.
5. To add more tables later, right-click the open space in the Diagram pane and from the shortcut menu click Add Table.
6. In the Diagram Pane, check the boxes in the table-valued objects for each column they want to query.
7. From the Query Designer menu, choose Execute SQL to run their query.