100 likes | 240 Views
Dive into the essentials of SQL Select statements in IST359 with Yang Wang. This presentation covers a range of topics including the Fudgemart conceptual model, the structure of Select queries, filtering with WHERE conditions, ordering results, and advanced techniques like TOP, DISTINCT, and various types of table joins. It emphasizes understanding through practical examples and highlights the importance of attending lectures for deeper insights. Unlock the power of SQL for data manipulation and analysis.
E N D
SQL Select Statement IST359 M005 Yang Wang ywang@syr.edu 342 Hinds http://blackboard.syr.edu
Acknowledgements and caveat • These slides draw liberally, with permission, from the following sources: • IST359 materials by Prof. Michael Fudge Jr. • Slides from Murach’s SQL Server 2008 book • Caveat (beware): At best, PowerPoint slides are only a pale limitation of the entirety of a class meeting. In IST359 in particular, the lectures will cover topics beyond what appears in these slides. Don’t rely on them as a substitute for attending class.
Agenda • Understanding Fudgemart • Select from, where, order by • Top and distinct keywords • Table joins • Column and table aliasing
SELECT SELECT {colname [, n] | * } FROM tablename [WHERE condition] [ORDER BY col [ASC | DESC]]
SELECT SELECT employee_id, employee_hourlywage FROM employees WHERE employee_hourlywage > 10 ORDER BY employee_id DESC
Demo #1 • Basic SELECT • Columns • Where ( AND .vs OR) • Order by • Cast / Convert • TOP / Distinct
SELECT HOW WE SAY IT HOW IT IS PROCESSED FROM WHERE SELECT (Projection) ORDER BY TOP / DISTINCT • SELECT (Projection) • TOP/ DISTINCT • FROM • WHERE • ORDER BY
Demo – Table Joins • Select JOINS • Cross (Cartesian product) • Inner / Equijoin • Table and Column Aliasing • Outer joins (Left / Right / Full)