Sei sulla pagina 1di 13

File Systems vs DBMS A company has a large collection (example: 500 GB) of data on employees, departments, products, sales,

and so on. This data is accessed concurrently (altogether) by several employees. Changes made to the data by different users must be applied consistently, and access to certain parts of the data (e.g., salaries) must be restricted. We can try to deal with this data management problem by storing the data in a collection of operating system files. Database: You may have recorded this data in an indexed address book, or you may have stored it on a pen drive using a computer and software such as Microsoft ACCESS, or EXCEL. This is a collection of related data with an implicit meaning and hence is a database. A database is a persistent (behavior/pattern), logically (clear/consistent) coherent (relation of parts) collection of inherently meaningful data, relevant to some aspects of the real world.

Drawbacks: We probably do not have 500 GB of main memory (RAM) to hold all the data. We must therefore store data in a storage device such as a disk or tape and bring relevant parts into main memory for processing as needed. Write complex programs required to search large volume of data Protect the data from inconsistent changes made by different users accessing data concurrently. We must ensure that data is restored to a consistent state if the system crashes while changes are being made. Operating systems provide only a password mechanism for security. This is not sufficiently flexible to enforce security policies in which different users have permission to access different subsets of the data.

A DBMS is a piece of software that is designed to make these aforementioned tasks easier. By storing data in a DBMS, rather than as a collection of operating system files, we can use the DBMS's features to manage the data in a robust and efficient manner. As the volume of data and the number of users grow, DBMS support becomes essential.

Advantage of a DBMS Data independence: Data independence is a form of database management that keeps data separated from all programs that make use of it, this independence ensures that the data cannot be redefined or reorganized by any of the programs that make use of it. In this manner, the data remains accessible, but it is also stable and cannot be corrupted by the applications. A DBMS utilizes a variety of sophisticated techniques to store and retrieve data efficiently. This feature is especially important if the data is stored on external storage devices. Data integrity and security: If data is always accessed through the DBMS, the DBMS can enforce integrity constraints on the data. For example: Before inserting salary information for an employee, the DBMS can check that the department budget is not exceeded. The DBMS can enforce access controls that govern what data is visible to different classes of users. Data administration: When several users share the data, centralizing the administration of data can offer significant improvements and data representation to minimize redundancy Concurrent access and crash recovery: A DBMS schedules concurrent accesses to the data in such a manner that users can think of the data as being accessed by only one user at a time.

Reduced application development time: DBMS applications have been more robust than applications developed from scratch because many important tasks are handled by the DBMS than the software application itself

A database management system (DBMS) is a collection of programs that enables users to create and maintain a database. The DBMS is hence a general-purpose software system that facilitates the processes of defining, constructing, and manipulating databases for various applications. Defining a database involves specifying the data types, structures, and constraints for the data to be stored in the database. Constructing the database is the process of storing the data itself on some storage medium that is controlled by the DBMS. Manipulating a database includes such functions as querying the database to retrieve specific data, updating the database to reflect changes in the miniworld, and generating reports from the data.

While a database is a repository of data, a database management system (DBMS), is a set of software tools that control access, organize, store, manage, retrieve and maintain data in a database.

Why do we need database software (DBMS) ? We need the ability to have multiple users insert, update and delete data to the same data file without "stepping on each other's toes". This means that different users will not cause the data to become inconsistent, and no data should be inadvertently lost through these operations. Have a standard interface for data access, tools for data backup, data restore and recovery, and handle huge volumes of data and users. RDBMS: The most mature database systems in production are relational database management systems (RDBMSs), which serve as the backbone of applications in many industries including banking, transportation, health, hospital and etc. The advent of Web-based interfaces has only increased the volume and breadth of use of RDBMS.

Information Model and Data Model Information Model: is to model managed objects at a conceptual level, it defines relationships between managed objects. It is usually a, formal representation of entity types that may include their properties, data types, relationships, and constrains that define the 'template' of the database and the operations that can be performed on them.

Data Models: Is the blueprint of any database system, where it provides operations on the database that allow retrievals and updates including insertions, deletions, and modifications. They are intended for software developers and include protocol-specific constructs.

Since conceptual models can be implemented in different ways, multiple Data Models can be derived from a single Information Model

Data can be stored in various forms, namely tabular, hierarchical and graphical forms. When data is organized in a tree structure form, it is called a hierarchical database.

Data stored as graphs representing relationships between objects is referred to as a network database.

If data is stored in a tabular form then it is called a relational database. Relationship Model: the relational model, you still have to come up with a design that reflects the business you are trying to model

Whether we use a general-purpose DBMS or notwe usually have to employ a considerable amount of software to manipulate the database. We will call the database and DBMS software together a database system. Mostly common used database is the Relational Database. The relational data model used in numerous systems: IBM's DB2, Oracle, Sybase, Microsoft's Access, FoxBase, Paradox,

Relational Model The relational model represents the database as a collection of relations. Informally, each relation resembles a table of values. In the relational model, each row in the table represents a

fact that typically corresponds to a real-world entity or relationship. The table name and column names are used to help in interpreting the meaning of the values in each row. Tuple: A row Attribute: A column header Relation: The table Domain: The data type describing the types of values that can appear in each column

A Relation Relation can be viewed as a table. In that table, each row represents a tuple of data values and each column represents an attribute. An attribute is a column of a relation designated by name. The name associated should be meaningful. Each attributes associates with a domain. The cardinality of the relation is the number of tuples in the relation

A description of data in terms of a data model is called a schema. In the relational model, the schema for a relation specifies its name, the name of each field (attribute), and the type of each field. As an example, student information in a university database may be stored in a relation with the following schema:

Students (sid: string, name: string, login: string, age: integer, gpa: real) The preceding schema says that each record in the Students relation has five fields, with field names and types as indicated.

Each row in the Students relation is a record that describes a student. The description is not complete. Every row follows the schema of the Students relation. The schema can therefore be regarded as a template for describing a student. For example, we could specify that every student has a unique sid value, specify uniqueness of the values in a field increases the accuracy. other important data models include the hierarchical model (e.g., used in IBM's IMS DBMS), the network model (e.g., used in IDS and IDMS), the object-oriented model (e.g., used in Object store and Versant), and the object-relational model (e.g., used in DBMS products from IBM, Informix, Object Store, Oracle, Versant, and others). While there are many databases that use the hierarchical and network models, and systems based on the object-oriented and object-relational models are gaining acceptance in the marketplace, the dominant model today is the relational model.

Primary keys and foreign keys Are two types of constraints that can be used to enforce data integrity in SQL Server tables. These are important database objects.

Primary Key Student ID is the primary key (PK) of Student Table that contain values that uniquely identify each row in the table Foreign Key A foreign key (FK) reference, a link is created between two tables (student and subject tables) when the column that hold the primary key (PK) value for one table (Student table) are referenced by the column in another table (Subject table). This column becomes a foreign key in the second table (Subject table). Levels of Abstraction in a DBMS There are three levels of abstraction; the conceptual, physical, and external schemas

Physical schema: Defines how data is stored Logical Level (conceptual schema): The next-higher level of abstraction describes what data are stored in the database, and what relationships exist among those data. Student (name: string, login: string, age: integer, gpa: real) Faculty (id: string, fname: string, fee: real) Courses (cid: string, cname: string, credits: integer)

Each external schema (view level): A view is conceptually a relation, but the records in a view are not stored in the DBMS, users access only a part of the database

A data definition language (DDL) is used to define the external and conceptual schemas.

Database manipulation involves querying and updating. A list data retrieval Query (normal English language) list of all courses and gradesof Mohamed

list the names of students who took the Mathematics course offered in 2010 and their grades in geometry

Updates query: Change the class of Ahmed to Class B and create a new attibute for the Database course for this semester and enter a grade of A for Ahmed in the Database section of last semester These informal queries and updates must be specified precisely in the database system language before they can be processed.

System Catalog: This definition of database is stored in the system catalog, which contains information such as the structure of each file, the type and storage format of each data item, and various constraints on the data. Meta-Data: The information stored in the catalog, which describes the structure of the primary database, as well as the data structure and its constraints. A general purpose DBMS software package is not written for a specific database application, and hence it must refer to the catalog to know the structure of the files in a specific database, such as the type and format of data it will access. Constrains: Rules enforced on data columns on table. These are used to limit the type of data that can go into a table, ensuring accuracy and reliability of the data in the database, such as age cannot be an alphabet, age number cannot be high, ID is unique, etc

What Does a DBMS Do? Database management systems provide several functions in addition to simple file management: allow concurrency (simultaneously) control security

maintain data integrity (identical not change) provide for backup and recovery control redundancy allow data independence Query optimization

Who Interacts with a DBMS? Many different individuals are involved with a database management system over its life: systems analysts database designers database administrators application developers users

Potrebbero piacerti anche