make a database - booklet 1 - mr hanson a database - booklet 1.pdf · artist name text 50 keane...

13
ICT @ WARLINGHAM MAKE A MUSIC COLLECTION DATABASE BOOK 1 – CREATE A SINGLE TABLE By the time you have finished this booklet, you will be able to make a computer database to store information about your music collection. Follow these step-by-step instructions and you can’t go wrong ….

Upload: phungnhi

Post on 18-Aug-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

ICT @ WARLINGHAM

MAKE A MUSIC COLLECTION DATABASE

BOOK 1 – CREATE A SINGLE TABLE

By the time you have finished this booklet, you will be able to make a computer database to store information about your music collection. Follow these step-by-step instructions and you can’t go wrong ….

Page 2: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 2 of 13

A database is a collection of information that is organised and stored on a computer.

• The data is stored in tables.

• The pieces of data within the tables are called fields.

• You can ask the database questions.

• You can print out your information and questions in reports. We will make a database that will store information about your music CD collection. The CDs that you have will be stored in a table. The information about each CD will be in a record. These records are then stored in a table.

You can ask the database questions such as:

“How many rock CDs do I have?”

“How many CDs do I have that were by Robbie Williams?” When you ask a database a question, it is called a query. When you have queried the database, you can print out reports.

The database management software that you will use is called MS Access.

Before you make any database, you have to plan it first. It is important that you consider all of the information that will go into the records and tables. Many tables can go within one database. These tables can be joined together and you can ask many powerful questions. If the database is not planned properly, it will not work.

Page 3: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 3 of 13

This is the information that we will store about each CD:

• CD Number • Artist Name

• Album Name • Genre

• Year Released Check out the information on the following CDs:

Keane, Hopes and Fears CD released in 2004.

James Blunt, Back to Bedlam CD released in 2005. Check out how the information is put into a table:

Field Name Data Type Length Example 1 Example 2

CD number Number Automatic 1 2

Artist Name Text 50 Keane James Blunt

Album Name Text 50 Hopes and Fears Back to Bedlam

Genre Text 20 Rock Rock

Year Released Date 4 2004 2005

The computer stores the information in a similar way.

Page 4: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 4 of 13

Now let’s make the data table within MS Access.

Find the MS Access program and open it: When you open the program the first thing you will have do is create a new database and saving location. Choose File � New Then click on “Blank database” from the options on the right hand side menus. Then find a location to put your database. Call it “CD and DVD Collection” and click on “Create”. This main database window will appear. You will learn how to use these things: Tables: used to create and look at tables.

Queries: used to ask questions.

Forms: make nice input templates

Reports: organise information from queries for printing.

Now we can make the first table to store information about your CD collection.

Page 5: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 5 of 13

Double click on “Create table in design view” and the following input screen will appear: This is where we define the fields in the table. Maximise it so that it fills the whole page:

We can classify the bits of data (fields) into different categories. When we do this the database will be very efficient. The common data types that we use are: Text For anything that contains words and numbers. Number For any real number. (Note that a phone number is always recorded as a text, because it is not a real mathematical number.) Date/Time For times and dates. Yes/No Where something is or is not true. Lookup When building a list of options to choose from.

Page 6: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 6 of 13

Now you can enter the things into the different fields for the table. Click on the first row in Field Name and enter in “CD Number”. Choose “Number” from the Data Type list.

Make the next field for the table: Field Name: Artist Name Data Type: Text You may see information appearing in the bottom half of the screen, just ignore this until later on. Make the next field: Field Name: Album Name Data Type: Text

The next field will classify the type of music it is such as Rock or Classical, etc. There are many different types of music and lots of categories, which are called “genres”.

Page 7: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 7 of 13

Check out all these genres: And that’s not all! Within the Rock Genre there is …

Within the Classical Genre there is …

We will simplify the list to the following categories otherwise we would be here all day and get very bored with the arguments!

* Classical * Country * Dance * Rock & Pop * Movie Soundtracks

Page 8: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 8 of 13

Make the next field name “Genre”. Choose “Lookup Wizard” as the data type. This is so that we can make a box with options to choose from. Choose “I will type in the values I want” from the dialog box and click on “next”. Type in these types Then click on next. Leave the label as “Genre” and click on finish.

Page 9: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 9 of 13

The last field to make is for the year released. Because there will only be a 4 digit year, set the Data Type as “Number”.

All tables in a database must have a Primary Key Field so that each of the entries (records) can be easily identified by the computer. A Key Field is generally a number. Each record can then have a unique number. Click on the column next to CD Number to highlight it. Click on the “Primary Key” icon to make this the key field. A small key will appear next to it:

The last thing to do is to save the table. Choose File � Save Call the table “CD Collection” and then click OK.

Your table is now made an ready to receive some CD information. Groovy!

Page 10: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 10 of 13

Close the saved table to go back to the main database window. Double click on the CD Collection table you have just made to open it. The following table view will appear:

Now you can simply enter in the data for each of your CDs in your collection. Enter in the following data below, using the tab key or enter key to move between the fields (columns):

See how the drop down box works? Complete the table by entering in the following 10 records: It is IMPORTANT that you enter each record one at a time – i.e. CD Number 1’s details and then CD Number 2’s details or the computer may get confused. Note that the CD Number is created automatically each time you enter a new record. If you make a mistake, press the Esc key to get out of the errors.

Page 11: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 11 of 13

Save the table when you have finished, and then close it. You can now make a report of all of the records that are in your database table. Make sure that you are in the main database window and choose the “Reports” tab. Double click on “Create report by using wizard”. Click on the double arrows to move all of the fields to the right hand side, as they will all be put into the report. Click on “next”.

Page 12: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 12 of 13

We do not want to do anything here, so choose “next”. We don’t want to do anything here either, so chose “next”. When you get here, choose “Tabular” layout and “Landscape” page orientation. Then choose “next”. Leave the style as “Corporate” and choose “next”.

Page 13: Make a Database - Booklet 1 - Mr Hanson a Database - Booklet 1.pdf · Artist Name Text 50 Keane James Blunt Album Name Text 50 Hopes and Fears Back to Bedlam Genre ... Make a Database

Page 13 of 13

Leave the title of the report as it is and choose “Finish”.

You should now have your completed report:

Wow!

Find the other booklets in the series and learn more about databases!