Ads

Sunday, March 14, 2010

Learn DBMS, Part - IV

KEY IN DBMS

The key is defined as the column or attribute of the database table. For example if a table has id,name and address as the column names then each one is known as the key for that table. We can also say that the table has 3 keys as id, name and address. The keys are also used to identify each record in the database table.The following are the various types of keys available in the DBMS system.


1. A simple key contains a single attribute.
2. A composite key is a key that contains more than one attribute.
3. A candidate key is an attribute (or set of attributes) that uniquely identifies a row. A candidate key must possess the following properties:

o Unique identification - For every row the value of the key must uniquely identify that row.
o Non redundancy - No attribute in the key can be discarded without destroying the property of unique identification.

4. A primary key is the candidate key which is selected as the principal unique identifier. Every relation must contain a primary key. The primary key is usually the key selected to identify a row when the database is physically implemented. For example, a part number is selected instead of a part description.
5. A superkey is any set of attributes that uniquely identifies a row. A superkey differs from a candidate key in that it does not require the non redundancy property.
6. A foreign key is an attribute (or set of attributes) that appears (usually) as a non key attribute in one relation and as a primary key attribute in another relation. I say usually because it is possible for a foreign key to also be the whole or part of a primary key:

o A many-to-many relationship can only be implemented by introducing an intersection or link table which then becomes the child in two one-to-many relationships. The intersection table therefore has a foreign key for each of its parents, and its primary key is a composite of both foreign keys.
o A one-to-one relationship requires that the child table has no more than one occurrence for each parent, which can only be enforced by letting the foreign key also serve as the primary key.

7. A semantic or natural key is a key for which the possible values have an obvious meaning to the user or the data. For example, a semantic primary key for a COUNTRY entity might contain the value 'USA' for the occurrence describing the United States of America. The value 'USA' has meaning to the user.
8. A technical or surrogate or artificial key is a key for which the possible values have no obvious meaning to the user or the data. These are used instead of semantic keys for any of the following reasons:

o When the value in a semantic key is likely to be changed by the user, or can have duplicates. For example, on a PERSON table it is unwise to use PERSON_NAME as the key as it is possible to have more than one person with the same name, or the name may change such as through marriage.
o When none of the existing attributes can be used to guarantee uniqueness. In this case adding an attribute whose value is generated by the system, e.g. from a sequence of numbers, is the only way to provide a unique value. Typical examples would be ORDER_ID and INVOICE_ID. The value '12345' has no meaning to the user as it conveys nothing about the entity to which it relates.

NORMALIZATION


Data normalization is a set of rules and techniques concerned with:

• Identifying relationships among attributes.
• Combining attributes to form relations.
• Combining relations to form a database.

It follows a set of rules worked out by E FCodd in 1970. A normalized relational database provides several benefits:

• Elimination of redundant data storage.
• Close modeling of real world entities, processes, and their relationships.
• Structuring of data so that the model is flexible.

Because the principles of normalization were first written using the same terminology as was used to define the relational data model this led some people to think that normalization is difficult. Nothing could be more untrue. The principles of normalization are simple, common sense ideas that are easy to apply.


The only attribute values permitted by 1 NF are single atomic (or indivisible) values. If there is no value present for the column, then it should be denoted as null.

BCNF


A table is in Boyce-Codd normal form (BCNF) if and only if it is in 3NF and every determinant is a candidate key.

1. Anomalies can occur in relations in 3NF if there is a composite key in which part of that key has a determinant which is not itself a candidate key.
2. This can be expressed as R(A,B,C), C--->A where:

o The relation R contains attributes A, B and C.
o A and B form a candidate key.
o C is the determinant for A (A is functionally dependent on C).
o C is not part of any key.

3. Anomalies can also occur where a relation contains several candidate keys where:

o The keys contain more than one attribute (they are composite keys).
o An attribute is common to more than one key.

Saturday, March 13, 2010

Learn DBMS, Part III

DATABASE SYSTEM ARCHITECT


Following are the three types of database architectures:

1. Client-Server Database Systems

A client is defined as a requester of services and a server is defined as the provider of services.
Today centralized systems act as server systems that satisfy requests generated by client systems.
Functionally database systems can be broadly divided into two parts:


• Front end: front end of a database system consists of tools such as SQL user interface, forms interfaces, reports generation tools, and analysis tools.
• Back end: The back end of a database system manages query evaluation and optimization, access structures, concurrency control and recovery management.



2. Parallel Systems

In parallel processing, many operations are performed simultaneously and the computational steps are performed sequentially. It can process thousands of transactions per second.


There are four types of Architectural Models for Parallel Processing:



• Shared Memory (tightly coupled) architecture: Multiple processors share secondary (disk) storage and also share primary memory.
• Shared Disk (loosely coupled) architecture: Multiple processors share secondary (disk) storage but each has their own primary memory.
• Shared Nothing: The processors share neither a common memory nor common disk.
• Hierarchical: this model is the combination of preceding three architectures.


3. Distributed Systems


Distributed database is a collection of multiple logically interrelated databases distributed over a computer network and a distributed database management system is a software system that manages a distributed database while making the distribution transparent to the user. Transparency means hiding the details of where the data is physically stored within the system.
Reasons for building a distributed database are sharing of data, autonomy, and availability.

Functions of distributed databases:


• Keeping track of data.
• Query Processing by a communication network.
• Security Management.
• Distributed Transaction Management
• Database Recovery.

CODD’S RULE


E.F. Codd, the famous mathematician has introduce 12 rules for the relational model for databases commonly known as Codd's rules. The rules mainly define what is required for a DBMS for it to be considered relational , i.e., an RDBMS. There is also one more rule i.e Rule00 which specifies the relational model should use the relational way to manage the database. The rules and their description is as follows:-

Rule 000: A RDBMS system should be capable of using its relational facilities (exclusively) to manage the database.

Rule 1: The information rule : All information in the database is to be represented in one and only one way. This is achieved by values in column positions within rows of tables.

Rule 2 : The guaranteed access rule : All data must be accessible with no ambiguity.This is achieved in the RDBMS by using the primary key concept.

Rule 3: Systematic treatment of null values : The DBMS must allow each field to remain null. The null can be stored in any field of any datatype.

Rule 4: Active online catalog based on the relational model : The authorized users can access the database structure by using common language i.e SQL.

Rule 5: The comprehensive data sublanguage rule : The system must support at least one relational language that has simple syntax and transaction management facilities. It can be used in the application as well as in the RDBMS systems.

Rule 6: The view updating rule : All views must be updatable by the system.

Rule 7: High-level insert, update, and delete : The system is able to insert, update and delete operations fully. It can also perform the operations on multiple rows simultenously.

Rule 8: Physical data independence : Changes to the physical storage structure must not require a change to an application based on the structure.

Rule 9: Logical data independence : Changes to the logical level (tables, columns, rows, and so on) must not require a change to an application based on the structure.

Rule 10: Integrity independence : All the Integrity constraints like primary key, uniques key etc must be specified separately from application programs and stored in the catalog.

Rule 11: Distribution independence : The distribution of portions of the database to various locations should be invisible to users of the database.

Rule 12: The nonsubversion rule : If the system provides a low-level (record-at-a-time) interface, then that interface cannot be used to subvert the system, for example, bypassing a relational security or integrity constraint.

Note:- Any database management system which fulfills 6 or more than 6 rules can be considered as the RDBMS.

Friday, March 12, 2010

Learn DBMS, Part - II

DATA MODELS:


Data model is defined as the collection of conceptual tools for describing data, data relationships, data semantics and consistency constraints. There are following four Data Model exists.

The Hierarchical Data Model

A hierarchical database consists of the following:


1. It contains nodes connected by branches same as the trees in datastructers.
2. The top node is called the root.
3. If multiple nodes appear at the top level, the nodes are called root segments.
4. The parent of node nx is a node directly above nx and connected to nx by a branch.
5. Each node (with the exception of the root) has exactly one parent.
6. The child of node nx is the node directly below nx and connected to nx by a branch.
7. One parent may have many children.

The Network Data Model

Like the The Hierarchical Data Model the Network Data Model also consists of nodes and branches, but a child may have multiple parents within the network structure.

The Relational Data Model

The Relational Data Model has the relation at its heart, but then a whole series of rules governing keys, relationships, joins, functional dependencies, transitive dependencies, multi-valued dependencies, and modification anomalies. A relation is subject to the following rules:


1. Relation (file, table) is a two-dimensional table.
2. Attribute (i.e. field or data item) is a column in the table.
3. Each column in the table has a unique name within that table.
4. Each column is homogeneous. Thus the entries in any column are all of the same type (e.g. age, name, employee-number, etc).
5. Each column has a domain, the set of possible values that can appear in that column.
6. A Tuple (i.e. record) is a row in the table.
7. The order of the rows and columns is not important.
8. Values of a row all relate to some thing or portion of a thing.
9. Repeating groups (collections of logically related attributes that occur multiple times within one record occurrence) are not allowed.
10. Duplicate rows are not allowed (candidate keys are designed to prevent this).
11. Cells must be single-valued (but can be variable length). Single valued means the following:

1. Cannot contain multiple values such as 'A1,B2,C3'.
2. Cannot contain combined values such as 'ABC-XYZ' where 'ABC' means one thing and 'XYZ' another.



Object Oriented Model

In object oriented model information is represented in the form of objects as used in object oriented programming. Object Oriented Database Management Systems is a combination of object oriented programming language capabilities and database capabilities. It contains some properties like transparently persisted data, concurrency control, data recovery, associative queries, and other capabilities. Some object oriented programming languages are Java, C++, .NET, Visual Basic, Python etc. Most object databases also offer some kind of query language, allowing objects to be found by a more declarative programming approach.


THREE SCHEMA ARCHITECTURE

The goal of Three-Schema architecture is to separate the user applications and physical database. In this architecture, schemas can be defined at the following three levels:


• The internal level:- The internal level has an internal schema which describes the physical storage structure of the database.
• The conceptual level:-The conceptual level has a conceptual schema, it describes the entities, data types, relationships, user operations, and constraints.
• The external level or view level:- The external or view level includes a number of external schemas or user views. It describes the part of the database that a particular user group is interested in and hides the rest of the database from that user group.

Thursday, March 11, 2010

Learn DBMS

DBMS stands for Database Management System. A DBMS consists of collection of interrelated data and a set of program to access that data. The collection of data is known as a database. A database consists of the data relat ed to one organization. Prior to DBMS systems, the data was kept under the file system in forms of multiple files. The following are the disadvantages of the File system:-


1. Difficulty in Accessing data:- In the file system it is very difficult to find the data which is needed for some specific purpose. Like to get the average sale of the quarter needs to process all files for the quarter and then do some processing.

2. Data inconsistency and redundancy:- As the files and processing systems created by different vendors and programmers, so there is a inconsistency of data as different people prefer the different style of data handling. Also the different systems may use the different programming languages to develop the processing systems so the multiple copies of the same file kept under various places so redundancy is another problem we have with file system.

3. Security Problem:- There is a great risk of unauthroized person access the file system and get the data. So security is the major concern in the file system.
4. Integrity Problem:- The integrity issue is also a major concern as the data stored in the file can be changed easily. While creating files there is no specific rules checked while storing the data.

Advantages of Database Management System:-

The following are the advantages of DBMS systems:-


1. A data can be validated before storing into the DBMS system.These rules for data validation are known as Constraints in DBMS.

2. Different users can be created with different rights for the database.So DBMS systems are more secure than the conventional file system.

3. The relationships of the data can also be stored along with the data which is not possible for the files.

4. A simple english like language SQL is introduced which helps to access data more efficiently and quickly.

5. Multiple users can access the data simultenously and DBMS system will take care the conflicts.

6. The dependent tasks can be controlled with transaction management facility of the DBMS.

For example:- Transfering the cash from one account to second account consits of withdrawing the amount from one account and deposit in other. What if the application fails after the withdrawl so DBMS system will rollback the withdrawl automatically

How to Start a Conversation with New People

Start with a “hello,” and simply tell the new person your name then ask them theirs. Offer your hand to shake, upon his/her responding to you. (If you go to other countries, greet the person in tune with the particular culture). If you already know the person, skip this step and proceed to step.

Look around. See if there is anything worth pointing out. Sure, talking about the weather is a cliche, but if there’s something unusual about it–bam!–you’ve got a great topic of conversation.

Offer a compliment. Don’t lie and say you love someone’s hair when you think it’s revolting, but if you like his or her shoes, or a handbag, say so. A sincere compliment is a wonderful way to get someone to warm up to you. But be careful not to say something so personal that you scare the person off or make him or her feel uncomfortable. It is best not to compliment a person’s looks or body.

Ask questions! Most people love to talk about themselves — get them going. “What classes are you taking this year?” “Have you seen (Insert-Something- Here)? What did you think of it?” Again, keep the questions light and not invasive. Do not ask too many questions if he or she is not responsive to them.

Jump on any conversation- starters he or she might offer; take something he or she has said and run with it. Agree, disagree, ask a question about it, or offer an opinion, just don’t let it go by without notice.

Look your newfound friend in the eye, it engenders trust (but don’t stare). Also, use the person’s name a time or two during the conversation; it will help you remember the name, and will draw the person’s attention to what you are talking about.

Don’t forget to smile and have fun with your conversation!

Tips

Just relax. Chances are that whatever small-talk you’re making isn’t going to stick out in anyone’s mind a few months from now. Just say whatever comes into your head, so long as it’s not offensive or really weird. (Unless, of course, the person you’re attempting to converse with is into weird stuff.)
Remember, if you think of something in your head while you’re talking, it’s probably related.

It will help if you watch some TV, listen to radio shows, and/or read a lot — newspapers, magazines, and/or books. You need to have some idea of what is going on in the world. Also remember and plan to share anything you like, think is funny, or find intriguing. This is building up your own library of things that might be helpful to another person during a conversation someday. It will be amazing how you thread these interesting things when you least expect it, and make conversation an adventure instead of a dreadful task. If you take it to the next step and say things that you want the person to think of as adding value, and keep to yourself things that the person might not, you are actually honing your own personality to be appealing to the other person, and what is a greater act of kindness than that.
If you are shy, it will be helpful to have thought about a topic or two that you could talk about.

Follow the lead that your listener is expressing. If he or she appears interested, then continue. If he or she is looking at a clock or watch, or worse, looking for an escape strategy, then you have been going on for too long.
Interesting and funny quotes or facts can lighten things up, and make way for things to talk about. You could also use a set of conversation starter question cards for inspiration.

If talking over the phone, keep the person involved in the conversation at all costs. If you can’t come up with a good topic, try the “questions” game. Just keep asking them questions; random questions work just fine as long as they are appropriate. This technique can save a phone conversation. The questions should be open ended questions that do not require a yes or no answer. For example “How do you know the hosts?” This way you can ask questions about what they just said or follow up with how you know the hosts (for example) instead of acting as if the conversation is an interrogation.

Half of an effective conversation is the way you non-verbally communicate, and not necessarily what you say. Practice better non-verbal skills that are friendly and confident.

Read newspapers and magazines to increase your knowledge so you can have more interesting things to talk about.

Happy Talking..