Data independence tells about the independence of the data inside the application. It usually deals with the storage structure and represents the ability to modify the schema definition. It doesn’t affect the schema definition which is being written on the higher level. There are two types of data independence:
NOTE: Logical Data Independence is more difficult to achieve.
SQL IN operator is used to see if the value exists in a group of values. For instance the below
SQL checks if the Name is either 'David' or 'Craig' SELECT * FROM wbEmployee WHERE name IN ('David','Craig') Also you can specify a not clause with the same. SELECT * FROM wbEmployee WHERE age NOT IN (30,25)
Unlike Relational systems in System R
ACID stands for Atomicity, Consistency, Isolation and durability and it plays an important role in the database. These properties allow the database to be more convenient to access and use. This allows data to be shared more safely in between the tables. If these properties are not being implemented then the data will become inconsistent and inaccurate. It helps in maintaining the accuracy of the data in the database.
The storage structures and access methods used by database system are specified by a set of definition in a special type of DDL called data storage-definition language.
It is a collection (set) of entities that have same attributes.
The two principal rules for the relational model are as follows:
The differences between them are as follows:
For example: if a table is present and there is a set of column out of which one column has parent key set then to ensure that the table doesn’t contain any duplicate values, a unique index is defined on the column that contains the parent key.
There are three major relationship models:-
Normalization is a process of analyzing the given relation schemas according to their functional dependencies. It is used to minimize redundancy and also minimize insertion, deletion and update distractio
A database is a logically coherent collection of data with some inherent meaning, representing some aspect of real world and which is designed, built and populated with data for a specific purpose.
Analytical processing databases are not very normalized. The operations which are used are read most databases. It is used to extract the data that are ancient and accumulated over long period of time. For this purpose de-normalization occurs that provide smart business applications. Dimensional tables in star schema are good example of de-normalized data. The de-normalized form must be controlled while extracting, trforming, loading and processing. There should be constraint that user should not be allowed to view the state till it is consistent. It is used to increase the performance on many systems without RDBMS platform.
This language is to specify the internal schema. This language may specify the mapping between two schemas.
It is an association among two or more entities.
There are many relational operators that are used to perform actions on relational database. These operators are as follows:
System R was designed and developed over a period of 1974-79 at IBM San Jose Research Center. It is a prototype and its purpose was to demonstrate that it is possible to build a Relational System that can be used in a real life environment to solve real life problems, with performance at least comparable to that of existing system.
Its two subsystems are
The database and DBMS software together is called as Database system.
Non-first normal form (NFA) – it describes the definition of the database design which is different from the first normal form. It keeps the values in structured and specialized types with their own domain specific languages. The query language used in this is extended to incorporate more support for relational domain values by adding more operators.
Data independence specifies that the application is independent of the storage structure and the access strategy of data. It me the ability to modify the schema definition in one level should not affect the schema definition in the next higher level.
There are two types of data independence:
The collections of entities of a particular entity type are grouped together into an entity set.
The are three levels of abstraction:
VDL (View Definition Language): It specifies user views and their mappings to the conceptual schema.
SQL stands for Structured Query Language.SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems. SQL statements are used to retrieve and update data in a database.
Main difference between a simple file and database that database has independent way (SQL) of accessing information while simple files do not File meets the storing, managing and retrieving part of a database but not the independent way of accessing data. Many experienced programmers think that the main difference is that file can not provide multi-user capabilities which a DBMS provides. But if we look at some old COBOL and C programs where file where the only me of storing data, we can see functionalities like locking, multi-user etc provided very efficiently. So it’s a matter of debate if some interviewers think this as a main difference between files and database accept it… going in to debate is probably loosing a job.
Functional Dependency is the starting point of normalization. It exists when a relation between two attributes allows you to uniquely determine the corresponding attribute's value.
Table consists of some properties that are known as attributes. These consist of the representation of entity in the table. They are represented by columns in the table. Entity is referred to the store data about any particular thing. It is the smallest unit inside the table.
Relational database me the relationship between different databases. In relational database user can store and access all the data through the tables which are related to each other. Relationship between the store data is called base relations and implementation of it is called as tables. Whereas, relations which don’t store the data, but can be found out by applying relational operations on other relations are called as derived relations. When these are implemented they are termed as views or queries. Derived relations are more useful then base relation, as they can have more information from many relations, but they act as a single relation.
ORDER BY clause helps to sort the data in either ascending order to descending order.
Index is a way to provide quick access to the data and structure. It has indexes maintain and can be created to combine attributes on a relation. Index allows the queries to filter out the searches faster and matching data can be found earlier with simplicity. For example it is same as the book where by using the index you can directly jump to a defined section. In relational database there is a provision to give multiple indexing techniques to optimize the data distribution.
Cardinality is important and used to arrange the data inside the database. It is related to the design part and need to be properly used in database. It is used in E-R diagrams and used to show the relationship between entities/tables. It has many forms like the basic is one to one, which associate one entity with another.
Second is one to many: which relates one entity with many entities in a table.
Third is many to many M: N that allows many entities to be related to many more.
Last is many to one: that allows the many entities to be associated with one entity.
Domain describes possible values grouped together that can be given for an attribute. It is considered the same way as a constraint on the value of attribute. A domain can be attached to an attribute but only if the attribute is an element of specified set. For example: XYZ doesn’t fulfill the domain constraint but the integer value as 899 fulfills the criteria of domain constraint. Hence, domain is of high importance.
This model is based on collection of objects. An object contains values stored in instance variables with in the object. An object also contains bodies of code that operate on the object. These bodies of code are called methods. Objects that contain same types of values and the same methods are grouped together into classes.
There are two Integrity rules.
Normalization is very essential part of relational model. It consists of set of procedures that eliminates the domains that are non-atomic and redundancy of data that prevents data manipulation and loss of data integrity. Normal forms are the common form of normalization. It helps in reducing redundancy to increase the information overall. It has some disadvantages as it increases complexity and have some overhead of processing.
Data Definition Language : A data base schema is specifies by a set of definitions expressed by a special language called DDL.
A view may be thought of as a virtual table, that is, a table that does not really exist in its own right but is instead derived from one or more underlying base table. In other words, there is no stored file that direct represents the view instead a definition of view is stored in data dictionary.
Growth and restructuring of base tables is not reflected in views. Thus the view can insulate users from the effects of restructuring and growth in the database. Hence accounts for logical data independence.
It is a collection of all entities of particular entity type in the database.
Insert statement is used to insert new rows in to table. Update to update existing data in the table. Delete statement to delete a record from the table. Below code snippet for Insert, Update and Delete :-
INSERT INTO wbEmployee SET name='maxwell',age='22';
UPDATE wbEmployee SET age='22' where name='maxwell';
DELETE FROM wbEmployee WHERE name = 'david';
Relation in the relational database model is defined as the set of tuples that have the same attributes. Tuple represents an object and also the information that the object contains. Objects are basically instances of classes and used to hold the larger picture. Relation is described as a table and is organized in rows and columns. The data referenced by the relation come in the same domain and have the same constraints as well. Relations in the relational database model can be modified using the commands like insert, delete etc.
Below SQL selects employees born between '01/01/1995' AND '01/01/1978' as per mysql
SELECT * FROM wbEmployee WHERE DOB BETWEEN '1995-01-01' AND '2011-09-28'
An entity set may not have sufficient attributes to form a primary key, and its primary key compromises of its partial key and primary key of its parent entity, then it is said to be Weak Entity set.
There are three levels of data abstraction that is present in database model and these are as follows:
Denormalization is the process of boosting up database performance and adding of redundant data which helps to get rid of complex data.
There are four types of database languages:
Constraints are kind of restrictions that are applied to the database or on the domain of an attribute. For example an integer attribute is restricted from 1-10 and not more than that. They provide the way to implement the business logic and the rules in database. In database it can be implemented in the form of check constraints that checks for the rules that haven’t been followed by the programmer. Constraint also used to restrict the data that can be stored in the relations. Domain constraint can be applied to check the domain functionality and keep it safe..
It is a particular property, which describes the entity.