Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Developing an information system using ACCESS
ACCESS is a Relational Database Management System (R-DBMS)
Amos DAVID
2
ERM : University students
STUDENTStudent n°First nameLast nameDate of birth DEGREE
Degree codeTitle
COURSECourse codeCourse titleNo of hours
DEPARTMENTDepartment codeTitleFaculty
TakesYearscore
Managed by
Requires
RegistersYear
(1,m)(1,n)
(1,n)
(1,m)
(1,n)
(1,m)
(1,n)
(1,1)
[1 : n]
[n : m]
[n : m]
[n : m]
3
RM : University students STUDENT (Student n°, First name, Last name, Date of birth)
DEPARTMENT (Department code, Title, Faculty)
DEGREE (Degree code, Title, Department code)
COURSE (Course code, Course title, No of hours)
REGISTER (Degree code, Student n°, Year)
TAKES (Course-reg-no, Course code, Student n°, Year)
REQUIRES (Course code, Degree code)
4
Graph of relations : University students
REQUIRESCourse codeDegree code
STUDENTStudent n°First nameLast nameDate of birth
DEPARTMENTDepartment codeTitleFaculty
DEGREEDegree codeTitleDepartment code
COURSECourse codeCourse titleNo of hours
REGISTERDegree codeStudent n°Year
TAKESCourse reg noCourse codeStudent n°Year
6
Concepts
Relation Table Attribute Field Key Key Domain To be specified by the developer
Collection of relations Database
Graph of relation Relation
7
Suggested steps for creating an IRS using ACCESS Specify the graph of transition Create the field dictionary
The list of all the fields of the database indicating their domains Create the database Create the tables Create the relation Prepare sample records Create the sample records Prepare the requests Prepare the macro-commands Develop the forms
For updating the records For accessing information For implementing the transition graph
9
Basic principles of ACCESS
ACCESS is based on Object oriented principle
Select an object Choose the action to perform on the object
Select the action Choose the object unto which the action will be
performed
10
Create a new database
Modify an existing database
Create a database without table
CREATING A DATABASE
11
Creating a table
Create the table Specifying the keys Specifying the domains
By intention Predefined data types
By extension Specification by lists
16
Illustrate SQL through examples of requests
SELECT list of field FROM list of tablesWHERE condition
17
Illustration using Shopping
CLIENTClient NumberClient NameClient Town
BOUGHTSales numberArticle NumberClient NumberQuantityDatePaid
ArticleArticle numberArticle NameUnit price
CLIENT (Client Number, Client Name, Client Town)
BOUGHT (Article Number, Client Number, Quantity, Date)
Article Article number, Article Name, Unit price)
BOUGHT (Sales number, Article Number, Client Number, Quantity, Date, paid)
Article Number, Client Numberdon’t form a key
18
Dictionary of attributes Client number (Integer) First Name (Char(50)) Last Name (Char(50)) Town (Char(50)) Article number (Integer) Article Name (Char(50)) Unit price (Real) Sales number (Integer) Quantity (Real) Date (Date) Paid (Yes/No)
19
Test data : CLIENT
Client number, FName, LName, Town
1, James, John, Ibadan 2, Ojo, Julius, Ibadan 3, Abraham, Ife, Lagos
20
Test data : ARTICLE Article number, Article name, Unit price
1, Milk, 250 2, Bournvita, 380 3, Sugar, 170 4, Pressing iron, 550 5, Bread, 100 6, Cooking pot, 600 7, Silver Tea cup, 300 8, Silver Drinking cup, 400 9, Tampico 50L, 200 10, Apple juice 50L, 250
21
Test data : BUYS Sale number, Client number, Article number, Quantity, Date, Paid
1, 1, 1, 1, 22/07/2006, yes 2, 1, 2, 3, 24/07/2006, no 3, 1, 1, 2, 24/07/2006, no 4, 2, 2, 2, 24/07/2006, no
22
SQL statements
SQL statement can produce a table as result when used as a projection Returns the result as n-uplets (records)
It can also provide only a single value result when used for aggregation AVG, SUM, COUNT, etc
25
Display the list of articles bought by a client SELECT *
FROM Bought, ClientWHERE (((Bought.[Client Number])=[Type the client number])) AND (Bought.[Client Number] = Client.[client number]);
26
SQL statements … List all the articles bought by a client and produce the total cost of the articles
bought
SELECT Sum(Bought!Quantity*Article![Unit Price]) AS Price FROM Article, BoughtWHERE (Article.[Article Number]=Bought.[Article Number]) And (((Bought.Paid)=No)) And (Bought.[Client Number]=[Enter the client number]);
Remark SQL used for aggregate on Price Only one value is given as result
27
SQL statements … List all the articles bought by a client and produce the total cost
of the articles bought
SELECT Article.[Article Number], [Articler Name], [Unit Price], Bought!Quantity*Article![Unit Price] AS Price, Bought.[Client Number], Quantity, Date, PaidFROM Article, BoughtWHERE (Article.[Article Number]=Bought.[Article Number]) And (((Bought.Paid)=No)) And (Bought.[Client Number]=[Enter the client number]);
Create the report