Friday, 30 March 2012

Introduction to SQL

SQL is a standard language for accessing and manipulating databases.


What is SQL?
  • SQL stands for structured query language
  • SQL lets you access and manipulate databases
  • SQL is an ANSI (American National Standard Institute) standard
What can SQL do?
  • SQL can execute queries against a database
  • SQL can retrieve data from a database
  • SQL can insert records in a database
  • SQL can update records in a database
  • SQL can delete records from a database
  • SQL can create new database
  • SQL can create new tables in database
  • SQL can create stored procedures in a database
  • SQL can create views in a database
  • SQL can set permissions on tables, procedures, and views
SQL is a standard - BUT

Although SQL is an ANSI(American National Standard Institute) standard,there are many different versions of the SQL language.

However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT,UPDATE,DELETE,INSERT,WHERE) in a similar manner.

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


Using SQL in Your Web Site

To build a web site that shows some data from a database,you will need the following:

  • An RDBMS database program (i.e MS Access, SQL server, MySQL)
  • A server-side scripting language,like PHP or ASP
  • SQL
  • HTML / CSS

RDBMS :

RDBMS stands for relational database management system.

RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.

The data is RDBMS is stored in database objects called tables.

A table is a collection of related data entries and it consists of columns and rows.





Thursday, 29 March 2012

Installing MySQL on Windows


In this section you will learn how to install MySQL 5.0 on windows system. The MySQL 3.21 was the first version for the windows. Windows installer of MySQL includes auto installer with Configuration Wizard that support for easy installation.
MySQL Installing packages
The MySQL Installing packages comes in three flavors, you can choose any of the Installer package as per your requirements and your expertise level. These packages are:
  1. The Essential packageThe  Essential package has a Similar filename to MySQL-essential-5.0.25-win32.msi and it contains the minimum set of files needed for installation MySQL on Windows, including the Configuration Wizard except embedded server and benchmark suite. This package is recommended most of the users as the user can  install multiple instances of MySQL on a single server host and the advanced user can complete control over server configuration.
      
  2. The Complete packageThe complete package has all the needed files that are required for windows installation including configuration wizard, embedded server and bench mark suite. This package has a similar filename to  MySQL 5 . 0 . 25- win32 zip . For using it, your system must have a tool that can unpack .zip files.
     
  3. The Noinstall ArchiveThe Noinstall archive package has a similar filename to mysql-noinstall-5.0 .25 -win32 . zip. This package contain all the needed set of  files  for a complete installation wizard excluding all the configuring wizard. This package has a facility of  installing manually not automatically. For using this package, there must be a tool for unpacking .zip files in your system. 
Downloading MySQL 
The latest version of MySQL can be downloaded from http://www.mysql.com. In this tutorial we are using mysql-essential-5.0.24a-win32.msi, which is the latest version of MySQL at the time of writing the tutorial. You download the windows installer from http://www.mysql.com and save on your hard disk.
Understanding the MySQL Installation wizardMySQL Installation Wizard uses the new installer technologies for Microsoft Windows. And that?s why it is an installer for MySQL server. This MySQL installation wizard is combined with the MySQL configuration wizard which allows user to install and configure a MySQL server, and it can be used immediately after installation. MySQL provide the standard installation for all MySQL Server distribution or higher version 4. 1. 5 . In this version MySQL need to shout down and remove their existing MySQL installation and manually installation before the MySQL wizard.  This installation process use of this technology to provide a smoother and flexible process.
MySQL Installing TypeThere are three type of MySQL Installation:-

  • Typical 
    This MySQL installing process install the  MySQL server,command- line client and command line utilities. This command line and command client included in mysqldump, myisamchk and several tools to manage the MySQL Server.
      
  • Complete
    By this installation type we install all the component included in the installation package. And this package include the component such as support script, the embedded server library. MySQL complete installer also included the benchmark suit and documentation.
      
  • Custom
    MySQL is use Custom installation type command that provide you the complete control over package that you want to install and also the installation path. If you choose the Custom type then you can change the installation path or components , which is installed by Installation Wizard
MySQL Installation Wizard made some ChangesMySQL installation wizard can begin the process of installation only after clicking the Install button and make some changes to your system that describe in the following section -
Change to the Registry:MySQL installation wizard generate one windows registry key in the situation of typical installation, that is located in HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.MySQL Wizard generates a key that is named after the major version of server which has been installed, like MySQL Server 5.0. It has two String values one is Location and another is Version. The location has the path to installation directory. And the version has the release number.
MySQL used these registry keys to help external tools to identifying the installed location of the MySQL server. This Registry keys does not required to run server and you want to install MySQL using thenoinstall zip archive, then the registry keys are not created .
Change to the Start Menu:MySQL installation  wizard create a new entry in the start menu windows. This MySQL menu heading named after the major version of MySQL that you have to installed. There are some entries are created with in the new start menu section :
MySQL command Line Client: This is shortcut for the MySQL command - line client and is configured to connect the root user. The shortcut prompts for a root user password when  you connected .

MySQL server instance configuration wizard: 
This is a shortcut for the Configuration wizard . For configuring the new server or reconfiguring the existing server you can use this shortcut.

MySQL Documentation: MySQL Documentation is the link to the MySQL Server documentation and it is stored in the installation directory. But if you have installed the Essential installation package then this option is not available.
 
Change to  the file System: 
By default the MySQL server installs to C:\Program File\MySQL Server 5.0 location. On a developer machine a typical MySQL installation can be look like this :

C:\Program Files\MySQL\MySQL Server 5.0
C:\Program Files\MySQL\MySQL Administrator 1.0
C:\Program Files\MySQL\MySQL Query Browser 1.0
MySQL Testing the Installation 

C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqlshow"
C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqlshow" -u root mysql
C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" version status proc
C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql" test
MySQL Downloading and Installing wizardThis installation package can be download from http://dev.mysql.com/downloads/. But you have to extract this zip archive first. If there is setup.exe is available then double click on this file for starting the installation. But if there is an .msi available then double click on this

Basics Of MySQL


MySQL is a open source Relational Database Management System. MySQL is very fast reliable and flexible Database Management  System. It provides a very high performance and it is multi threaded and multi user Relational Database management system.
MySQL is one of the most popular relational database Management System on the web. The MySQL Database has become the world's most popular open source  Database, because it is free and available on almost all the platforms. The MySQL can run on Unix , window, and Mac OS. MySQL is used for the internet applications as it provides good speed and is very secure. MySQL was developed to manage large volumes of data at very high speed to overcome the problems of existing solutions. MySQL can be used  for verity of applications but it is mostly used for the web applications on the internet.  
MySQL Features
  1. MySQL are very fast and much reliable for any type of application.
  2. MySQL is very Lightweight application.
  3. MySQL command line tool is very powerful and can be used to run SQL queries against database. 
  4. MySQL Supports indexing and binary objects.
  5. It is allow changes to structure of  table while server is running.
  6. MySQL has a wide user base.
  7. It is a very fast thread-based memory allocation system. 
  8. MySQL Written in C and C++ language. 
  9. MySQL code is tested with different compilers.
  10. MySQL is available as a separate program for use in a client/server network environment.
  11. The MySQL available for the most Unix operating platform.
  12. MySQL are the available for window operating system window NT, window 95 ,and window 98.
  13. MySQL available for OS/2.
  14. Programming libraries for C, Python, PHP, Java , Delphi etc. are available to connect to MySQL database.
MySQL Advantages:

Reliability and Performance 
MySQL is very reliable and high performance relational database management system. It can used to store many GB's of data into database.
Availability of Source MySQL source code is available that's why now you can recompile the source code.

Cross-Platform support
MySQL supports more then twenty different platform  including the major Linux  distribution .Mac OS X ,Unix and Microsoft windows.

Large pool of Trained and Certified Developers
MySQL is very popular and it is world most popular open source Database. So it is easy to find high quality staff around the world.

Powerful Uncomplicated software 
  The MySQL has most capabilities to handle most corporate database application and used to very easy and fast
MySQL 5 Features
There are three feature of MySQL 5.0 version:-

  • Views
    Views is a virtual table which acts as a table but it contains no data. Views are created using columns from one or more tables.
      
  • Stored Procedures and Functions
    MySQL 5.0 now support Stored Procedures and Functions. This allows you to embed business logic at database level.
      
  • Triggers
    The Triggers is another very imported feature available with MySQL 5.0. Now can add some business logic whenever data is inserted, Deleted or updated in the table.                                                              
  • Installing MySQL on Windows