Database task 2.4

Page 1

Database Coursework Introduction What is a database? A database is a structured collection of records or data. Databases on computer are run by a DBMS or database management system for example Microsoft Access. The DBMS enables users to view, edit, create whole databases and / or other important features such as single fields, queries, reports, macros etc. Databases are a easy and simply way to organise large amounts of data, and process data easily within a few clicks. My Project In my project I will be creating and evaluation a CD ordering database. I have been given a large amount of data from a well known CD company. The data is of the companies CD sales in the year 2005. I will be using this data in my database to create a number or relationships, reports and queries. The data consists of 5530 records beginning from the 1st January 2005 and ending on the 31st December 2005. For my project I have chosen to use a popular DBMS called Microsoft Access. Microsoft access is and easy to use DBMS enabling the used to carry out very complicated situations in a matter of one or two mouse clicks. Tables The data I have been given contains 5529 data entries and 15 relevant data fields. To accommodate this data I will be creating two tables. The first will be called “Customer order” and the second “CD Details”. The reason for splitting the data into two tables is that I can later connect the tables with a relationship allowing me to display all the relevant data. Bellow are the two tables I will be creating and the fields that will be in the tables. Above is the table for when a customer orders a CD. It shows the CD details, however can also display the customer who have ordered that CD. You can see the customer order table above. This will contain all the customer detail / payment details/ and the some of the CD details. Both tables contain the field “CD Number” which will be used to connect the two tables via a relationship. In the Customer Order table, the primary key is the Order


Number and in the CD Details the primary key is CD Number, this is also the foreign key in the customer order table. In the first table all the fields are relevant to the customers personal and payment details, for example “First Name”, Last Name”, address are all relevant to the customer details. I have chosen to use the order number as the primary key for this database as the order number is unique and will not be duplicated. Relationships For the relationship between the “Customer Order” table and the “CD Details” table I have use a one to many relationship. The reason for this is because with a one to many relationship you can have one product being displayed for many customers, which may be the case for CD ordering. As you may have 100 different people all wanting to order one CD.

Product

Customer and Order table

Bellow are details of my “Customer Order” table. It shows the field name, data type, field length, and validation rule: Field Name

Data Type

Field Length

Validation

Order Number Title

Text Text

25 10

Primary Key Look Up – Value List – "Mr";"Mrs";"Ms";"Miss"; "Master";"Dr"

First Name

Text

50

Last Name

Text

50

Address Line 1 Town County Post Code

Text Text Text Text

50 50 50 10

Card Type

Text

50

Input Mask - LL090LL Look Up – Value List – "Armenian Express"; "Mister Card";"Francard"; "VISTA";"Socket"


Card Number

Text

12

Expiry Date CD Number

Date/Time Text

50

Input Mask – 000000000000 General Date Foreign Key

Table 2 Field Name

Data Type

Field Length

Validation

CD Number CD Title CD Artist

Text Text Text

20 50 50

Primary Key

Validation I have used validation in my database for many fields. Validation is extremely useful as it checks that the data that is being imputed is in the correct format. For example, if you ask someone to input their date of birth, the day would not exceed “31”. If the user did type in a number above 31, the database would not allow this umber to be entered and would display an error message with an explanation why the number has not been excepted. I have used validation on my database for the following: Title – The title field has a validation on it in the form of a look up (value box). This means that the user can select the appropriate title from a selection box. The user can select the following: “Mr";"Mrs";"Ms";"Miss";"Master" and "Dr". The user then is restricted to these options and cannot select or enter in any other title. Postcode – I have used an input mask on the postcode field to check that the postcode has been entered in the correct format. Card Type – The card time field uses look up validation. The user selects from a list of options the card that they will be using to pay. The options for this field are : Armenian Express, Mister Card, Francard, VISTA,and Socket. Card Number – The card numbers in the data that I have been given all are 12 digits long. Therefore I have put a validation, so that the user can enter a maximum of 12 digits. Expiry Date – The expiry date has been formatted so that the data type is in the format “Date/Time”. The date will be in the format DD/MM/YYYY Field Lengths – For each field types I have chosen a sensible field length. For most of the field types, I have reduced the field lengths from 50 characters to 20 characters.


Relationships This shows the relationship between my two tables. You can see that the CD number connects them in a one to many connection. This means that on product can appear in many orders

Order Number This is a screenshot of the order number field type. I have validated the maximum length of the order number field to 25 characters.

Title This screenshot shows the title field, which I have used a look up to validate it. The user can select an option from the list box and cannot enter in any other value. The options available for the users are: "Mr" "Mrs" "Ms" "Miss" "Master" "Dr"


Postcode This is a screenshot of the postcode field. I have used an input mask of “LL090LL” The “L” means that a letter must be entered. The “0” means a number must be entered and the “9” means there should be a space entered. This input mask means that if users try and enter in a postcode that does not match this format, the database will not accept it. It helps make sure that all the postcodes entered are correct.

Credit Card Type For the credit card type field I have again used a lookup. This enables the user to select a card type, and the database will not accept any others. The card types available are : "Armenian Express" "Mister Card" "Francard" "VISTA" and "Socket". Card Number Again I have used an input mask for the Card Number field. The input mask of “000000000000” means that the database will only accept 12 numbers being entered.


Field Name Order Number Title

Data Type Text

Validatio n Primary Key

Valid

Invalid

Field Length 25

Text

Look Up – Value List – "Mr";"Mrs";" Ms";"Miss"; "Master";"Dr "

Mr, Mrs, Ms, Miss, Master, Dr

Sir

10

First Name

Text

50

Last Name Address Line 1 Town County

Text Text

50 50

Text Text

50 50

Post Code

Text

Card Type

Text

Card Number

Text

Expiry Date CD Number

Date/Ti me Text

Field Name CD Number CD Title

Data Type Text Text

50

CD Artist

Text

50

Input Mask XX1 3XX LL090LL Look Up – Armenian Value List – Express, Mister "Armenian Card, Francard, Express"; VISTA, Socket "Mister Card";"Franc ard"; "VISTA";"S ocket" Input Mask – 758663528654 0000000000 00 General Date 12/05/2002

36S D5D

10

Visa

50

756fht63g657

12

90/14/0001

Foreign Key Validatio n Primary Key

50 Valid

Invalid

Field Length 20


Validation Postcode – When you try and enter in a postcode that is not in the correct format, the computer database simply does not let you enter in the character. It will only let you enter in that character, if it fits with the validation rules. Credit Card Number – As the credit card number field is also validated by an input mask, the same happens when you try and put in a wrong piece of data. For example, the database will only let you enter in numbers. If you try to enter in anything else, it does not except it. Also, the database will not let you enter in any more that 12 digits.

Credit Card Type – The Credit card type uses a lookup, this means that the user can only select one of the options given when the click on the value list. Therefore, no other data can be imputed. Title – I have also used a lookup for the title field, meaning that the users can only select the titles from the options given. This validation means that no other titles can be selected or entered into the database. Importing the Data The data was given to me in the format of a text document. I needed to import the data from the text document into the database. To do this I had to use the “Import Text Wizard” in Microsoft Access. The Screenshot to the left shows the first part of the wizard. I firstly wanted to import my data into the “CD Details” table. To do this, I have selected delimited format instead of fixed width.

The image on the right shows the next step in the wizard. As the first row of my data contains my field names, I have tickets the box saying “First Row Contains Field Names”.


This stage in the wizard allows you to choose where the imported data will be placed. I have selected the wizard to place the imported data into the “CD Details� table.

This is the advanced tab of the wizard. From this tab you can choose which fields to import. For example, I have only imported 3 fields into my CD details table, which are : CD Number, CD Title and Artist.

This is the final screenshot of the wizard that I used to import my data into the CD Details table. I then clicked the finish button, and the data imported into that table.


On the left is the imported data for the CD Details table. The table consists of 28 records. I had to import this table first, as if I tried to import the customer order table, it would not have worked as the customer cannot order something that does not exist yet.

I had to do the same for the Customer Order table. As before I used the import text wizard to import the data into the table. The Screenshot to the left shows the first part of the wizard. I firstly wanted to import my data into the “CD Details” table. To do this, I have selected delimited format instead of fixed width.

The image on the right shows the next step in the wizard. As the first row of my data contains my field names, I have tickets the box saying “First Row Contains Field Names”.


This stage in the wizard allows you to choose where the imported data will be placed. I have selected the wizard to place the imported data into the “Customer Order” table.

The image on the right shows the advanced tab. tab of the wizard. From this tab you can choose which fields to import. For example, I have only imported all the fields that I didn’t import last time.

He is the final stage of the importing process, this is the last screen that confirms where you would like to import the data. In this case I have chosen to import the data into the “Customer Order” table.

On the left is the imported data for the Customer Order table. The table consists of 5529 records. I had to import this after the CD details table, as if I tried to import this table first, it would not have worked as the customer cannot order something that does not exist yet.


Queries Credit Card Type Count

Here is a screenshot of the design view for my “Credit Card Type Count” query. This query allows the user to see what is the most frequently used credit or debit card by their customers.

The only table I have used in this query is the Customer Order table. To create this query I have selected in the totals box, I have selected “Count”. This counts how many of the same card are being used and displays the total. I have also made the count descending so that the most popular option displays at the top. As you can see from the picture on the right, when the query is displayed in its normal view, the card with the largest popularity is displayed first, and labelled. Then followed by the next and so on. This query could be useful as it gives the company information on the way their customers pay, meaning that they could improve the most popular way, or make deals with the most popular credit/debit card.


Albums per Artist Count

Above you can see screenshots of both the design view and the finished view for the “Albums per Artist Count” query. To make this query I only needed to use one field out of the whole database, which was the “CD Artist” field. I firstly grouped all the artists, and then counted how many times each one appears by using the count tool in the totals box. This query enables the user to see how many albums a certain artist has produced and is extremely useful if someone wants to see how many albums a particular artist has produced.


Number of Orders per Album Count

Above are screenshot of both the design view and the datasheet view for the number of orders per album query. To create this query I had to use both tables. Firstly from the CD Details table I choose to ground the CD titles. I then designed the query to count the number of orders of these titles using the count function. The results are displayed in descending order so that the most orders are show at the top for easy reviewing. This query would be useful for looking at what is the most popular CD for order at the current time.


Customer Details Query The screenshots bellow show the customer details query in both the design view and the worksheet view. The query displays the all customer details that are held in the database. This would be extremely helpful for the company, as there is a lot that a company could do with this information. Such as, selling it to larger 3rd party companies for large amount of money, or also keep the details so that they can send them details of new products in the hope that customers will return and buy more from the company.

Country Count Query

On the left you can see the screenshot for the Country Count query. It displays what down most of the company’s customers are from. To make this query, I used both the tables, and used designed the query so it would count the county field. This query would be useful for the company as with this information, they could target certain areas to improve sales etc.


Reports Country Count

On the left is my county count report. I have used the customer count query so that I can quickly see all the data in a professional looking report. This report shows the user a list of towns alphabetically and then shows how many people have placed orders from that town. This is useful as if the company wanted to know which county was under performing etc they could

Card Type Count Here you can see that I have create a pivot table for the “Card Type Count�. This makes the data extremely easy to see, for example from the graph I can instantly see that VISTA is the most used card.


I also created a report for the card type count. The report shows the users easily and quickly which card is the most popular. It its shows at the bottom how many cards are being used. This sort of information is extremely useful if the company wants to know what their customer wants and what their customer is using to pay. VISTA seems to be the most popular payment, so with this information the company could go to vista and make deals with them to try to benefit both them and their customers. Customer Details The customer details report is displayed on the left. I created this report from the “Customer Details� query. The fields used in this report are: Title, First Name, Last Name, Address Line 1, Town, County, and Post Code. All this information about the customer is displayed in a professional and presentable report as seen in the screenshot above. To make it easier for the end user to read, the report is in alphabetical order by the customers last names and then again by their first names. Orders per Album The Orders per Album report shows how many orders have been placed for each album. This can be used to display the most popular albums and find out what sorts of albums are selling. You can see her that I have displayed this data in the form or a bar graph. Doing this makes it easy to see which albums are being sold and which are failing. I created this report using


firstly the CD title from the CD details table, and then the order number from the order details table. Here on the left you can see how the report looks like. I kept the order of the report in alphabetical order of the album name so that you could easily search for an album and then see how many orders it has.

Albums per Artist The Albums per Artist report is useful in seeing how many albums a particular artist has produced. Very often if people like an artist they will want to hear more music from the same artist an will therefore want to know other albums the artist has. This report is useful in tell how many albums the artist actually has. It is sorted alphabetically for easy of use, and can be put in to graph format as shown below.


Evaluation I am pleased with the outcome of the database that I have created. Although I had basic knowledge of database work and how to use Microsoft Access I was impressed with the level that I too my database to and the result that came from it. I started my database project by importing the text files into my database. Considering I had never imported anything into Access before and didn’t even know that feature was available to me, I was able to pick up how to import quickly and for the process easy. The first thing i decided to do once i had imported all the data was to set validation rules. This was to make sure that all the data in the cell was of the correct format and length etc. Validation for my database was in a number for formats such as, text for example the title field. I validated the title field so that users could only select from a list of titles, also numerical for example the validation of the card number. I made sure i had set as many validation rules as possiable to make sure that all my data was in the correct format. An important stage after setting the validation rules was to test them, to make sure that they worked properly. This proved especially important for me as when going through and checking that the post code validation in my database worked, i found that i had made an error. I had validated the field so that it would only let you enter 6 character, but then realised that some post codes have 7. My validation was changed and work perfectly after the alteration. The next stage of the database was to create a relationship between the two tables that i was using. I linking the two tables with a one to many relationship using the “CD Number’ field which was in both tables. After creating the relationship i moved on the creating some queries. From previous database projects i have learnt a little about quieries but was far from being an expert. Throughout the query making i learn many new things, including the count function. Before creating the queries i was thinking about creating very complex queries with parameters etc, but couldnt find the need for them in this project. So i stuck to the basics and created 5 simple queries which used many feature. After creating the quieries i found it import to be able to display them in a way that wasnt just raw data. I looked and created pivot charts and reports, which could (if needed) be printed or displayed on screen to explain the figures found by the queries. My Comments I enjoyed creating the databse very much and felt that my performace in the creation was a good and positive on. I realised whilst making it, how this databse could work in a real business enviroment and could help to mkae a company more successful in sales. Although it took and of hard work and time to make, it was extremely worthwile and i feel that i have learnt alot from this task. I believe the e-portfolio on a whole has gone well, and couldnt wait to bring it all together and appreciate my hard work other the past few months. Not wanting to loose my hard work, i made sure that i saved regularly and that back-up were created,


as i am well aware how unreliable Mr Gates PC’s now are! It has been a pleasure to create this e-portfolio and i have enjoyed creating it. Conclution When i look at the databse i have created on a whole, i am pleased with the lessons i have learn and the outcome i have created. I was able to use skills i was learning throughtout the task to create a working and business like database. Even though throught the project i was questioning myself to if i was making the right decisions on some point, i sill believe i have created high quality database. Overall i believe if i had more time, i could have continued working on the database to keep improving it and make it more user friends, but with the time limit given i am pleased with what i have created. When i look and my e-portfolio overall i am pleased with what i have created. I believe the e-portfolio has been a successful one and my performance it it was of good quality. I have enjoyed creating the e-portfolio and would like to do something similar again.



Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.