Presentation is loading. Please wait.

Presentation is loading. Please wait.

Access Database for CIT12

Similar presentations


Presentation on theme: "Access Database for CIT12"— Presentation transcript:

1 Access Database for CIT12
Please use speaker notes for additional information! I am going to prepare a file/table in the access database to contain the information for the first problem in the first weeks assignment.

2 I called this database asgn1.mdb.
First open Access, when the screen comes up asking if you want to create a new database click that you want to create a Blank Access Database. Select the directory/folder where you want to save the database and give it a name. I called this database asgn1.mdb. This presentation uses Access you could also use Access 2002/XP. Note that the database has a .mdb extension which is the standard extension for Access databases. Click on create.

3 Select design to design a new table.
Notice that tables is selected. Again, if you are using a different version, things may be slightly different. Selecting design brought up this screen where we can design the file/table within the database asgn1.mdb. Notice that at this point, the table does not have a name. It will be named when you save the design.

4 I have now entered the first field which is called isbn
I have now entered the first field which is called isbn. Notice that it is a text field and that I made the field size 13 which will hold the largest ISBN number that I have. In access I use text field. Some other languages might call it character or string. I believe ISBN is a 10 digit number with three hyphens. Adding the hyphens makes this a character field instead of a numeric field. In addition, some ISBN numbers have letters especially in the last field. Another reason to make it a character field. In the bottom image of the screen, I am entering title which I am also making character - this time I decided 35 worked. I soon discovered that it should have been bigger, but rather than change the structure, I shortened the titles. I will now enter the other information in the same way. Now I have entered the next field which I am naming title. It is also a text field and I decided that 35 was big enough to hold the titles I was entering.

5 I made the year field a number and specifically an integer
I made the year field a number and specifically an integer. I do not have to specify the number of characters because integer has a specific number of characters. Note that I made author 25 and topic 15 characters. Access requires you specify a key when you create a table. If you do not, it establishes one for you numbering the first record 1 and the second record 2 etc. The key is supposed to be a unique string of data that is not duplicated. That makes the ISBN number a perfect candidate. More about keys later - for now just accept that things will work better if you establish a key on a file that will contain unique data. Before I leave, I establish a key for the record - isbn is my key. To do this I click on isbn and then click on the key icon.

6 I now have a table in my database.
When you try to close this screen, it asks if you want to save and then prompts you for a table name. I entered booklist and clicked OK. I am now saving the table structure. This is the design of the table that tells what data is going to be stored here. Now I can create records following this structure. Note that every record I create will conform to the table structure that I have just designed. I now have a table in my database.

7 When I clicked on the booklist table, this screen came up for me to do data entry.
Once the table has been designed and created, I now need to enter data into the table.

8 I entered 12 records (the 6 shown on the assignment and 6 more to give more data). Note that the data is entered into the structure of the table. This is known as populating the table.

9 The query screen comes up and shows the tables I have available to query. The only one that I have is booklist, so I will click on add. Now I want to design a query. Notice that I have high lighted Queries and now I will click on design. A query is looking at information and asking to see all records that meet a specific criteria. After I click on Add to add the booklist table, I then click on the Close in the Show Table popup screen.

10 When I click on the view icon, I will see the selected records.
I can double click on each of the fields in booklist that I want to see in my query and they will move to the line below. In this case, I decided to see all of the fields so I double clicked on them all. When I click on the view icon, I will see the selected records. In the query, I selected that I wanted to see all of the fields so it showed me all of the records in the table with each field on the record showing. This means by clicking on the view icon I go into view mode to see the records and by clicking on the design icon I go back into design mode if I want to make changes to or just see the actual query I did. I can click on the design icon to go back into design mode.

11 I saved the query as all and all now appears under my query list.

12 The intersetion of Criteria: and topic is where I am entering my criteria. I want all records where the topic is equal to Oracle. In this example, I selected three fields to see: isbn, title, topic. I then put under the intersection of Criteria and topic the entry ="Oracle". This means that I only want to see those records where the topic is Oracle. As you can see, 4 records meet the criteria and are displayed. This means I have the data to access my file/table and get records of a specific topic. I did not show it here, but I saved this query under the name oracle. Note that I am testing for equal here. I could also test fields for greater than or less then.

13 This shows all the records that meet the criteria title > "G" which actually means they they have to start with something greater than G. Not very useful, but I wanted to show greater than with a text field. The next slide will show it with a numeric field.

14 This shows all books where the year of publication was less than 2000
This shows all books where the year of publication was less than Note that when you are dealing with numeric data, you do not put quotes around the value. Contrast to ="Oracle" and >"G”.


Download ppt "Access Database for CIT12"

Similar presentations


Ads by Google