How to Create a Table from Query Results in Microsoft SQL

Save

Microsoft SQL is a relational model database server that uses the T-SQL and ANSI SQL query languages. The primary function of Microsoft SQL is to manage a database or multiple databases. It also offers data retrieval through queries, which tell the database exactly what to procure. You can also store procedures on Microsoft SQL to reduce code entry fatigue and improve the speed of the server. You can create a table from query results in Microsoft SQL in a few steps.

  • Open Microsoft Access and then "Northwind.mdb."

  • Open a "New Query," click "Design View" and then click "OK." Close the "Show Table" dialogue window.

  • Click "Query," "SQL Specific" and "Union." Enter the query results you wish to use. Here is a sample of a union query:

    "SELECT CompanyName, City, "Customers" as [Relationship]

    FROM Customers

    WHERE Country = "Brazil"

    UNION SELECT CompanyName, City, "Suppliers"

    FROM Suppliers

    WHERE Country = "Brazil";."

  • Save your query results, and enter a name for them. Close the SQL window. Create a new query based on your saved query. Close the "Show Tables" window.

  • Double-click your query's asterisk to add all of the fields to your query's output. Click "Query" and then "Make Table." Enter the name of your table in the "Table Name" dialogue box. Click "OK." Click "Query" and then "Run." Click "Yes" when you are informed how many records will be added to your new table. Save and name the query table.

References

Promoted By Zergnet

Comments

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!