March 3rd, 2010

Why is Relational Better?

Posted by admin in A. Relational Database Basics

Relational Model

The table (row and column) structure is easy for users to understand. The relational database model, as implemented by “Codd’s 12 rules,” has gained wide acceptance by vendors.

SQL Standards

SQL is an open standard and is not “owned” by any company. The standard is established by the American National Standards Institute (ANSI) under the joint leadership of the International Organization for Standardization (ISO) and the International Engineering Consortium (IEC).

Like English, Easy to Learn

Compared to some other programming languages, SQL is easy to learn. An SQL statement reads like a sentence.

Nonprocedural

If you have never done programming before, this point is of little consequence: It means that when you do a query, all of the data results are returned to you at once, instead of giving you one row (or record) at a time.

Interactive or Embedded

With interactive SQL, you issue SQL commands directly to the graphical- or command-line tool of DBMS, which displays the results as soon as they are produced. If you are writing an application, you can embed the SQL in the host programming language such as C++, COBOL, Java, Perl, PHP, or Python. You can use SQL in a PHP CGI script to query a MySQL database.

Multiple Views of Data

The person that created the database can give different views of the database to different users. For example, an employee from the payroll department might be restricted to only payroll data. Also, data from multiple tables can be combined into one table presentation.

Dynamic Data Definition

With SQL, the structure of the database can be changed dynamically while users are accessing the database. This means that SQL can create a database, control security, retrieve data, change data, and share data with many users simultaneously.

Client/Server Database

A central computer called the server is accessed from a local area network (LAN) or a wide area network (WAN). PCs, called clients, are used to access the server. These client/server networks are generally not accessible to the general public.

Web-Based Database

Customers are able to use PCs with internet browsers to access a web site available to the general public. They may need to log in (if required) to access a database. SQL is executed by the web application and returns data to the web server where it is returned to the internet browser for the customer’s use.

March 2nd, 2010

Many-to-Many Relationships

Posted by admin in A. Relational Database Basics

In a many-to-many relationship, each row in Table A can have zero, one, or many matching entries in Table B and Table B can have zero, one, or many matching entries in Table A. There are two ways to create a many-to-many relationship:

> Two tables can be joined together. See JOIN.
> You can create a third table called a junction table whose primary key is a composite of the keys from Table A and Table B. This creates a unique key for the junction table and changes these keys to a one-to-many relationship.

March 1st, 2010

One-to-Many Relationships

Posted by admin in A. Relational Database Basics

In a one-to-many relationship, each row in Table A can have zero, one, or many matching entries in Table B. However, Table B has only one matching entry in Table A. A one-to-many relationship exists when the primary key of Table A matches a foreign key in Table B.

Next Page »