50 likes | 174 Views
This guide provides a comprehensive overview of working with SQL queries in Microsoft Access. Learn how to create Make-table queries to build class tables for different semesters, select data using queries, and change query types effectively. Additionally, discover how to create Union queries to combine multiple queries into one, ensuring fields are aligned correctly. Practice adding records to existing tables using Append queries and relate fields between queries and tables to seamlessly manage your data.
E N D
CPSC 203 Xin 27 October, 2010
Import Data • Excel Access
Make-table queries • Query Table • Practice • Create a Class table for different semesters • Select the data with a query • Change the query type to Make Table Query • Run the Query • Set Class to be the Primary Key of the new table • Create five (5) queries, each showing • ID • Student • WebsiteRankX • Website Name
Union Queries • Many queries one query • Source queries have the same # of fields • The fields must be in the same order and data types • Union Queries must be done in SQL • Practice • Create a union query to combine the five queries just created • Create an empty query • Change the type to Union • Input the following SQL • SELECT QueryWeb1.* from QueryWeb1 • UNION • SELECT QueryWeb2.* from QueryWeb2 • UNION • SELECT QueryWeb3.* from QueryWeb3 • UNION • SELECT QueryWeb4.* from QueryWeb4 • UNION • SELECT QueryWeb5.* from QueryWeb5
Append Queries • Add records to an existing table • Practice • Create a blank table, WebRanking, containing • WebsiteRankID (Autonumber) • ID (Number) • Student (Number) • WebsiteRank (Text) • WebsiteName (Text) • Create a new query based on the union query • Change the type to Append • Relate fields in the union query and the table • Run the query to append data