03.database Design Concepts
03.database Design Concepts
Introduction
Database is a place where we can store our information as well as data more arranged and secure manner. Database can be found in secondary storage devices in the system. Some of the database systems are facilitated by server environment due to more number of actors (people who use the database), massive number of data & different organizational requirements. Different software vendors develop different ways and means, different software tools and utilities to develop and manage the database despite of the fact that base technology is same. At present software industry different vendors such Microsoft Corporation, Oracle Corporation develop different software product lines such as Microsoft Window server 2000 series, Microsoft Access, Oracle series etc Here I am implemented the Database software for Sri Lanka Cricket committee. With my database system, the Sri Lanka cricket board can select the Best & High performing players to the world cup pool.
1
International College of Business and Technology
Primary Tasks
* First nine tasks are included to the database software.
COBOL/PL/1 Fortran
Queries
DBMS
Operating System
Data Base (Figure 01) The DBMS interprets and processes users' requests to retrieve information from a database. The following figure shows that a DBMS serves as an interface in several forms. They may be keyed directly from a terminal, or coded as High-level language programs to be submitted for interactive or batch processing. In most cases, a query request will have to penetrate several layers of software in the DBMS and operating system before the physical database can be accessed.
3
International College of Business and Technology
Advantages
Reduction of redundancies
Centralized control of data by the DBA avoids unnecessary duplication of data and effectively reduces the total amount of data storage required. It also eliminates the extra processing necessary to trace the required data in a large mass of data. Another advantage of avoiding duplication is the elimination of the inconsistencies that tend to be present in redundant data files. Any redundancies that exist in the DBMS are controlled and the system ensures that these multiple copies are consistent. Sharing Data A database allows the sharing of data under its control by any number of application programs or users. Data Integrity
Centralized control can also ensure that adequate checks are incorporated in the DBMS to provide data integrity. Data integrity means that the data contained in the database is both accurate and consistent. Therefore, data values being entered for storage could be checked to ensure that they fall within a specified range and are of the correct format. Example, The value for the age of a Player may be in the range of 16 and 75. Another integrity check that should be incorporated in the database is to ensure that if there is a reference to certain object, that object must exist. In the case of an automatic teller machine, for example, a user is not allowed to transfer funds from a non-existent saving account to a checking account. Data Security
Data is of vital importance to an organization and may be confidential. Unauthorized persons must not access such confidential data. The DBA who has the ultimate responsibility for the data in the DBMS can ensure that proper access procedures are followed, including proper authentication schemas for access to the DBMS and additional checks before permitting access to sensitive data. Different levels of security could be implemented for various types of data and operations.
4
International College of Business and Technology
Conflict Resolution DBA chooses the best file structure and access method to get optimal performance for the response-critical applications, while permitting less critical applications to continue to use die database, albeit with a relatively slower response. Data Independence
Data independence is usually considered from two points of view (Physical data independence and logical data independence). Physical data independence allows changes in the physical storage devices or organization of the files to be made without requiring changes in the conceptual view or any of the external views and hence in the application programs using the database.
Disadvantages
A significant disadvantage of the DBMS system is cost. In addition to the cost of purchasing or developing the software, the hardware has to be upgraded to allow for the extensive programs and the workspaces required for their execution and storage.
The processing overhead introduced by the DBMS to implement security, integrity, and sharing of the data causes a degradation of the response and through-put times. An additional cost is that of migration from a traditionally separate application environment to an integrated one.
While centralization reduces duplication, the lack of duplication requires that the database be adequately backed up, so that in the case of failure the data can be recovered. Backup and recovery operations are fairly complex in a DBMS environment, and this is exacerbated in a concurrent multi user database system. In further a database system requires a certain amount of controlled redundancies and duplication to enable access to related data items.
Centralization also means that the data is accessible from a single source namely the database. This increases the potential severity of security breaches and disruption of the operation of the organization because of downtimes and failures. The replacement of a monolithic centralized database by a federation of independent and cooperating distributed databases resolves some of the problems resulting from failures and downtimes.
Types of Database
5
International College of Business and Technology
Paper Based File Based DBMS Data Based Hierarchic Model Network Model Relational Model Object-Relational Model Object-Oriented Model Vender Model Microsoft Oracle MySQL Paper Based
Requires more space. Hard to apply security to the Database. Re-usability of Data is not possible. Taking Backups are not possible. Data consistency cannot be maintained. CRUD Function hard to apply. Linking with different application is not possible. *Collection of Data Value creates Entity Technical Jargon Table = Relation Row = Tuple Field (Column) = Domain
2.
File Based (.txt) Can be considered the easiest to create because they rely on normal techniques of file processing. The .NET Framework provides an impressive support for file processing. Easy to create. The information is stored in regular Windows files; must constantly remember where a particular piece of information is stored. Since information is stored in distinguished files, a file can also be corrupted if not used or stored safely (Not-Relation Oriented).
6
International College of Business and Technology
3. I.
DBMS Data Bases Hierarchic Model The hierarchical Database Model Defines hierarchically arranged data. The most intuitive way to visualize this type of relationship is by visualizing an upside down tree of data. In this tree, a single table acts as the "root" of the database from which other tables "branch" out.
Relationships in such a system are thought of in terms of children and parents such that a child may only have one parent but a parent can have multiple children. Parents and children are tied together by links called "pointers". A parent will have a list of pointers to each of their children.
RO T O
Level 1 Child
Level 1 Child
Level 2 Child
Level 2 Child
Level 2 Child
Level 2 Child
(Figure 02) This child/parent rule assures that data is systematically accessible. To get to a low-level table, you start at the root and work your way down through the tree until you reach your target. II. Network Model
The Network Database model was designed to solve some of the more serious problems with the Hierarchical Database Model. Data are represented by collections of records. The Network model solves the problem of data
Relational Model (E.F.Codd) Data and relationships are represented by a collection of tables. Each table has a number of columns with unique names. Figure 03.1 & 03.2 shows a sample relational database.
<TITLE 1> <TITLE 2> *********** <TITLE 3> <TITLE 4>
Domain Title 1
7
International College of Business and Technology
Object Oriented Model Define type Employer: Tuple ( Fname : string; Mint : char; Lname : string; Ssn : string; Birthdate: date; address: string; Sex : char; Salary : floot; Supervisor: employee; Dept : department; ); UNARY Relationship All the relationships discussed so far have been binary relationship having two participants. Unary relationship has only one participant, the relation is associated with itself. Eg: - Employee to Employee
Employee Supervisio n
(Figure 04) BINARY Relationship A binary relationship is a type of relationship between the entities, which links to types of entities in it. Eg: - Player to Match
PI D FNam e MName Player LNam e M Plays M MatchI DD Match
(Figure 05)
8
International College of Business and Technology
ER Diagram
Player PID First Name Middle Name Last Name Player Personal Player Professional PID NIC First Name Middle Name Last Name DOB Age Native Place TP Number PID College Level Club Level International Level Scoring Nature Batting Bowling
Include
One day Bowling ODID Name Matches Innings Balls Runs Wickets BBI
One Day Batting and Fielding ODID Name Matches Innings Overs Runs HScore BFace 100s 50s 4s 6s Catches Stumps
Include
Use
View
Include
Test Batting and Fielding TID Name Matches Innings Overs Runs HScore BFace 100s 50s 4s 6s Catches Stumps
Test Bowling TID Name Matches Innings Balls Runs Wickets BBI
Helps Win
Plans
Ground Ground ID Ground Name Location Low Score High score Slow Medium High Geographical Nature Day Or Night Capacity
Include
Seiries Series ID Series Name Result Man of the series Stylish Player Best Bowler Best Batsman Best Umpire Best All Rounder
Match Match ID College Level Club Level International Level Day or Night Date Time Umpire Result Man Of the Match GID SID T20 Bowling T20ID Name Matches Innings Balls Runs Wickets BBI
T20 Batting and Fielding T20ID Name Matches Innings Overs Runs HScore BFace 100s 50s 4s 6s Catches Stumps
Plays
Host for
9
International College of Business and Technology
(Figure 06)
EER Diagram
Ground Information
Team Information
Match Information
Series Information
Expert Information
OD Bowling Information
Player Information
(Figure 07)
10
International College of Business and Technology
User Manual
This system was created for Sri Lanka Cricket Team Database program. This is a user friendly manual for users. It consist graphical user interfaces which allow the user to learn the system easily and quickly. This manual is provided for the user as a catalog in how to operate this system. Keys That I used to the system
Home Button Close Button Delete Button First Button Previous Button Next Button Last Button New Record Search Record Save Record Main Menu Quit the system
11
International College of Business and Technology
(Figure 08) (Figure 09) (Figure 10) First you can get figure 08, then enter the database password. After that you can logon to the system.
Home
(Figure 11) In home, you see two command buttons. If you click on main menu button, you can get the menu (figure 12). Otherwise if you click on quit button, then the program will quit.
12
International College of Business and Technology
Menu
(Figure 12) This is the main menu you can see. In the main menu, there are some buttons to open the systems form and reports.
Ground Menu
(Figure 13) Here you can log what you want. This is the ground menu and in that menu there are four buttons to log relational forms.
13
International College of Business and Technology
Player Menu
(Figure 14) Same like ground menu, you can do for player categories.
(Figure 15) This is the One Day menu of the Sri Lanka Cricket database system.
Test Menu
(Figure 16)
14
International College of Business and Technology
Match Information
(Figure 17) In the match information form, you can add matches, search matches and delete matches.
Series Information
(Figure 18) Here you can search, delete and add series information same like match information.
15
International College of Business and Technology
Expert Information
(Figure 19) This form is useful to select players for matches. In this form, you can find some expert information of players.
(Figure 20)
Team Information
(Figure 21) This is the Team Information form for add, search and delete teams.
16
International College of Business and Technology
Reports
(Figure 22) In this interfacing you ca see some report that I implemented.
Data Dictionary For the System Especial Strategy Information Data type Description Field size
Text Text Text Text Text Especial Strategy Identification Team Captain's Name Team Vice Captain Name Team Wicket Keeper Team Coach Name 50 50 50 50 50 Null value not accept
Field name
EspecialID (Pk) Captain ViceCaptain Keeper Coach
Field name
ExID (Pk) PID Name Category Age
Data type
Text Text Text Text Number
Field size
50 50 50 50 Double Null value not accept
Ground Information
17
International College of Business and Technology
Field name
GroundID (Pk) GroundName Location LowScore HighScore Slow Medium High GeographicalNature DayOrNight Capacity
Data type
Text Text Text Number Number Yes/No Yes/No Yes/No Text Text Number
Description
Ground Identification Ground Location Ground Location Low Score in Ground High Score in Ground Bowling Speed Bowling Speed Bowling Speed Surrounding, Climate and etc... Ground Good for Day or Night Matches Audiance Capacity of the Ground
Field size
50 50 50 Long Integer Long Integer Null value not accept
50 50 Long Integer
Field name
Field size
18
MatchID (Pk) CollegeLevel ClubLevel InternationalLevel DayOrNight Date Time Umpire Result ManOfTheMatch GroundID (Fk) SeriesID (Fk)
Text Yes/No Yes/No Yes/No Text Date/Time Date/Time Text Text Text Text Text
Match Identification College Level Matches Club Level Matches International Level Matches Day or Night Match Match Date Match Time Local or International Umpire Won or Lost Result Man of the match groung registation number Series identification
50
50
50 50 50 50 50
Field name
ODID (Pk) Name Matches Innings Overs Runs HScore BFace 100 50 6 Runs 4 Runs Catches Stumps
One Day Batting and Fielding Information Data type Description Field size
Text Text Number Number Number Number Number Number Number Number Number Number Number Number Identification of One Day Innings Name of the cricket player Number of matches Innings Overs Runs High Score Ball face Centuries Half centuries Six s Four s Catches Stumps 50 50 Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Null value not accept
Field name
ODID (Pk) Name Matches Innings Balls Runs Wickets BBI BBM 4Wickets 5Wickets 10Wickets
Text Text Number Number Number Number Number Text Text Number Number Number
Identification of One Day Innings Name of the cricket player Number of matches Innings Balls Runs Total Wickets BBI BBM 4 Wickets 5 Wickets 10 Wickets
50 50 Long Integer Long Integer Long Integer Long Integer Long Integer 50 50 Long Integer Long Integer Long Integer
Field name
PID (Pk) FirstName MiddleName LastName
Data type
Text Text Text Text
Field size
50 50 50 50 Null value not accept
Field name
PID (Pk) NIC FirstName
Player Middle Name Player Last Name Date of Birth Player Age Player City Player Telephone Number
Field name
PID (Pk) CollegeLevel ClubLevel InternationalLevel ScoringNature Batting Bowling Runs
Field name
SeriesID (Pk) SeriesName Result ManOfTheSeries StylishPlayer BestBowler
Data type
Text Text Text Text Text Text
Field size
50 50 50 50 50
50 21
Best Batsman of the Series Best Umpire of the Series Best All Rounder of the Series
50
50 50
Field name
T20ID (Pk) Name Matches Innings Overs Runs HScore BFace 100 50 6s 4s Catches Stumps
Twenty 20 Batting and Fielding Information Data type Description Field size
Text Text
Number Number Number Number Number Number Number Number Number Number Number Number
Identification of Twenty20 Match Name of the cricket player Number of matches Innings Overs Runs High Score Ball face Centuries Half centuries Six s Four s Catches Stumps
50 50
Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer
Field name
T20ID (Pk) Name Matches Innings Balls Runs Wickets BBI
Identification of Twenty20 Player Name of the cricket player Number of Matches Innings Balls Runs Wickets BBI
50 50
Long Integer Long Integer Long Integer Long Integer Long Integer
50
22
BBM 4W 5W 10W
50
Long Integer Long Integer Long Integer
Field name
TeamID (Pk) TeamName Result
Data type
Text Text Text
Field size
50 50 50 Null value not accept
Field name
TID (Pk) Name Matches Innings Overs Runs HScore BFace 100 50 6s 4s Catches
Test Batting and Fielding Information Data type Description Field size
Text Text
Number Number Number Number Number Number Number Number Number Number Number
Identification of the Test Player Name of the cricket player Number of matches Innings Overs Runs High Score Ball face Centuries Half centuries Six s Four s Catches
50 50
Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer Long Integer
23
International College of Business and Technology
Stumps
Number
Stumps
Long Integer
Field name
TID (Pk) Name Matches Innings Balls Runs Wickets BBI BBM 4W 5W 10W
Identification of Test Player Name of the cricket player Number of Matches Innings Balls Runs Wickets BBI BBM Four wickets Five wickets Ten Wickets
50 50
Long Integer Long Integer Long Integer Long Integer Long Integer
50 50
Long Integer Long Integer Long Integer
Why I had chosen Microsoft Access for my database system? Access makes it quick to share and manipulate information through collaboration on the Web. Using Windows Share point Services, several users can move their Access files to Windows Share point Services so coworkers can update, edit or work with those files, provided they have been granted permissions by the person who uploaded the files to Windows Share point Services. User friendly
Microsoft Access is available with the Microsoft Office Professional suite of business products therefore no additional database software is required purchases for my computer. Microsoft Access integrates well with the other members of the Microsoft Office suite of products (Word, Excel, Outlook, etc.). MS Access is the most widely used desktop database system in the world.
The following are some reasons why I am not choice Microsoft Access for my database application development. In some cases my computer systems may not be reliable enough to handle any database management system safely
24
International College of Business and Technology
BTEC Higher National Diploma in Computing Edexcel International - UK Any single table in my database could have more than 1 million large to medium-width records, or 5 million small-width records (i.e. 3-4 numeric or short text fields)
Using a Microsoft Access template database that doesn't perfectly fit my needs.
Advantages of ms access
user friendly easy to use It can be developed within a small time period Forms can be created very graphically and user friendly. easy to maintain
Disadvantages
More data cant be added to the system. its slow less securable not a real database Big business environment its not possible.
a.
External level database. This level describes the users or application programs view of the Several programs or users may share the same view. Implementation data model can be used at this level.
b. Conceptual level
The structure of the whole database for a community of users. It hides the details of physical storage structures and concentrates on describing entities, data types, relationships, user operations, and constraints.
25
International College of Business and Technology
E.R Model should be use to develop conceptual schema by analyzing industry data model properly. Eg: - Health care industry - Database for a hospital (Patient, Doctor). Education industry - Database for ICBT (Student Council, Lecturer, Subject). Banking and financial Sector - Database for HNB (Account holder, Staff, Accounts, Loan and leasing).
c.
Internal level Describes the physical storage structure of the database. Uses a physical data model and describes the complete details of data storage and access paths for the database.
(Figure 23)
26
International College of Business and Technology
The development of a large menu-based interface to an operating system posed a number of interesting user interface questions.
27
International College of Business and Technology
Among those were how to determine the user's view of the relationships among the myriad of functions in the system, and how to reflect those relationships in a menu hierarchy.
b. Form based interface A forms-based interface displays a fort o each user. Users can fill out all of the form entries to insert new data, or they can fill out only certain entries, in which case the DBMS will retrieve matching data for the remaining entries. Forms are usually designed and programmed for naive users as interfaces to canned transactions. Graphical user interface (GUI) A Graphical User Interface typically displays a schema to the user in diagrammatic form. The user then can specify a query by manipulating the diagram. In many cases, Graphical User Interfaces utilize both menus and forms.
Most Graphical User Interfaces use a pointing device, such as a Mouse, to pick certain parts of the displayed schema diagram.
Natural language interface These interfaces accept requests written in English or some other language and attempt to understand them.
A natural language interface usually has its own schema, which is similar to the database conceptual schema, as well as a dictionary of important words. The natural language interface refers to the words in its schema as well as to the set of standard words in its dictionary, to interpret the request. Parametric user interface Parametric users, such as bank tellers, often have a small set of operations that they must perform repeatedly. Systems analysts and programmers design and implement a special interface for a known class of naive users. Usually, a small set of abbreviated commands is included, with the goal of minimizing the number of keystrokes required for each request. Database administrator (DBA) interface A database administrator (DBA) is similar to a database developer or designer except that the Database administrator's key responsibilities is ensuring that a database is available at all to the users and programs that need it.
28
International College of Business and Technology
These include commands for creating accounts, setting system parameters, granting account authorization, changing a schema, and reorganizing the storage structures.
a. Data Manager Then Data Manager is the tool to meet all of your data management needs. Data Manager is an Excel add-in that enables you to transform worksheets into tables and create customized forms all within the familiar Excel environment.
Data Manager is a program which allows us to process and manipulate our data in an easy and logical manner using a graphical interface. Data Manager reads and writes delaminated files such as comma separated files (CSV) and also can read data from ODBC Data Sources.
Allows us to construct a conceptual design on how we are going to process our data and transform it into another form. We form our design by adding functional nodes and linking them such that the links form the data flow through nodes on a graphical work area. b. Query processor A relational database consists of many parts, but at its heart are two major components: the storage engine and the query processor. The storage engine writes data to and reads data from the disk. It manages records, controls concurrency, and maintains log files.
29
International College of Business and Technology
BTEC Higher National Diploma in Computing Edexcel International - UK A relational database consists of many parts, but at its heart are two major components.
I.
II.
The storage engine The query processor The storage engine writes data to and reads data from the disk. It manages records, controls concurrency, and maintains log files. The aim is to transform a query in high-level declarative language (SQL) into a correct and efficient execution strategy. Query decomposition. Query optimization. Query evaluation (execution).
c. DDL Compiler
Process schema definitions, specified in the DDL statements, and stores descriptions of the schemas in the system catalog.
Requests to access the MySQL databases received from an administrator are processed by the DDL (Data Definition Language) compiler. The DDL compiler compiles the commands (which are SQL statements) to interact directly with the database.
The administrator and administrative utilities do not expose an interface and hence execute directly to the MySQL server. Therefore, the embedded DML precompiled does not process it, and this explains the need for a DDL compiler. d. Run time database processor Handles database access at run time. It receives retrieval and update operations and carries them out on the database. Provided for on-line analytical processing.
Is arranged to obtain multi-dimensional aggregates of an input relation.
e. Pre compiler You must compile and pre-compile an application program containing embedded SQL statements before you run it. Pre-compiling programs is done by the SQL pre-compiler.
Based on the Data Model. Based in Number of Users. Based on Number of Sites.
Depending on the data model they use, the DBMSs can be classified as hierarchical, network, relational, object-oriented, and object-relational. Among these, the hierarchical and network data models are the older data models and now known as legacy data models. Some of the old applications still run on the database systems based on these models. The object-based data models have been implemented in some DBMSs, however, have not become popular. Due to the popularity of relational databases, the objectoriented concepts have been introduced in these databases that led to the development of a new class of DBMSs called object-relational DBMSs. b. Based in Number of users Depending on the number of users the DBMS supports, it is divided into two categories, Single-user system. Multi-user system. Single-user system The database resides on one computer and is only accessed by one user at a time. The user may design, maintain, and write programs for accessing and manipulating the database according to the requirements, as well as perform all the user roles. The user may also hire database system designers to design a system. In such a case, the single user performs the role of end user only. However, in most enterprises the large amount of data is to be managed and accessed by multiple users and thus, requires multi-user systems. Multi-user system Multiple users can access the database simultaneously. In multi-user DBMS, the data is both integrated and shared. Eg: Online registration database is a multi-user database system. It can be accessed by many users at a same time. c. Based on Number of sites Depending on the number of sites over which the database is distributed, it is divided into two types, Centralized Database systems. Distributes Database systems. Centralized Database systems Run on a single computer system. Both the database and DBMS software reside at a single computer site. The user interacts with the centralized system through a dummy terminal connected to it for information retrieval. Distributes Database systems The database and DBMS are distributed over several computers located at different sites.
31
International College of Business and Technology
I.
II.
I. II.
The computers communicate with each other through various communication media such as high-speed networks or telephone lines. This can be classified as homogeneous and heterogeneous. Homogeneous In homogeneous distributed database system, all sites have identical database management system software. Heterogeneous In heterogeneous distributed database system, different sites use different database management system software.
Another essential element of the E-R diagram is the mapping cardinalities, which express the number of entities to which another entity can be associated via a relationship set.
EER model = ER Model + Hierarchical Relationships. Entities that are member of one entity type may be grouped into meaningful subset. Attribute inheritance permits economy of representation. Entity that is a member of a sub-class inherits all of the attributes of the entity as a member of the super-class.
The EER model is very different from the relational model in a number of ways. Eg: - In EER, it is not possible to represent an object without knowing its properties, but in the relational model you need to know its key attributes.
32
International College of Business and Technology
b.
c.
Strong Entity & Week Entity Strong Entity A Strong entity type is an entity that exists independently of other types. Instances of a strong entity type always have a unique characteristic (called an identifier). That is, an attribute or combination of attributes that uniquely distinguish each occurrence of that entity. Week Entity A Weak entity type is an entity type whose existence depends on some other type. It has no business meaning and is not needed in the ER diagram without the entity on which it depends. The entity type on which the weak entity type depends is called the identifying owner. It does not have its own identifier. It has a partial identifier attribute. A full identifier may be formed by combining the partial identifier with the identifier of its owner.
d.
Attributes
33
International College of Business and Technology
An Entity is represented by a set of attributes that is descriptive properties possessed by all members of an entity set. Eg: Player = (Player_ID, First_Name, Last_Name, Player_Age) Team = (Team_ID, Team_Name) Domain the set of permitted values for each attributes. Attributes types I. Simple attributes. II. Composite attributes. III. Single-valued attributes. IV. Multi-valued attributes. V. Derived attributes. VI. Null Attributes. VII. Key Attributes. I. Simple attributes Simple attributes are attributes whose values can be stored in a single database column. Eg: The attributes age, sex, etc are simple attributes. In the following example, The metadata for the Event Time attribute shows that the values for this attribute are stored in the event time column in the Event table. Simple attributes must be enclosed in Attribute Meta Data tags. II. Composite attributes Attribute value not atomic A composite attribute is an attribute that can be further subdivided. Eg: The attribute ADDRESS can be subdivided into street, city, state, and zip code. A simple attribute cannot be subdivided. Composite attributes and component attributes
Name
First_Name Middle_Name
Last_Name
(Figure 24) III. Single-valued attributes A single-valued attribute can have only a single value. Eg: 34
International College of Business and Technology
A person can have only one 'date of birth', 'age' etc. That is a single valued attributes can have only single value. But it can be simple or composite attribute. That is 'date of birth' is a composite attribute, 'age' is a simple attribute. But both are single valued attributes. IV. Multi-valued attributes Multi-valued attributes can have multiple values. For instance a person may have multiple phone numbers, multiple degrees, etcMulti-valued attributes are shown by a double line connecting to the entity in the ER diagram.
The practice of maintaining more than a single value in a database column. A new type of field that was added to Access and is well understood and used there and also in the Share Point Community. An object or entity is characterized by its properties or attributes. In relational database systems attributes correspond to fields. V. Derived attributes The value for the derived attribute is derived from the stored attribute. Eg: 'Date of birth' of a person is a stored attribute. The value for the attribute 'Age' can be derived by subtracting the 'Date of Birth'(DOB) from the current date. Stored attribute supplies a value to the related attribute.
Derived attributes may be included in the data model if the rules for calculating the attribute values would otherwise be lost.
VI.
Null attributes It's all about the context in which it's used. A null means there is no value but the reason for this will depend on the domain in which it is being used. In many cases the items you've listed are all valid uses of a null. Null is a special marker used in SQL. It indicates missing or non existing data values. Null is also a representation of missing information and/or inapplicable information.
VII.
Key attributes Finding and defining unique identifiers for our entities is an important task. These identifiers will eventually become primary keys in our tables. The primary key definition of one table will be propagated to related tables (underlying tables) as foreign keys in each table. Tables may have several candidate keys: Columns that are considered to be used as primary keys. And, you may want to define secondary keys, unique or non-unique, for performance reasons: After the system is built, you may discover bottlenecks that can be removed by adding indexes on columns that are not a part of the primary or foreign keys.
35
International College of Business and Technology
BTEC Higher National Diploma in Computing Edexcel International - UK Some analysts and developers claim that the only right thing to do is to assign just a computer generated number, without any meaning, as primary keys.
Primary Key
The primary key of a relational table uniquely identifies each record in the table. It can either be a normal attribute that is guaranteed to be unique or it can be generated by the DBMS. Primary keys may consist of a single attribute or multiple attributes in combination.
Foreign Key A foreign key is a field in a relational table that matches the primary key column of another table. The foreign key can be used to cross-reference tables. e. Relationship They represent logical links between two or more entities. An instance of a relationship is an n-Tuple made up of instances of entities, one for each of the entities involved. Degree of Relationship (Cardinality) Cardinality ratio Constrains on Relationship one to one (1:1) one to many (1:M) many to one (M:1) many to many (M:M)
I.
II. III. 1. 2. 3. 4.
I.
36
International College of Business and Technology
BTEC Higher National Diploma in Computing Edexcel International - UK If minimum cardinality is 0, we say that entity participation in a relationship is optional. If minimum cardinality is 1, we say that entity participation in a relationship is mandatory.
1.
III. Constrain on relationship types One to one (1:1) One-to-one relationships occur when there is exactly one record in the first table that corresponds to exactly one record in the related table. One-to-one table relationships are a little more interesting and more underused than either of the other two types of relationships.
Employee Relat es Employee
(Figure 10) The key indicator of a possible need for a one-to-one relationship is a table that contains fields that are only used for a certain subset of the records in that table.
2.
3.
One to many (1:M) Allows records in Table 1 to be connected to an arbitrary number of records in Table 2 without the limitations imposed by resorting to redundant or limited numbers of fields in a single table. This reduces the size of the database and greatly increases the flexibility and performance of queries operating on that data. Many to one (M:1) This relationship is where one entity contains values that refer to another entity that has unique values. In relational databases, these relationships are often enforced by foreign key/primary key relationships, and the relationships typically are between fact and dimension tables and between levels in a hierarchy.
4.
Many to many (M:M) This relationship is a little more complex than the one-to-many because, in addition to the two tables of data, we need another table to join the two tables of interest together. That's right, we're adding a table to the database but it is a simple table and saves us lots of effort down the road. f. Participation Recall that a key constraint requires that each entity of a set be required to participate in at most one relationship. Dual to this, we may ask whether each entity of a set be required to participate in at least one relationship.
37
International College of Business and Technology
I.
Total Participation The total participation of an entity (type) in a certain relationship means that every entity that belongs to the entity type participates in at least one instance of the relationship. Partial Participation The participation an entity set L in a relationship set X is said to be partial, if only some entities in L participate in relationship in X.
II.
I.
II.
Domain constraints A domain of possible values should be associated with every attribute. These domain constraints are the most basic form of integrity constraint. They are easy to test for when data is entered. Domain types 1. Attributes may have the same domain, e.g. cname and employee-name. 2. It is not as clear whether bname and cname domains ought to be distinct. 3. At the implementation level, they are both character strings. 4. At the conceptual level, we do not expect customers to have the same names as branches, in general. 5. Strong typing of domains allows us to test for values inserted, and whether queries make sense. Newer systems, particularly object-oriented database systems, offer a rich set of domain types that can be extended easily. Key constraints These are constraints implied by the existence of candidate keys. The table definition includes a specification implying uniqueness of the attributes constituting the primary key or alternate keys. A primary key constraint also implies a no-null constrains.
III. Entity integrity constraints 1. Integrity constraints provide a way of ensuring that changes made to the database by authorized users do not result in a loss of data consistency.
38
International College of Business and Technology
We saw a form of integrity constraint with E-R models, Key declarations: stipulation that certain attributes form a candidate key for the entity Form of a relationship: mapping cardinalities 1-1, 1-many and many-many.
set. An integrity constraint can be any arbitrary predicate applied to the database. They may be costly to evaluate, so we will only consider integrity constraints that can be tested with minimal overhead. IV. Referential integrity constrains Often we wish to ensure that a value appearing in a relation for a given set of attributes also appears for another set of attributes in another relation. This is called referential integrity.
4. V.
3.
Data dependencies 1. Functional dependencies A Functional Dependency describes a relationship between attributes in a single relation. An attribute is functionally dependant on another if we can use the value of one attribute to determine the value of another.
A table involves a multi-valued dependency if it may contain multiple values for an A multi-valued dependency may arise as a result of enforcing1st normal form. XY, is X multi-determines Y, when for each value of X we can have more than one
entity.
value of Y. If AB and AC then we have a single attribute A which multi-determines two other independent attributes, B and C. If A (B, C) then we have an attribute A which multi-determines a set of associated attributes, B and C.
39
International College of Business and Technology
IBM then released follow up products in 1982 named SQL/DS and DB2. Oracle (now from Oracle Inc.) and DB2 continue today in advanced forms while the Ingress technology was acquired by Computer Associates.
a.
SQL Definition Structured Query Language is a language used to interrogate and process data in a
relational database. Originally developed by IBM for its mainframes, all database systems designed for client/server environments support SQL. Commands can be used to interactively work with a database or can be embedded within a programming language to interface to a database. Programming extensions to Structure Query Language have turned it into a fullblown database programming language, and all major database management systems (DBMSs) support the language.
ANSI standardized SQL, but most database management systems (DBMSs) have some proprietary enhancement, which if used, makes SQL non standard. Moving an application from one SQL database to another may require tailoring to convert some commands.
b.
Categories of SQL
I.
Data definition statements Auxiliary statements Optimization statements Routine definition statements Data manipulation statements Server/Client connection statements Optical subsystem statements Data integrity statements Dynamic management statements Data access statements Cursor manipulation statements
DDL Data Definition Language is a language used to define data structures within a database. It is typically considered to be a subset of SQL, the Structured Query Language, but can also refer to languages that define other types of data. II. DML
40
International College of Business and Technology
Data Manipulate Language is a base topic for topics describing a language for manipulating (inserting, updating, deleting) structured data. This data may have been defined using a DDL and queried using a Query Language. DCL Data Control Language is a computer language and a subset of SQL, used to control access to data in a database. Due to the nature of at which this standard operates it is possible for there to be problems within the sub system of the programming. Examples of DCL commands, GRANT to allow specified users to perform specified tasks. REVOKE to cancel previously granted or denied permissions. Creates an entry in the security system that allows a user in the current database to work with data in the current database or execute specific Transact-SQL statements. TCL Transactional control is the ability to manage various transactions that may occur within a relational database management system When a transaction is executed and completes successfully, the target table is not immediately changed, although it may appear so according to the output. There are three commands used to control transactions, COMMIT ROLLBACK SAVEPOINT IV. III.
Creating a simple database in Access is very easy and everyone can do this job in a few clicks. But making a good relational database is not so simple. While designing a relational database, it is a good idea to distribute the information in multiple tables. It is not advisable to store all the information in a single table, although it is easier to design. When our database grows in size, the efficiency decreases accordingly, For example, If we are planning to make a simple database of our employees, then we can divide the employees information in 3 tables. In one table we can store the contact info, in second we can store the salary and department details and in third table we can store the bonus history of the employees.
a.
Semantics of attributes Based on a systematic study of the semantics of temporal attributes of entities. The notions of observation and update patterns of an attribute capture when the attribute changes value and when the changes are recorded in the database.
41
International College of Business and Technology
A lifespan describes when an attribute has a value and derivation functions describe how the values of an attribute for all times within its lifespan are computed from stored values. The implications for temporal database design of the semantics that may be captured using these concepts are formulated as schema decomposition rules.
b.
Spurious tuples
Bad designs for a relational database may result in erroneous results for certain JOIN operations. The "lossless join" property is used to guarantee meaningful results for join operations. The relations should be designed to satisfy the lossless join condition. No spurious tuples should be generated by doing a natural-join of any relations. Design relation schemas so that they can be joined with equality conditions on attributes that are either primary keys or foreign keys. Avoid relations that contain matching attributes that are not (foreign key, primary key) combinations. There are two important properties of decompositions, Non-additive or lossless ness of the corresponding join is extremely important and cannot be sacrificed. Preservation of the functional dependencies is less stringent and may be sacrificed.
c.
Deletion anomalies If we delete a row from a table that represents the last data of the table located at that domain, the details about that domain are also lost from the Database. Insertion anomalies An insertion anomaly is the inability to add data to the database due to absence of other data. For example, Assume Student_Group is defined so that null values are not allowed. If a new employee is hired but not immediately assigned to a Student_Group then this employee could not be entered into the database. This results in database inconsistencies due to omission. Update/Modification anomalies An update anomaly is a data inconsistency that results from data redundancy and a partial update. For example, Each employee in a company has a department associated with them as well as the student group they participate in.
42
International College of Business and Technology
d.
e.
And also I referred some notes from books, handouts and Slide shows given by our lecture.
43
International College of Business and Technology
Gantt chart
44
International College of Business and Technology
45
International College of Business and Technology