Skip to content

Commit

Permalink
Create Temp_Tables
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTheAnalyst authored Feb 2, 2021
1 parent 7590d97 commit 9661640
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Temp_Tables
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Create table #temp_employee2 (
EmployeeID int,
JobTitle varchar(100),
Salary int
)

Select * From #temp_employee2

Insert into #temp_employee2 values (
'1001', 'HR', '45000'
)

Insert into #temp_employee2
SELECT * From SQLTutorial..EmployeeSalary

Select * From #temp_employee2




DROP TABLE IF EXISTS #temp_employee3
Create table #temp_employee3 (
JobTitle varchar(100),
EmployeesPerJob int ,
AvgAge int,
AvgSalary int
)


Insert into #temp_employee3
SELECT JobTitle, Count(JobTitle), Avg(Age), AVG(salary)
FROM SQLTutorial..EmployeeDemographics emp
JOIN SQLTutorial..EmployeeSalary sal
ON emp.EmployeeID = sal.EmployeeID
group by JobTitle

Select *
From #temp_employee3

SELECT AvgAge * AvgSalary
from #temp_employee3



0 comments on commit 9661640

Please sign in to comment.