Professional Documents
Culture Documents
There are six commonly recognized models (types) of database that are useful for different types of data
or information. Depending upon your specific needs, one of these models should be appropriate for
your migration from paper based systems to a database.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
Fig: Flat-file Database Model
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
Relational database:
The relational database model is the most commonly used today. Data management is easier through
the use of referential integrity. As well, retrieving data is quick and relatively easy through the usage of
the international standard Structured Query Language (SQL). Changes made in one portion of the
database are propagated throughout the database through the usage of integrity constraints and
relational links.
Three types of relational links are allowed between database tables (the primary storage unit of a
relational database) which allow for relational databases to be used for even the most complex database
operations.
The relational database overcomes the limitations found in the other database models already
discussed. Some of the benefits of a relational model are:
The most used database model is the relational database model. Though this will gradually migrate
towards the object-relational model, industry standards must be determined prior to widespread
acceptance.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
1.4 Design with Microsoft SQL Server 2008 Express
The MS SQL express database engine is a version tailored for redistribution and embedding. SQL Server
Express includes 10GB of storage per database, easy backup and restores functionality, and
compatibility with all editions of SQL Server and Microsoft Azure SQL Database.
Features of MS SQL:
Support structured and unstructured data while storing business data with native support for relational
data, XML, and spatial data. Add geographical information to business applications and build location-
aware applications. Increase granularity of temporal data with date and time data types.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
Manage SQL Server Express databases with SQL Server Management Studio Express. Connect to local
SQL Server Express databases and manage objects with full Object Explorer integration. Write, execute,
and test queries by using visual query plans, and access management and maintenance options.
Visualize data through basic Reporting Services (available with SQL Server Express with Advanced
Services) and create readable reports that answer complex user questions. Enable users to share reports
by using Microsoft Word and Microsoft Excel.
Take advantage of existing Transact-SQL skills, and incorporate technologies like Microsoft ADO.NET
Entity Framework and LINQ. Develop applications faster through deep integration with Visual Studio,
Visual Web Developer, and SQL Server Management Studio. Take advantage of rich table and query
designers and drag-and-drop IDE support.
SQL Server Express LocalDB is a lightweight deployment option for SQL Server Express with fewer
prerequisites. This makes it ideal for developers who need an embedded SQL Server database for
desktop applications or tools. LocalDB runs in-process with applications and not as a service.
1.5 Conclusion
The purpose of the relational model is to provide a declarative method for specifying data and queries:
users directly state what information the database contains and what information they want from it,
and let the database management system software take care of describing data structures for storing
the data and retrieval procedures for answering queries.
Besides defining how the data are to be structured as discussed above, the relational model also lays
down a set of rules to enforce data integrity, known as integrity constraints. It also defines how the data
are to be manipulated (relational calculus). In addition, the model defines a special feature termed
normalization to ensure efficient data storage.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
2.1 Entity types and Key attributes and their types in a data model
Relationship Cardinality
Entity Class Entity Class Attributes
Type Ratio
ONE-TO-
INCLUDES BOOKING_DETAILS CUSTOMER_DETAILS
MANY
ONE-TO-
INCLUDES BOOKING_DETAILS EMPLOYEE_DETAILS
MANY
ONE-TO-
INCLUDES BOOKING_DETAILS LOCATION_DETAILS
MANY
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
MANY-TO-
INCLUDES BICYCLE_DETAILS LOCATION_DETAILS QUANTITY
MANY
ONE-TO-
INCLUDES PAYMENT_DETAILS BOOKING_DETAILS
MANY
CUSTOMER_DETAILS
Primary Key DB
CUST_ID VARCHAR(10)
Sequence
EMPLOYEE_DETAILS
Primary Key DB
EMP_ID VARCHAR(10)
Sequence
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
ADDRESS Not Null VARCHAR(50)
LOCATION_DETAILS
Primary Key DB
LOC_ID VARCHAR(10)
Sequence
BICYCLE_DETAILS
Primary Key DB
SERIAL_NUMBER VARCHAR(10)
Sequence
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
CONDITION Not Null VARCHAR(10)
BOOKING_DETAILS
Primary Key DB
BOOKING_ID VARCHAR(10)
Sequence
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
Foreign Key, reference
BOOKING_EMP_ID to EMPLOYEE_details VARCHAR(10)
table
PAYMENT_DETAILS
Primary Key DB
PAY_ID VARCHAR(10)
Sequence
RATE_CHART
Primary Key DB
RATE_ID VARCHAR(2)
Sequence
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
DEPOSIT Not Null INTEGER
2.3 Design for the ULKOM BICYCLE HIRE system using a Data
Flow Diagram (DFD)
Assumptions:
1. Customer visiting ULKOM BICYCLE HIRE (UBH) Company needs to register with the company to
place an order. Updated in table CUSTOMER_DETAILS
2. All employees working with UBH are also registered in database table EMPLOYEE_DETAILS.
3. The stock details like type of bicycle, number of bicycle of each type, their current condition,
etc. all such details are updated in database in BICYCLE_DETAILS
Data flow:
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
7. Once the customer has used the bicycle to its purpose and visits of the companys branches to
return the bicycle, he would be required to provide any of details like BOOKING_ID,
CUSTOMER_ID to retrieve the booking details.
8. Employee at the branch location will generate the receipt of payment using the stored
procedure (table: PAYMENT_DETAILS) to evaluate the amount required to be paid by the
customer.
9. It also calculates PENALTY, COMMISSION details.
2.4 Conclusion
An entityrelationship model (ER model) is a data model for describing the data or information aspects
of a business domain or its process requirements, in an abstract way that lends itself to ultimately being
implemented in a database such as a relational database. The main components of ER models
are entities (things) and the relationships that can exist among them.
An ER model is typically implemented as a database. In the case of a relational database, this stores data
in tables, which represent the entities. Some data fields in these tables point to indexes in other tables;
such pointers represent the relationships.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
3.2 Purpose of Normalisation
Database normalization, or data normalization, is a technique to organize the contents of the tables for
transactional databases and data warehouses. Normalization is part of successful database design;
without normalization, database systems can be inaccurate, slow, and inefficient, and they might not
produce the data you expect.
Following a successful SQL Server installation, youll have to create a database to hold the data. After
youve created the database framework, you must organize the files in such a way that you can easily
manage them. The primary tool to help organize the data is the table, which looks like a two-dimensional
structure that encompasses rows and columns.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
When you normalize a database, you have four goals: arranging data into logical groupings such that
each group describes a small part of the whole; minimizing the amount of duplicate data stored in a
database; organizing the data such that, when you modify it, you make the change in only one place;
and building a database in which you can access and manipulate the data quickly and efficiently without
compromising the integrity of the data in storage.
Data normalization helps you design new databases to meet these goals or to test databases to see
whether they meet the goals. Sometimes database designers refer to these goals in terms such as data
integrity, referential integrity, or keyed data access. Ideally, you normalize data before you create
database tables. However, you can also use these techniques to test an existing database.
Data normalization is primarily important in the transactional, or online transactional processing (OLTP),
database world, in which data modifications (e.g., inserts, updates, deletes) occur rapidly and randomly
throughout the stored data. In contrast, a data warehouse contains a large amount of denormalized and
summarized dataprecalculated to avoid the performance penalty of ad hoc joins. In a data warehouse,
updates happen periodically under extremely controlled circumstances. End users updates to data in
data warehouses are uncommon.
Schema dont have repeating Elements or Groups of Elements, all tables have single tuple and each cell
of tables have a single value of attribute hence it is following atomicity and fulfill all requirement of 1NF.
In some table multiple making a primary key, No partial dependency and transitivity dependency so it
also follows 2NF and 3NF.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
3.5 Conclusion
We used both the Graphical User Interface and SQL command to create a new Database and a new
Table. Values were inserted into the new table and then retrieved.
Script Used:
DECLARE
V_LOC1 NUMBER;
V_LOC2 NUMBER;
V_LOC3 NUMBER;
TOTAL NUMBER;
BEGIN
SELECT TOTAL_BICYCLE
INTO V_LOC1
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
FROM LOCATION_DETAILS
SELECT TOTAL_BICYCLE
INTO V_LOC2
FROM LOCATION_DETAILS
SELECT TOTAL_BICYCLE
INTO V_LOC3
FROM LOCATION_DETAILS
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
END;
4.2 A monthly output of the amount the company made for hiring
30 bicycles
Script Used:
DECLARE
TOTAL_REVENUE NUMBER;
EACH_BICYCLE NUMBER;
WEEKLY_RATE NUMBER;
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
TOTAL_WEEKS NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
COST OF EACH BICYCLE HIRE FOR TOTAL DURATION IS:- || || EACH_BICYCLE || POUNDS);
DBMS_OUTPUT.PUT_LINE (
END;
4.3 Total amount a customer has to pay for hiring a bicycle for 3
week and return the bicycle 3 days late
Scrip Used:
DECLARE
TOTAL_BICYCLE_HIRE NUMBER : = 1;
TOTAL_DURATION NUMBER : = 3;
LATE_BY NUMBER : = 3;
TOTAL_AMOUNT NUMBER;
EACH_BICYCLE NUMBER;
WEEKLY_RATE NUMBER;
TOTAL_WEEKS NUMBER;
LATE_RETURN NUMBER;
PENALTY NUMBER;
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
BEGIN
FROM RATE_CHART;
INTO TOTAL_AMOUNT
FROM DUAL;
DBMS_OUTPUT.PUT_LINE (
||
|| TOTAL_DURATION
||
|| WEEKS);
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
||
|| TOTAL_AMOUNT
|| POUNDS);
END;
4.4 The total amount employees may earn at the end of the month
+ commission, for hiring 30 bicycles.
Script used:
DECLARE
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
TOTAL_DURATION NUMBER := 30;
TOTAL_AMOUNT NUMBER;
EACH_BICYCLE NUMBER;
DAILY_RATE NUMBER;
TOTAL_COMMN NUMBER;
EACH_COMMN NUMBER;
EARNINGS NUMBER;
BEGIN
FROM RATE_CHART;
INTO EARNINGS
FROM DUAL;
DBMS_OUTPUT.PUT_LINE (
||
|| TOTAL_BICYCLE_HIRE);
DBMS_OUTPUT.PUT_LINE (
DBMS_OUTPUT.PUT_LINE (
||
|| EARNINGS
|| POUNDS);
END;
4.5 Conclusion
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
The required reports are generated using the stored procedures. The logic is implemented depending
upon the details given in the case study. The Stored procedures are executed and can be modified and
used different scenarios and inputs.
All the procedures can be used as it is to generate reports for different input values.
In order to be able to add tests gradually and easily, we need a sound testing framework. However,
setting up the framework is somewhat involved, and must be done before we can run our first test. To
run automated tests, we need the ability to:
Once each developer has a sandbox database, it is time to start using it, and to start benefiting from the
time and effort invested in creating it, even if the sandbox database is not quite complete, as yet. We
can begin covering with tests all the new complex modules in TEST schema, as well as covering existing
modules as we need to change them for whatever reason.
Incomplete, incorrect, and ambiguous communication between customers and developers, resulting in
incomplete or incorrect requirements, is a serious problem that frequently slows down software
development. Improving communication is especially important in agile teams, where speed of
development is essential.
Clearly the requirements are incomplete, and as we develop the module, we need answers to the
following questions:
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
5.3 Matching actual test results against expected
At this point, lets assume that we have clear and complete requirements in the form of a commented
script, and the output of the script looks correct. However, to have a complete automated test, we need
to match its output against expected results every time we run it.
When we explicitly test a stored procedure that returns result sets, we should always verify the structure
of the result sets, as well as all values in all returned rows, match the expected results. If a column name
or type changes, this may break some other code. Our tests are more useful if they detect all potentially-
breaking changes.
Some database testing frameworks allow us to choose whether or not we want to verify the structure
of the result sets. There might be cases when we do not want to detect such breaking changes, but so
far I have not encountered a single such case in my practice. So, in order to keep things simple, and to
avoid wasting time making the same choice over and over again, our framework simply does not allow
such a choice. Instead, our framework always verifies that the structure of results sets is as expected
All too many automated tests fail too early, without outputting the full details of what exactly went
wrong. As a result, we end up spending more time than necessary determining what exactly is broken.
If there is any discrepancy between actual and expected results, this test will surely indicate failure,
which is good. The problem, however, is that after the first failure no more checks are executed, so we
do not get very much information about why the test failed. Suppose, for instance, that the very first
assertion failed. Is the first row missing altogether from the result set? Have the rows returned in the
wrong order? Is this the only wrong value in the whole result set? We do not know, and we have to spend
extra effort to understand what exactly is going on.
As Agile developers, we spend a lot of time every day working with our automated tests, so getting
them right is essential; inefficiencies that could be easily tolerated in less dynamic environments get in
our way all-too-often in Agile development. Such inefficiencies are like a small piece of rock in our shoe;
the pain can be tolerated if we are going to walk a dog around the block, but it can cause a serious
problem if we are running a marathon.
In our environment, we knew developing and maintaining unit tests was going to be a marathon, not a
short jaunt round the block, so our stance was that the tools should do exactly what we want without
unnecessary complications, and absolutely without any bugs.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net
5.5 Conclusion
A harness of automated tests is more useful if we spend less time creating and maintaining it, and more
time using it. Over four years of testing database code, weve learned that we should:
As our test harness gets bigger, we should expect some growing pains. They are quite real and need to
be dealt with, but they are beyond the scope of this article. Before spending time and effort on
improving our test harness, we need to know that it is actually worth it, which is the whole point of this
article.
6 References
http://www.studytonight.com/dbms/rdbms-concept
http://www.techopedia.com/definition/24559/relational-model-database
http://www.smartdraw.com/resources/tutorials/entity-relationship-diagrams/
http://msdn.microsoft.com/en-IN/library/ms186312.aspx
http://www.databasejournal.com/features/mssql/article.php/3759371/Create-Your-First-
SQL-Server-Database-in-3-Quick-Steps.htm
http://www.visual-paradigm.com/tutorials/data-flow-diagram-dfd.jsp
http://softwaretestingfundamentals.com/verification-vs-validation/
Programming Assignment Help UK is committed to plagiarism free assignments. This free Types of
Database Models Assignment is complete solution based on case study.
www.programmingassignmentshelp.net help@programmingassignmentshelp.net