Refresher/SQL

From Wikiversity
Jump to navigation Jump to search

This is a refresher course for those who need to review basic knowledge of SQL.

For a comprehensive tutorial, go to http://www.1keydata.com/sql/sql.html.

Basic Concepts[edit | edit source]

  • Constraint: an input filter
  • Denormalizing: performance improvement through reduction in number of joins needed for data processing
  • Group by and order by clauses: expensive due to creation of temporary tables
  • Indexes' tradeoffs: faster retrieval, slower updates
  • Join: a logical connection between two tables
  • Normalizing: eliminating redundant information and making it easier for future updates
  • Primary key: a combination of columns which uniquely specify a row
  • Trigger: the code automatically executed in response to certain table events
  • Where vs having: where is a restriction and having is a filter
  • Wildcard: % using LIKE

Most Frequently Asked[edit | edit source]

  • Inner join: intersection, e.g. SELECT Person.LastName, Person.FirstName, Sales.OrderNo FROM Person INNER JOIN Sales ON Person.P_Id=Sales.P_Id ORDER BY Person.LastName
  • Outer join: union, e.g.
  • Foreign key: primary key of another table.

Comprehensive Tutorial[edit | edit source]

For a comprehensive tutorial, go to http://www.1keydata.com/sql/sql.html.