Sunday, February 10, 2008

Introduction to SQL

SQL is an acronym for structured query language and it is a language designed specifically for accessing databases to read or write data. SQL databases are the most popular type since it is incredibly versatile and easy to use. Most people use them for websites, although they are also used for non-web applications.



Several popular SQL packages exist, but the most popular is mySQL, which is open source. Microsoft also provides SQL server software, but it is rather expensive. For security and cost reasons, mySQL is probably the best choice if you plan to use SQL for web design.

With SQL, you can create as many databases as you like. Inside of a database, there are objects called tables. Inside of tables, there are objects called rows that have columns containing different types of information. For example, you could design a table so that each row has a column with an integer, some text, and a category. Designing a table is like designing a class in C++ or Java, since you are essentially creating variables that can be different for each individual instance of an object.

The variety of SQL commands gives the software a lot of capibilities. You can, for example, query a database and have it only return rows in a table that have a certain value for their category. This way, you can easily access information of varying types within a single table. It also allows you to create dynamic pages using PHP. Instead of hardcoding links to every single object in a table, like you would have to do in HTML, you can write code the queries the table for certain values and automatically creates links. In the end, this can save the website designer thousands of hours of work.

What is SQL?

* SQL stands for Structured Query Language
* SQL allows you to access a database
* SQL is an ANSI standard computer language
* SQL can execute queries against a database
* SQL can retrieve data from a database
* SQL can insert new records in a database
* SQL can delete records from a database
* SQL can update records in a database
* SQL is easy to learn

SQL is a Standard - BUT....

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. SQL works with database programs like MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase, etc.

Unfortunately, there are many different versions of the SQL language, but to be in compliance with the ANSI standard, they must support the same major keywords in a similar manner (such as SELECT, UPDATE, DELETE, INSERT, WHERE, and others).

Note: Most of the SQL database programs also have their own proprietary extensions in addition to the SQL standard!


SQL Data Manipulation Language (DML)

SQL (Structured Query Language) is a syntax for executing queries. But the SQL language also includes a syntax to update, insert, and delete records.

These query and update commands together form the Data Manipulation Language (DML) part of SQL:

  • SELECT - extracts data from a database table
  • UPDATE - updates data in a database table
  • DELETE - deletes data from a database table
  • INSERT INTO - inserts new data into a database table

Read More......