Presentation is loading. Please wait.

Presentation is loading. Please wait.

DAY 16: MICROSOFT ACCESS – CHAPTER 2 Madhuri Siddula October 8, 2015.

Similar presentations


Presentation on theme: "DAY 16: MICROSOFT ACCESS – CHAPTER 2 Madhuri Siddula October 8, 2015."— Presentation transcript:

1 DAY 16: MICROSOFT ACCESS – CHAPTER 2 Madhuri Siddula masiddula@mix.wvu.edu October 8, 2015

2 TOPICS Single Table queries –Run the Query –Sort the query –Criteria on the query –Wildcards –Conditions on Numeric Data Multiple Table Queries

3 TABLE RELATIONSHIPS Access Databases are relational databases, they connect to each other tables through common fields. –Common fields are fields that contain the same data in more than one table After you have a table for each subject in your database, you must provide a way to connect the data in the tables when you need meaningful information.

4 TABLE RELATIONSHIPS To connect the data in your tables, create common fields in related tables, and then define table relationships. –A relationship is an association established between two tables based on common fields. –Once established, you create a query, a form, or a report that displays information from more than one table.

5 CREATE TABLE RELATIONSHIPS Add tables to your relationships tab

6 CREATE TABLE RELATIONSHIPS

7 Create two relationships –MemberStates and Demographics –MemberStates and Economics Enable “Enforce referential integrity” and “Cascade update related fields” Disable “Cascade delete related fields”

8

9 QUERIES Query is: –Answers a question –Creates a subset of records, according to your specifications Select query – database object that retrieves (selects) specific data from one or more tables Query design view – creates complex queries

10 CREATE A QUERY IN DESIGN VIEW Data source – table or tables where a query selects its data

11

12 ADD “DEMOGRAPHICS” TABLE

13 DISPLAY “MEMBER ID”, “CAPITAL” AND “POLITICAL SYS”

14 RUN THE QUERY AND SEE THE RESULTS

15

16 SORT THE QUERY Sort the result by Member ID and then by Capital in Ascending order. Remember, the sorts are applied from left to right, so any additional sorts must be applied to fields located to the right of your primary sort. If necessary, you can rearrange the fields by clicking the top of a field and dragging it to a new location.

17

18 CRITERIA ON QUERIES Display only Political Sys = “Republic”

19

20 USING WILDCARDS IN A QUERY Wildcard characters – serve as a placeholder for one or more unknown characters in the criteria. Use wildcard characters in place of the characters: –Asterisk (*) is a place holder to match one or more characters. –Question mark (?) is a wildcard that is used to search for unknown single characters.

21 USING WILDCARDS IN A QUERY Display records whose capital starts with either “S” or “N”.

22 USING WILDCARDS IN A QUERY

23 Also display records whose capital second letter in the name is “a”

24 USING WILDCARDS IN A QUERY

25 CONDITIONS ON NUMERIC DATA Add “Population” field to your query. Display records where population is greater than 50 million and less than 80 million.

26

27 SAVE THE QUERY

28 MULTIPLE TABLE QUERIES Create a query that lists the ID, full name, capital, year of entry, population, and political system of EU member states.

29 MULTIPLE TABLE QUERIES Add two tables “Member States” and “Demographics” when creating a query.

30

31 RUN THE QUERY

32 THINGS TO DO Create separate queries to provide the information requested below. Name each query after the step in which it appears (e.g., name the query in Step a as QueryA). HINT: Run your queries to test them. Make sure that they display all and only the records that you would expect to appear. Specify criteria a)Create a query that lists the ID, full name, capital, year of entry, population, and political system of EU member states. i.Run the query to see the unrestricted results. ii.Restrict the query to return records for only those member states that are Republics. HINT: The query returns 18 records.

33 THINGS TO DO b) Create a new query that lists the full name, GDP, employment rate, and population of member states. Only display states where the population is greater than 50 million and the employment rate is 60% or higher. Member states with GDP greater than 900 should be included irrespective of the population and employment rate. HINT: The query returns 5 records.

34 THINGS TO DO Sort query results c) Create a copy of Query5B. Sort the results by GDP and then by name, both in descending order. HINT: The query returns 5 records Use wildcard operators d) We wish to create a new query that lists all member countries whose names begin with “L” or “S”. We must also include countries where the second letter in the name is “R”. Display the member ID, full name, year of entry, and capital. HINT: The query returns 10 records.

35


Download ppt "DAY 16: MICROSOFT ACCESS – CHAPTER 2 Madhuri Siddula October 8, 2015."

Similar presentations


Ads by Google