Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SELECT *
FROM (
SELECT id, name, textbook, credits
FROM Course
WHERE is_active = 'No'
)
AS Temp_table;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT id, name, textbook, credits
INTO #Inactive_courses
FROM Course
WHERE is_active = 'No';
SELECT * FROM #Inactive_courses;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SELECT *
FROM (
SELECT id, name, textbook, credits
FROM Course
WHERE is_active = 'No'
) AS Temp_table
JOIN Teaching ON Temp_table.id = Teaching.course_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SELECT id, name, textbook, credits
INTO #Inactive_courses
FROM Course
WHERE is_active = 'No';

SELECT *
FROM #Inactive_courses
JOIN Teaching ON #Inactive_courses.id = Teaching.course_id;
5 changes: 5 additions & 0 deletions sql-queries-4/temporary-table-select/using_AS_Syn.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT *
FROM (
SELECT column1, column2 FROM Existing_table WHERE condition
)
AS Temp_table;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT column1, column2
INTO #Temporary_table
FROM Source_table
WHERE condition;