Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can you please explain how to create a temporary table in SQL?

1 Answer

0 votes
by (119k points)

Temporary tables are used to store the intermediate results so that they can be accessed multiple times. We can create temporary tables using SELECT INTO statement and the name of the temporary table must start with #. Here is the syntax to create a temporary table in SQL:

SELECT columns_list

INTO #temporary_table

FROM table_name

Here is the example to create a temporary table in SQL:

SELECT *

INTO #temp_table

FROM Employee

WHERE salary > 20000

In the above example, we are creating a temporary table named temp_table with the details of the employees whose salaries are greater than 20000.

In case you want to learn SQL, then sign up for this SQL training course by Intellipaat that provides instructor-led training, certification, and also job assistance.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Apr 19, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer

Browse Categories

...