Your SlideShare is downloading. ×
0
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

D I T211 Chapter 5 ( Lab 3)

1,847

Published on

Published in: Technology, Design
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,847
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×