MS Access SQL Tutorial
- The first object needed in an Access database is a table. The table is where all data is stored. In most databases, multiple tables hold sections of categorized data. For instance, an online store may have a table for customers, one for orders, and another for product lists. All these tables are linked together using relationships. For each order a customer makes, the customer number is inserted into the orders table. Since the customer number is also located in the customer's table, these two rows in separate tables form a relationship. The same is used with the products table. Each order has a product, so the product identification number is inserted in the orders table. This forms a relationship link from the order to the products table.
Creating a table is accomplished in the main menu of the database. Double-click the "Create table in design view" icon and a new table template opens. It's in design view where each column is created. A column holds a different piece of information for each record. For instance, in the customer table, the first name, last name, and address of the customer are examples of columns. - Queries are the way to select data from a table. While small tables with few records are easy to find records, tables may grow to thousands of records. Queries retrieve the information from tables according to the criteria given. Queries also use the relationships setup in each table. This helps the user return one record set of data without querying each table separately.
To create a query, double-click the "Create query in design view" icon on the main database screen. This opens a wizard where the applications asks for tables. Select the tables that hold the data needed for display. Once the tables are added, drag and drop columns into the results section at the bottom of the Access screen. Click "Run" and a sample output is displayed. Queries can be complex or simple, depending on the necessities of the report.