Upload
halacrist
View
244
Download
0
Embed Size (px)
Citation preview
8/2/2019 Task Auto Saved)
1/51
Data Analyzing and Designing
1
8/2/2019 Task Auto Saved)
2/51
Data Analyzing and Designing
2
8/2/2019 Task Auto Saved)
3/51
Data Analyzing and Designing
3
8/2/2019 Task Auto Saved)
4/51
Data Analyzing and Designing
Acknowledgement
As I, write this report, strongly feel that I must take the opportunity to record my deepappreciation of tender my sincere gratitude goes to our lecturer Mr. Kithsiri Jayakody whoprovided me with guidance, support and constructive suggestions that contributed
immensely for the successful completion of this assignment.
I must also convey my heartiest thanks to staff of the IT Section, who sacrificed theirvaluable time to help us to complete our undertaking successfully.
Finally I wish to express my gratitude to my parents and friends for the encouragement givenme.
Thank you,A.L.M.Ameen.
4
8/2/2019 Task Auto Saved)
5/51
Data Analyzing and Designing
ContentsPages
Grading Criteria 1-3Acknowledgement 4Contents 5-8Introduction 9
Task 011.1 Contrasting database models 10-12
1.2 Entities and Attributes 13-151.3 Data dictionaries 16-181.4 E-R diagram 191.5 Normalization 20-24
Task 023.1 Proper database type for the scenario ant its implementation 253.2 Relationship Diagram 263.3 Constraints and Integrities 27
Task 033.1 Store procedures 28
3.2 SQL Quarries 293.3 Store procedures 293.4 Triggers 293.5 Views 293.6 SQL Quarries 30
Task 044.1 Creating Indexes 31-324.2 Maintenance Plan 33-364.3 Data warehouse 374.4 Connect the SQL server with Visual Studio 38-40
Conclusion 41References 41
5
8/2/2019 Task Auto Saved)
6/51
Data Analyzing and Designing
Figures
Task-01 Page No
Figure 1.1.1 . 9Figure 1.1.2 . 9Figure 1.1.3 ..... 10Figure 1.1.4 . 10
Figure 1.4 . 18
Figure 1.5.1 . 20Figure 1.5.2 . 21Figure 1.5.3 . 22
Task-02
Figure 2.2 . 25
Task-04
Figure 4.1.1 . 30Figure 4.1.2 ..... 31
Figure 4.2.1 . 32Figure 4.2.2 . 32Figure 4.2.3 . 33Figure 4.2.4 ..... 33
Figure 4.2.5 . 34Figure 4.2.6 . 34Figure 4.2.7 . 35Figure 4.2.8 ..... 35
Figure 4.4.1 . 37Figure 4.4.2 . 37Figure 4.4.3 . 38Figure 4.4.4 ..... 38Figure 4.4.5 . 39
6
8/2/2019 Task Auto Saved)
7/51
Data Analyzing and Designing
Tables
Task-01 Page No
Table 1.2.1 . 12Table 1.2.2 . 12Table 1.2.3 ..... 12Table 1.2.4 . 12Table 1.2.5 . 12Table 1.2.6 . 12Table 1.2.7 . 12Table 1.2.8 . 12Table 1.2.9 . 12Table 1.2.10 . 12Table 1.2.11 . 12
Table 1.2.12 . 13Table 1.2.13 . 13Table 1.2.14 ..... 13Table 1.2.15 . 13Table 1.2.16 . 13Table 1.2.17 . 13Table 1.2.18 . 13Table 1.2.19 . 13Table 1.2.20 . 13Table 1.2.21 . 13Table 1.2.22 . 13
Table 1.2.23 .14Table 1.2.24 . 14Table 1.2.25 . 14Table 1.2.26 .14
Table 1.3.1 . 15Table 1.3.2 . 16Table 1.3.3 .17
Table 1.5.1 . 23Table 1.5.2 . 23Table 1.5.3 ..... 23
Table 1.5.4 . 23Table 1.5.5 . 23Table 1.5.6 . 23Table 1.5.7 . 23Table 1.5.8 . 23Table 1.5.9 . 23Table 1.5.10 . 23Table 1.5.11 . 23
7
8/2/2019 Task Auto Saved)
8/51
Data Analyzing and Designing
Table 1.5.12 . 23Table 1.5.13 . 23Table 1.5.14 ..... 23Table 1.5.15 . 23Table 1.5.16 . 23Table 1.5.17 . 23Table 1.5.18 . 23Table 1.5.19 . 23Table 1.5.20 . 23Table 1.5.21 . 23Table 1.5.22 . 23
Table 1.5.23 .23Table 1.5.24 . 23
Table 1.5.25 . 23Table 1.5.26 .23
8
8/2/2019 Task Auto Saved)
9/51
Data Analyzing and Designing
Introduction
KANDY Pharmacy All drugs are entered by itemID to allow the unique identification of eachdrug, per drug code. Information regarding the generic and brand name of drug, the supplierand expiry date are all recorded on the system along with the itemID. Search can be done
either by name or by itemID to facilitate selection, to view suppliers, keep track of items inshortage, and to find items provided by a given supplier and/or the supplier in relation to aspecific item. Furthermore, the system favors a rapid identification of expiry dates ofmedicaments during a specified period the user opts for. etc
In KANDY PHARMACY there are so many transaction functions like I mention above. Sothey need a sufficient database for maintain those functions. So I did this assignment as asolution for KANDY PHARMACY.
In this documentation there are relationship diagram on page number 26,it maybe not clearfor you, thing is this I have to save this diagram in application but unfortunately my MS SQLdidnt support to save thats why I put it as a printed material. When you see it if you face
any troubles , Im asking apology.
9
8/2/2019 Task Auto Saved)
10/51
Data Analyzing and Designing
Task-01
1.1
What is the Database?
Database is a structured object. It can be a pile of papers, but most in the modern world itexists on a computer system. That structured object consists of data and metadata.Metadata is structured part. Data in a database is the actual stored descriptive information,such as all the names and addresses of your customers. Metadata describes the structureapplied by the database to the customer data.
In other words, the metadata is the customer table definition. The customer table definitioncontains the fields for the names and addresses, the lengths of each of those fields, anddata types. (A data type controls values in fields, such as allowing only a date, or a number).Metadata applies structure and organization to raw data.
Understanding database model.
There are many explanations to understand what exactly a database model or data model is.A database model can be used to describe an organized and ordered set of information
10
8/2/2019 Task Auto Saved)
11/51
Data Analyzing and Designing
stored on a computer. This ordered set of data is often structured using a data modelingsolution in such a way to make the retrieval of data and changes to that data more efficient.Depending on the type of applications using the database, the database structure can bemodified to allow for efficient changes to that data.
Comparison of the Hierarchical, Network and Relational,
Database Models
Hierarchical Database Model
The hierarchical model is the oldest of the three
models. This model is an improvement of the flat-file database system. The relationships in
the hierarchical model are child/parent relationships. The name hierarchical is come fromone major restriction on the child/parent relationships that is, a parent entity can haveseveral child entities, a child entity can only have one and only one parent. For this reasonall the relationships form a hierarchy that traces back to one root. In fact, this model is oftenvisualized as an upside down tree, where the entity at the top is seen as a root and all otherentities sprout from the root.
One major problem with the hierarchical model is the increased risk of data changeability.Another problem with the hierarchical model is the inflexibility of the model. Another problemwith the hierarchical model is in the child/parent relationship restriction. Every child musthave a parent. it is impossible to add new data in a table. To overcome some of thelimitations of the hierarchical model, the network model was created.
Network Database Model
The network model is an improvement the hierarchical model. In the network model, a childentity can have more than one parent. Therefore, the design can be visualized as severalinverted trees interconnected by branches as opposed to the single inverted treecharacteristic of the hierarchical model. Data in the network model can be accessed from anentity as opposed to the hierarchical model that requires access from the root entity. Therelationships between entities occur through unique set structures. Therefore, although theentities are not duplicated, a unique set structure is required to facilitate each of the one-to-many relationships.
Like the hierarchical model, the network model is also navigational. This deal a big problemin complex designs since the user has to understand the database structure in order to us
11
8/2/2019 Task Auto Saved)
12/51
Data Analyzing and Designing
the database. Furthermore, with a predefined structure like in the hierarchical model,modifying the structure of the database becomes a difficult task. The relational modeleliminates many of the problems presented in the network and hierarchical models.
Relational Database Model
The relational model is based on the mathematical set theory. In this model, data is storedin relations which are perceived by the user as relations. Relations are made up of tuples(also referred to as records or rows) and attributes (also known as fields or columns). Eachrecord is identified by a column with a unique value. The order of the rows and columns is ofimportance. Therefore, the relational model is independent of physical implementation, aquality that makes this model more preferable to the hierarchical and database models.Relationships in this model can be one-to-one, one-to-many, or many-to-many. Regardlessof the type of relationship, the model is transparent to the user, that is, the user does notneed to understand the physical structure of the database in order to use it.
Relational databases also have their share of problems. The flexibility of the relational modelcomes with the price of performance speed since the relationships are not predefined like inthe case of hierarchical and network databases. Flexibility, also introduces the complexity ofenforcing integrity constraints. However, the existence of scientific rules for imposingintegrity guarantees that database integrity can be ensured.
12
8/2/2019 Task Auto Saved)
13/51
Data Analyzing and Designing
1.2
Drugs
In this drug entity have some attributes. If we see through those
attribute, drug Id used to identify each drugs uniquely. By drug name attribute we can identifya particular drugs commercial name and also by drug generic we can identify drugs
scientific name. There are other three attributes that quantity, discount and unit price, those
13
8/2/2019 Task Auto Saved)
14/51
Data Analyzing and Designing
three are mostly use in transaction of drugs and quantity attribute want to manage stockdetails.
Drug Indications
We have to explain to patient how to use drugs when they buy it. It means we have to putthose details in receipt for do that this drug Indication attribute is important one.
Prescription
In this prescription entity there is prescriptionID attribute to identify each prescription isuniquely. There are three name attributes one of them is nameOfPatient who get consultingand nameOfPhysicians who give prescription to patient. Other one is nameOfPharmacistwho give drugs to patient. So keep those details we want to attributes which I point out
above.
Branch
KANDY Pharmacy have many branches. To maintain branches details, branchs stocks andto maintain transactions between branches and people we want to an entity and someattributes that is branch entity.
Patients
14
8/2/2019 Task Auto Saved)
15/51
Data Analyzing and Designing
KANDY Pharmacys main target
group is their customers. We may can say everything are happen for the customers andeverything depends on customer it mean patients so patents details are very important forKANDY pharmacys system. patintBranch attribute say that which patient buy drugs fromwhich branch. Other attributes are usually.
Invoice
Invoice is a legal document which is say we left from loans. In this invoice entity there isInvoiceID attribute to identify each Invoice is uniquely. By supplierID, you can identify whosupply a particular drug. By quantity you can say how much drugs given to pharmacy by aparticular supplier. Here inviceDate used to know which day these transactions happen.
Suppliers
15
8/2/2019 Task Auto Saved)
16/51
Data Analyzing and Designing
Which supplier supplies which drug and to which branch to know like those details, and tocontact again a particular supplier when stock things finished supplier details are important.To do those things Supplier entity will help.
Pharmacist
Pharmacists directly interact with patients, receipts and drugs. They involve everytransaction. So their information is very important to do usual works in KANDY Pharmacy.
Receipts
When a patient or customer buys some drugs we must give receipts for them to be surefinance matters. If customers have receipt, they can return or change drugs which theybought. In this invoice entity there is receiptID attribute to identify each receipt is uniquely.By amount, you can identify total price of drugs which a particular customer bought. Byquantity you can say how much drugs sale for a particular customer.
16
8/2/2019 Task Auto Saved)
17/51
Data Analyzing and Designing
Receipt _Return / Receipt_ReturnDrug
If a patient or one of customers returns drugs due to any reasons we have to manage thosedetails for do that here are two entities that receipt_returnID and returnID. Amount attribute isfor count how much money they paid for that drugs.
Supplier_Return / supplier_treturnDrug
If one supplier supply wrong drugs or same
drugs which still in stock pharmacy have to return it. To do those transaction supplier_returnentity have to use.
17
8/2/2019 Task Auto Saved)
18/51
Data Analyzing and Designing
1.3
Table Name Columns Name ColumnsType
Data Type ColumnsStatus
Others
Branch branchID Number Tinyint Primary Key Not null
branchName Text Nvarchar(50) Null
branchAddress Text Navrchar(75) Null
Drugs drugID Number Tinyint Primary Key
drugName Text Nvarchar(50) Null
drugQuantity Number Int Null
unitPrice Number Tinyint Null
drugDiscount Number Float Null
drugGentric Text Nvarchar(100
)
Null
Drug Indication drugID Number Tinyint Primary Key Not null
Indication of usage Text Nvarchar(100
)
Primary Key Not null
Invoice invoiceID Number Tinyint Primary Key Not null
inviceDate Date/time Date Null
18
8/2/2019 Task Auto Saved)
19/51
Data Analyzing and Designing
brancID number tinyint Null Foreign
key
Patient patientID Number tinyint Primary Key notnull
patientName Text Nvarchar(50) Null Not null
patientAddress Text Nvarchar(50) Null
branchId number tinyint null Foreign
key
PatientContNo patientID Number Tinyint Primary Key Not null
patientContNo Number Nvarchar(30) Primary Key Not null
Pharmacist pharmacistID Number Tinyint Primary Key Not null
pharmacistName Text Nvarchar(50) Null
pharmacistAdrress Text Navrchar(50) Null
branchID Text tinyint Null Foreign
key
PharmacistConNo pharmacistID Number Tinyint Primary Key Not null
contactNo Number Nvarchar(50) Primary Key Not null
Prescription prescriptionID Number Tinyint Primary Key Not null
nameOfThePatient Text Nvarchar(75) Null
nameOfPharmacist Text Nvarchar(75) Null
nameOfPhsician Text Nvarchar(75 Null
patientID number tinyint null Foreign
key
Table Name Columns Name Columns
Type
Data Type Columns
Status
Others
Receipt receiptID Number Tinyint Primary Not null
19
8/2/2019 Task Auto Saved)
20/51
Data Analyzing and Designing
key
amount Number Int Null
balance Number Float Null
quantity number int Null
branchID number Tinyint Null
patientID number tinyint Null
PrescriptionID number tinyint null Foreign key
PharmacistID number tinyint null Foreign key
Receipt_Drug receiptID Number Tinyint Primary
key
Not null
drugID number Tinyint Primary
key
Not null
quantity Number Int Null
unitprice Tinyint null
Receipt_Return receipt_returnID Number Tinyint Primary
key
Not null
dates Number date Null
amuont Number Int Null
receiptID Number tinyint Null Foreign key
Receipt_ReturnDrug receipt_returnID Number Tinyint Primary
key
Not null
amount Number int null
dates number date Null
ReceiptID number tinyint null Foreign key
Supplier supplierID number tinyint Primary
key
Not null
SupplierName number Nvarchar(50) Null
supplierAddress tex Nvarchar(75) null
branchID null tonyint null Foreign key
20
8/2/2019 Task Auto Saved)
21/51
Data Analyzing and Designing
Supplier ContNo supplierID Number Tinyint Primary
key
Not null
supplierConNo Numer Nvarchar(30) Null
supplier_return supplier_returnID number tinyint Primary
Key
Not null
invoiceID number tinyint null Foreign
Key
supplierID number tinyint null Foreign
Key
drugID number tinyint null Foreign key
quantity number int null
Table Name Columns Name Columns
Type
Data Type Column
Status
Others
Dr_su1 drugID number tinyint Primary
key
supplierID Number tinyint Primary
key
Not
null
supplierDrug supplierID number tinyint Primary
key
Not
null
drugID number tinyint null Foreig
n Key
Invoice_drug invoiceID Number tinyint Primary
key
Not
null
quantity Number int Null
unitPrice number int Null
discount number float null
Patient_Prescription PatientID number tinyint Primary Not
21
8/2/2019 Task Auto Saved)
22/51
Data Analyzing and Designing
key null
PrescriptionID number tinyInt null
Prescription_drug prescriptionID number tinyint Primarykey
Notnull
NameOfTheDrug text Nvarchar(150
)
Primary
Key
Not
null
prID_drID prescriptionID number tinyint Primary
Key
Not
null
drugID number tinyint Primary
Key
Not
null
Supplier_branch supplierID number Tinyint Primarykey
Notnull
supplierBranch text Nvarchar(50) null
drugSupplier drugID number tinyint Primary
Key
Not
null
NameOfTheSuppl
ier
text Nvarchar(150
)
null
Supplier_returnDrug Supplier
_returnID
number tinyint Primary
Key
Not
null
drugID number tinyint Null
quantity number int Null
amount number int null
branchContNo branchID number tinyint Primary
Key
Not
null
ContectNO number Nvarchar(50) Null
nameOfTheDrug number Nvarchar(100
)
null
1.4
22
8/2/2019 Task Auto Saved)
23/51
Data Analyzing and Designing
1.5
23
8/2/2019 Task Auto Saved)
24/51
Data Analyzing and Designing
First normal form
There are two requirements for a table to be in first normal form:
The table must have no duplicate records. This criteria is automatically met if you define aprimary key for the table.
The table must have no multi-valued attributes. This ones a little more complicated.Basically, it says that you cant combine multiple values that are valid for a column in a singlecolumn.
Second and third normal forms
The second normal form (2NF) introduces one additional requirement:all attributes that arenot part of a candidate key must be functionally depen- dent upon the entire primary key.
The third normal form (3NF) also requires that all attributes that are not part of a candidatekey must be no transitively dependent upon each candidate key in the table. This means that
the attributes may not be dependent only upon the primary key, because they are dependentupon another attribute that is dependent upon the primary key.
1.5
24
8/2/2019 Task Auto Saved)
25/51
Data Analyzing and Designing
0NF
1NF
25
8/2/2019 Task Auto Saved)
26/51
Data Analyzing and Designing
2NF and 3NF
26
8/2/2019 Task Auto Saved)
27/51
Data Analyzing and Designing
Final Tables
27
8/2/2019 Task Auto Saved)
28/51
Data Analyzing and Designing
Task-02
28
8/2/2019 Task Auto Saved)
29/51
Data Analyzing and Designing
2.1
A database is a collection of data, which is organized into files called tables. These tablesprovide a systematic way of accessing, managing, and updating data. A relational databaseis one that contains multiple tables of data that relate to each other through special key
fields. Relational databases are far more flexible (though harder to design and maintain)than what are known as flat file databases, which contain a single table of data.
To KANDY PHARMACY scenario I selected this relational database. To understand theadvantages of a relational database, imagine the needs of two small companies that takecustomer orders for their products. Company A uses a flat file database with a single tablenamed orders to record orders they receive, while Company B uses a relational databasewith two tables: orders and customers.
When a customer places an order with Company A, a new record (or row) in the table ordersis created. Because Company A has only one table of data, all the information pertaining tothat order must be put into a single record. This means that the customer's general
information, such as name and address, is stored in the same record as the orderinformation, such as product description, quantity, and price. If customers place more thanone order, their general information will need to be re-entered and thus duplicated for eachorder they place.
Whenever there is duplicate data, as in the case above, many inconsistencies may arisewhen users try to query the database. Additionally, a customer's change of address wouldrequire the database manager to find all records in orders that the customer placed, andchange the address data for each one.
Company B is much better off with its relational database. Each of its customers has oneand only one record of general information stored in the table customers. Each customer'srecord is identified by a unique customer code which will serve as the relational key. When acustomer orders from Company B, the record in orders need contain only a reference to thecustomer's code, because all of the customer's general information is already stored incustomers.
This approach to entering data solves the problems of duplicate data and making changes tocustomer information. The database manager need change only one record in customers ifsomeone changes addresses.
Relational database have main and big advantage which I mention above thats why Iselected relational database model to create database for KANDY PHARMACY.
See implemented Database on CD KANDY PHARMACY
2.2
29
8/2/2019 Task Auto Saved)
30/51
Data Analyzing and Designing
30
8/2/2019 Task Auto Saved)
31/51
Data Analyzing and Designing
2.3
31
8/2/2019 Task Auto Saved)
32/51
Data Analyzing and Designing
The two types of constraints that primarily serve to enforce business logic in databases arethe following:
DEFAULT constraints supply values to fill fields when the user doesnt provide avalue.
CHECK constraints limit the values that users may insert into a particular database
field.The three rules designed to support database relationships and enforce uniqueness areas follows: PRIMARY KEY constraints ensure that specified column always contain a unique
value so that the column may serve as a tables primary key. UNQIUE constraints provide functionality similar to primary key constraints, but do
not specify that the column(s) subject to the constraints are a tables primary key. FOREIGN KEY constraints link two tables in a database by requiring that the data in
the column(s) governed by the constraint contain values stored in the primary keycolumn(s) of the linked table.
CONSTRAINTS AND DIGGERSDefaultcreate table patient (patientID nvarchar(50) nullpatientName nvarchar(50) nullbranch nvarchar (50) null DEFAULT NeePharma )CheckCreate table drug (drugID int NOT NULL CHECK (drugID > 100),drugName varchar(50) NOT NULL,drugquantity int,
drugUnitPrice float,drugGentric varchar(100) )Primary KeyCREATE TABLE branch (branchId int NOT NULL PRIMARY KEY ,brName varchar(255) NOT NULL,Address varchar(255),)Foreign keyCREATE TABLE Orders(O_Id int NOT NULL PEIMARY KEY,OrderNo int NOT NULL,P_Id int FOREIGN key,
OrderDate date )UniqueCREATE TABLE pharmacist (P_Id int NOT NULL UNIQUE,LastName varchar(255) NOT NULL,FirstName varchar(255),Address varchar(255),branch varchar(255) )
I have used like which I explain above when I implement database for KANDY PHARMACY.
Task -03
32
8/2/2019 Task Auto Saved)
33/51
Data Analyzing and Designing
3.1
BRANCHinsert into branch(branchID,branchName,branchAddress)
VALUES (8,'distarte','mahyava')
update branchset branchName = 'qwa'where branchName = 'expo'
delete from branchwhere branchName = 'gra'
3.2
1)selectprescription.prescriptionID,prescription.nameOfthePatient,prescription.nameOfthephysician,prescription.nameOfphrmacist,prescription.patientID,receipt.receiptID,receipt.amount,receipt.blance,receipt.branchID,receipt.patientID,receipt.pharmacistID,receipt_drug.unitPrice,receipt_drug.quantity,(receipt_drug.unitPrice*receipt_drug.quantity) as cccfrom prescriptioninner join receipton receipt.prescriptionID= prescription.prescriptionID
inner joinreceipt_drug on receipt.receiptID = receipt_drug.drugID
2)
select drugID ,drugNamefrom drugwhere drugQuantity 10
3.3
33
8/2/2019 Task Auto Saved)
34/51
Data Analyzing and Designing
create trigger updateinvoice on receipt_drugfor insertasdeclare @drugID as int = (select drugID from inserted)declare @quantity as int =(select quantity from inserted)declare @remainQuantity as int=(select drugQuantity from drug where drugID = @drugID)declare @totalRemainQuantity as int =@remainQuantity-@quantityupdate drug set drugQuantity = @totalRemainQuantity where drugID=@drugID
3.4
create trigger updatesupplier_return on supplier_returnfor insertas
declare @drugID as int = (select drugID from inserted)declare @quantity as int =(select quantity from inserted)declare @stock as int=(select noOfDrug from stock where drugID = @drugID)declare @remainDrug as int =@stock-@quantityupdate stock set drugQuantity = @remainDrug where drugID=@drugID
3.5
1)
create view supselectasselect count(*)as counts,dbo.supplier.supplierIDfrom dbo.SupplierDruginner join dbo.supplier ondbo.SupplierDrug.supplierid=dbo.supplier.supplierIDgroup by dbo.supplier.supplierIDhaving count(*)>10
2)
select sum ( drug.drugUnitPrice * drugQuantity)from drug inner join SupplierDrugon drug.drugID = supplierDrug.drugID
3.6
34
8/2/2019 Task Auto Saved)
35/51
Data Analyzing and Designing
1)
use KANDY PHARMACYcreate table supplier( supplierID tinyint not null primary key,supplierName nvarchar(50)null,supplierAddress nvarchar (75)null )
2)
use KANDY PHARMACYcreate table drug( drugID tinyint not null primary key,drugName nvarchar(50)null,drugQuantity int null,drugUnitPrice tinyint null,
drugDiscount float null,drugGentric nvarchar(100)null )
Task-04
35
8/2/2019 Task Auto Saved)
36/51
Data Analyzing and Designing
4.1
An index essentially behaves like an index in the back of a book or the table of contents atthe front of a book. When searching for details on a specific topic, it is much easier to findthe term in the index or table of contents first, and then use a page reference number to find
the information within the pages of the text. Reading the entire book every time you want tofind a definition for a single term would be far too time-consuming to be useful, probablymaking the book completely useless as a reference. Most technical books are used asreference guides in one form or another.
An index is usually a copy of a very small section of table, such as a single field, and a shortlength field. The act of creating an index physically copies one or more fields to be indexedinto a separate area of disk other than that of the table. In some databases, indexes can bestored in a file completely separated from that of the table. Different databases arestructured differently on a physical level. The important factor is the underlying physicalseparation.
Indexes helps SQL server get to the data faster. SQL server store data on pages. Page sizeis fixed at 8kb per page. There are several types of pages like data pages.if you have tablethat have 1000B row size ,you can store 8 rows per page .
How to create indexes?
Right click in any entity of database
Manage indexes and keys
And choose design
Design
Click Mange Indexes and Keys
36
8/2/2019 Task Auto Saved)
37/51
Data Analyzing and Designing
Primary key
Place where we want to select primary key
After you get this window you can look the primary key of the selected entity. If it is not youcan select the primary key from (General)
Add
Close
37
8/2/2019 Task Auto Saved)
38/51
Data Analyzing and Designing
4.2
Creating a maintenance plan
Click Management of any of database
Right click on the Maintenance plans
Choice Maintenance plan wizard
38
8/2/2019 Task Auto Saved)
39/51
Data Analyzing and Designing
SQL server maintenance plan
wizard
Click Next
You will get the Select Plan Properties
39
8/2/2019 Task Auto Saved)
40/51
Data Analyzing and Designing
Here we want to give a Name and if there any need to change you can change it, after thisclick Next
Select maintenance task
40
8/2/2019 Task Auto Saved)
41/51
Data Analyzing and Designing
Here we want to select Back up database (full) to get whole back up of our database and
click Next.
You will get Select maintenancetask order and just click next.
41
8/2/2019 Task Auto Saved)
42/51
Data Analyzing and Designing
Define back up database (full) task
42
8/2/2019 Task Auto Saved)
43/51
Data Analyzing and Designing
After finishing this step click Next
You will get Select Report Option Here dont do anything just click Next
43
8/2/2019 Task Auto Saved)
44/51
Data Analyzing and Designing
44
8/2/2019 Task Auto Saved)
45/51
Data Analyzing and Designing
If you get this dialog box it mean you finish you are back up successfully. Just click Finish
4.3
A data warehouse is a type of computer database that is responsible for collecting andstoring the information of a particular organization. The goal of using a data warehouse is tohave an efficient way of managing information and analyzing data.
45
8/2/2019 Task Auto Saved)
46/51
Data Analyzing and Designing
Over the last 20 years, $1 trillion has been invested in new computer systems to gaincompetitive advantage. The vast majority of these systems have automated businessprocesses, to make them faster, cheaper, and more responsive to the customer. Electronicpoint of sales (EPOS) at supermarkets, itemized billing at telecommunication companies(telcos), and mass market mailing at catalog companies are some examples of suchOperational Systems. These systems computerized the day-to-day operations of businessorganizations. Some characteristics of the operational systems are as follows:
Most organizations have a number of individual operational systems (databases,applications)
On-Line Transaction Processing (OLTP) systems capture the business transactionsthat occur.
An Operational System is a system that is used daily (perhaps constantly) to performroutine operations - part of the normal business processes.
Examples: Order Entry, Purchasing, Stock/Bond trading, bank operations. Users make short term, localized business decisions based on operational data. e.g.,
"Can I fill this order based on the current units in inventory?"
Presently almost all businesses have operational systems and these systems are not givingthem any competitive advantage. These systems have gathered a vast amount of dataover the years. The companies are now realizing the importance of this hidden treasure ofinformation. Efforts are now on to tap into this information that will improve the quality of theirdecision-making.A data warehouse is nothing but a repository of data collected from the various operationalsystems of an organization. This data is then comprehensively analyzed to gain competitiveadvantage. The analysis is basically used in decision making at the top level.From being just a passing fad, Data Warehousing technology has grown much in scale andreputation in the past few years, as evidenced by the increasing number of products,vendors, organizations, and yes books, even books, devoted to the subject. Enterprises that
have successfully implemented data warehouses find it strategic and often wonder how theyever managed to survive without it in the past.As early as 1995, a Gartner Group survey of Fortune 500 IT managers found that 90% of allorganizations had planned to implement Data Warehouses by 1998.
Be for one year Srilanka had big healthy problem that was swine flu at that particular timein all branch of KANDY PHARMACY anti swine flu tablets sales was very high. When itcontrolled tablets sales was decrease by half percentage. This is the good example of datawarehousing in KANDY PHARMACY.
Usually in rainy period Srilanka have dengue fever at those time also we can see in the all ofKANDY PHARMACY branches , anti-dengue drugs are selling very fast but other normal
dates this sale not be there
4.4.
46
8/2/2019 Task Auto Saved)
47/51
Data Analyzing and Designing
Go to Visual Studio 2008 Select View Select Sever Explorer
In the
Sever Explorer There is Data Connection ,Right click on it Select Add
Connection
47
8/2/2019 Task Auto Saved)
48/51
Data Analyzing and Designing
48
8/2/2019 Task Auto Saved)
49/51
Data Analyzing and Designing
Click OK Click OK
Now you can see KANDY PHARMACY database and its tables in visual studio 2008
49
8/2/2019 Task Auto Saved)
50/51
Data Analyzing and Designing
Conclusion
Completion of this project I gained a vast amount of knowledge by doing the assignment of
DAD myself. So I feel this subject to be very interesting and knowledge providing and it was
a big task to do in my career and now I have succeeded in producing my assignment after a
hard work. Throughout this assignment I have improved a lot in self-studying, justification,
Analysis for my upcoming studies too. So this is a good experience in my studies and life to
take decision in a practical environment. Im quite sure this knowledge will be helpful in my
further success in the future.
References
Books
Microsoft.SQL.Server.2008.For.Dummies
Absolute Beginner's Guide to databases.Database Beginner Guide.Beginning Database Design.
Video tutorials
Lynda.coms MS SQL video tutorials
Websites
http://dev-odbc.groupbc.com/bchelp/sec-8-0.htmlhttp://kb.iu.edu/data/ahrp.html
http://en.wikibooks.org/wiki/The_Computer_Revolution/Databases/Database_Modelshttp://www.jwrider.com/lab/datamodels.htm
50
http://dev-odbc.groupbc.com/bchelp/sec-8-0.htmlhttp://kb.iu.edu/data/ahrp.htmlhttp://en.wikibooks.org/wiki/The_Computer_Revolution/Databases/Database_Modelshttp://www.jwrider.com/lab/datamodels.htmhttp://dev-odbc.groupbc.com/bchelp/sec-8-0.htmlhttp://kb.iu.edu/data/ahrp.htmlhttp://en.wikibooks.org/wiki/The_Computer_Revolution/Databases/Database_Modelshttp://www.jwrider.com/lab/datamodels.htm8/2/2019 Task Auto Saved)
51/51
Data Analyzing and Designing
http://www.tonymarston.net/php-mysql/database-design.html#hierarchical.dbhttp://en.wikipedia.org/wiki/Database_modelhttp://www.exforsys.com/tutorials/data-warehousing/data-warehousing-introduction.html
http://www.tonymarston.net/php-mysql/database-design.html#hierarchical.dbhttp://en.wikipedia.org/wiki/Database_modelhttp://www.exforsys.com/tutorials/data-warehousing/data-warehousing-introduction.htmlhttp://www.tonymarston.net/php-mysql/database-design.html#hierarchical.dbhttp://en.wikipedia.org/wiki/Database_modelhttp://www.exforsys.com/tutorials/data-warehousing/data-warehousing-introduction.html