• Save
D I T211    Chapter 5 ( Lab 3)
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

D I T211 Chapter 5 ( Lab 3)

on

  • 2,358 views

 

Statistics

Views

Total Views
2,358
Views on SlideShare
2,358
Embed Views
0

Actions

Likes
2
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

D I T211 Chapter 5 ( Lab 3) Presentation Transcript

  • 1. CHAPTER 5 TABLE RELATIONSHIP AND CREATING QUERY
  • 2. LAB 3: TABLE RELATIONSHIP AND CREATING QUERY
    • 5.1 Create Relationship
    • 5.1.1 Set Primary Key
    • 5..1.2 Create Relationship between Tables
    • 5..1.3 Enforce Referential Integrity
    • 5.2 Create Queries
    • 5.2.1 Create Query in Design View
    • 5.2.2 Create Query using Wizard
    • 5.3 Open Query
    • 5.4 Change Query
  • 3. LAB 3: TABLE RELATIONSHIP AND CREATING QUERY
    • 5.5 Rearrange Fields
    • 5.6 Delete Field
    • 5.7 Hiding and Select Fields
    • 5.8 Sort Query Results
    • 5.9 Using Query
    • 5.10 Using Criteria
    • 5.11 Rename and Delete Query
  • 4. CREATE PRIMARY KEY
    • Click on the field to use as the primary key. To select more one key, hold the CTRL when selecting.
    • Click on button to set the field as the primary key.
    • Click on button to save your changes.
    • Set the Indexed property of the field to Yes (No Duplicates) . This is to allow no two identical primary key values to occur.
  • 5. CREATE A RELATIONSHIP
    • Click on button to display the Relationships Window .
    • Click on the Show Table dialog box button.
    • Click on a table you wanted to add to the Relationship Window .
    • Click on Add button on the Show Table dialog box to add the table.
    • Repeat the step to add more tables to the Relationships Window .
    • When all the required tables are on the Relationship Window already, click on close on the Show Table dialog box.
  • 6.
    • Position the mouse on the field you wanted to create a relationship.
    • Drag the field over the other table until a small box spears over the matching field. Release the mouse button.
    • The Edit Relationships dialog box appears.
    • Check on one of these check boxes, that is, Enforce Referential Integrity , Cascade Update Related Fields and Cascade Delete Related Fields .
    • Click on Create button on the Edit Relationships dialog box to create the relationship.
    • The Relationship Window will have the two tables appear with the connections.
    CREATE A RELATIONSHIP
  • 7. CREATE QUERY (IN DESIGN VIEW)
    • Click on Queries in the Database Window .
    • Double click on Create query in Design View .
    • The Select Query Window and the Show Table dialog box appear, as in Figure 5‑15.
    • Click on a table that contains information you wanted to use in your query.
    • Click on Add to add the table to your query. The selected table appears in the display area.
    • Click on Close button to hide the Show Table dialog box. The Select Query Window will appear.
    • If you want to delete the table inserted in your Select Query Window , click on the table and then press the DELETE key. This removes the table from the query, but not from the database.
  • 8. CREATE QUERY (IN DESIGN VIEW)
    • Double click on a field you wanted to include in your query.
    • Press the button when you are ready to run the query.
    • The result of the query appears as in Figure 5‑19.
    • Click on button to save your query so you can run the query again later.
    • The Save dialog box appears.
    • Type a name for your query.
    • Click on OK.
    • You are back in query results, so, when you finish viewing the results of your query, click to close the query.
  • 9. CREATE A QUERY (BY USING WIZARD)
    • Double click on Create query by using wizard. The Simple Query Wizard appears.
    • Select the table containing the fields you wanted to include in your query.
    • Double click on each field you wanted to include or use the button to select a field at a time or the button to select all fields.
    • Select the table containing the field you wanted to include in your query.
  • 10.
    • Click on button to select all fields of the selected table.
    • Select another table named Book.
    • Repeat the previous steps to insert another list of fields from another table.
    • Click on Next to go to the next page of Query Wizard.
    • Accept the default option, that is Detail (show every field of every record) , then click on Next .
    CREATE A QUERY (BY USING WIZARD)
  • 11.
    • Type Book_Author Query as the title of the query name.
    • Click Finish to complete the query creation .
    • You will be back to the Database Window (as shown in Figure 5‑27) with the Book_Author Query created and shown on the window pane.
    CREATE A QUERY (BY USING WIZARD)
  • 12. OPEN A QUERY
    • open a query:
    • Click on Queries.
    • Double click on the query in the Database Window .
    • The query opens up. You can now review the result of the query.
    • When you finish working with the query, click on to close the query.
    • A dialog box will appear if you have not saved the changes for the query yet. Click on Yes if you want to save the changes.
  • 13. CHANGE A QUERY
    • Double click on the selected query to open it. The Query is displayed in datasheet view.
    • Click on this symbol to change the view to design view.
    • The query appears in the design view.
    • In the above example, notice that the design view button changes to . You can click on the view button to quickly switch between the Datasheet and Design views.
  • 14. REARRANGE FIELD
    • Position the mouse directly above the field you wanted to move, that is Book_Title.
    • Drag the field to a new location.
  • 15. DELETE THE FIELD
    • Position the mouse directly above the field to be deleted.
    • Click and select the field.
    • Press the DELETE key.
    • The field disappears from your query.
    • Click on button to save the changes.
    • Click on this datasheet symbol to display data in Datasheet View .
    • The query displays the result without the field the deleted field now.
  • 16. HIDE A FIELD
    • If you do not want a field to appear in the results of your query, click on the Show box for the field and it is displayed as  . Otherwise, keep the show box as  .
    • The unselected field does not appear in the result of the query.
    • To return to the Design View , click on .
  • 17. SORT THE FIELDS IN A QUERY
    • Click on the Sort area for the field you wanted sort its results.
    • Click on an order you wanted to sort data with, that is, Ascending , Descending or (not sorted).
    • Click on button to run the query.
  • 18. SET CRITERIA FOR RECORDS
    • Click on Author field and set the criteria. (only books that are written by Wendy will be display)
    • Type the criteria and then press ENTER . Access may add quotation marks (“ “) or number sign (#) to the criteria you type.
    • Click on button to save the changes and click on button to run the query.
    • The results of the query appear.
    • In this example, the results show the titles that are written by one author (Wendy).
    • To return to the Design View , click on .
  • 19. RENAME A QUERY
    • Click on Queries in the Database Window.
    • Click on the name of the query.
    • Click on the name of the query again. A black border appears around the name of the query.
  • 20. DELETE A QUERY
    • Click on the Queries in the Database Window .
    • Click on the name of the query you wanted to delete.
    • Click on the to delete the query.
  • 21. EXERCISE
    • 1. Create a query to list down the book that is written by author and title.
    • Bina Queries yg menyenaraikan buku yang ditulis oleh pengarang dan tajuk buku tersebut.