SQL Queries
SQL Queries
Offers Courses
Cno Year FID Cno Title Hours Dept
CS374 1999 2010 CS374 Database I 3 CS
M150 1998 1557 M150 Calculus I 3 Math
CS374 1998 2158
Tuple Variables
• Renaming (Relation Aliases) can simplify query
specifications.
You can rename a table or a column temporarily by giving another name known as Alias.
The use of table aliases is to rename a table in a specific SQL statement. The renaming is
a temporary change and the actual table name does not change in the database.
(select SID
from Enrollment E, Courses C
where E.Cno = C.Cno and Title = ‘Database I’)
union
(select ____ from ____ where)
(select SID union
from Students (select ___ from _____ where)
where Major = ‘CS’)
inner query