Let’s discuss temporary tables in Microsoft’s T-SQL. Temporary tables have a hash (#) at the start of their name.
Here is a YouTube video by Alex The Analyst called Advanced SQL Tutorial | Temp Tables.
You can do many of the things with temp tables as you would do with regular tables.
2 | CREATE TABLE #temp_People ( |
4 | FirstName varchar (50) NULL , |
5 | LastName varchar (50) NULL , |
9 | INSERT INTO #temp_People |
10 | VALUES (1, 'Bob' , 'Smith' , 500.00); |
11 | INSERT INTO #temp_People |
12 | VALUES (2, 'Sue' , 'Patel' , 0.00); |
13 | INSERT INTO #temp_People |
14 | VALUES (3, 'Linda' , 'Wong' , 800.00); |
16 | SELECT * FROM #temp_People; |
The SELECT INTO statement copies data from one table into a new table.
4 | WHERE SalePrice > 500000; |