Sequential Query Language
Database Networking Using SQL
Sequential query language (SQL) is used in combination with a SQL database server to store and access data over large networks quickly, efficiently, and securely. This paper aims to define SQL in simple and understandable terms in order to relate how SQL is implemented and used in a network environment. The scope of this paper is limited to a basic understanding of what SQL is and how it relates to networking. For a better understanding of SQL server processes see the reference section at the end of this paper for further study.
2007
William Butterfield Kent State University 9/2/2007
Defining SQL
SQL, pronounced “sequel” or “S-Q-L” by some, is a programming language used to access data stored in a network database such as MS SQL or MySQL. SQL is an acronym for “sequential query language”. If you are not familiar with relational databases, SQL commands are used to generate snapshots of data within SQL database tables by issuing queries. A query is an inquiry request by a user into a database table in which the computer searches the particular information requested. SQL uses simple terms such as “SELECT”, “INSERT”, or “DELETE” to access data in a database table. For example, if I had a table that consisted of one thousand people, separated by their first and last names, I could query the table to find all of the people with the first name of “Bob” by using the SELECT command. Conversely, I could delete all instances of the name “Bob” by using the DELETE command. I could also insert a new “Bob Smith” by using the INSERT command. SQL is a very popular network database language because SQL database engines are freely available to download and are more efficient to use across medium and large size networks than stand alone database programs such as Microsoft Access.
Example of a SQL Query Statement:
The above example shows the language of SQL used to access and display customer information from a database object (DBO) called customers. All of the database table fields that have been requested by the statement follow the SELECT statement. The condition, TOP 100 PERCENT, means that all of the records found will be displayed. Lastly, this statement specifies two additional conditions to display the data. First, customers that have a preexisting condition that they should not be listed are not shown (i.e. WHERE (do_not_list = 0), and the list will be ordered alphabetically by customer name.
In order to run this statement, a SQL server database engine, sometimes referred to as a SQL server or SQL database engine, is required to run the query on the database. SQL servers are software programs that run on a computer. Most SQL servers do not require any special hardware requirements and can run on virtually any computer platform. Once the SQL server software is installed and an instance of SQL server is running on the computer, SQL statements can now be created and run to retrieve information from the database. Above is an example of the icon displayed in the system tray of a Windows 2003 Server running an instance of MS SQL Server 2005 Express Edition and the accompanying fly-out information that states that the SQL services are currently ready to accept commands running on this machine.
Requirements for Using SQL
Since SQL is essentially a programming language used to access a database, several related items become necessary to use and implement SQL. First, SQL needs a database to access. Two very commonly used SQL database engines are MS SQL 2005 Express Edition and MySQL. Both are free to download and provide basic functionality. The Microsoft SQL database engine provides a stripped down version of their full blown enterprise version that provides additional reporting and logging services for heavy duty transactional servers. The MySQL AB version is an open source and completely modifiable version of the same database architecture, and provides an enterprise version for a sale as well.
Once a SQL database engine is chosen and installed, a SQL database interface needs to be installed to set up individual databases and tables and to secure the data from unauthorized users. Database management software is often coupled with the database engine download from Microsoft or MySQL AB. To the left is a screenshot of SQL Server Management Studio Express which is an excellent database interface and can easily be used to set up and administer SQL databases.
Lastly, to provide a visual way for displaying the data stored in the database, one needs to use some sort of networking platform for displaying the data. One common solution is to use Microsoft Visual Studio. This program assists the database developer in creating intranet or internet sites that connect to the SQL database engine to display the data in web browsers. Using Visual Studio will help create the necessary web pages, but the developer will need an additional web server component to broadcast the site across the network. An easy solution to this is to download Apache. Apache is a free web server engine that will run on just about any platform,
however, for people with a Windows 2000 Professional, XP Professional, or Windows Server 2003 machines, Internet Information Services (IIS) is made available to use by Microsoft as part of the operating system.
SQL Server Network Requirements
To make things easier for developers, there are many sites that offer a comprehensive collection of all of these tools for free in one inclusive download. To download all of the necessary components and get up and running a SQL server on a Windows machine or Linux machine quickly, several web sites make this process quick and easy. Many of these types of web sites have download links for “WAMP” servers or “LAMP” servers. A WAMP server download is a “package” designed to integrate on a Windows machine an Apache Web Server, MySQL database engine, and PHP web server services for dynamic web page execution. A LAMP server package will setup the components on a Linux computer. Below are two web sites for obtaining these packages:
http://www.wampserver.com/en/download.php
http://www.devside.net/server/webdeveloper
Database Essentials
•SQL Server Database Engine
•SQL Server Database Management Tool
•Examples include: MS SQL 2005 Express Edition and SQL Server Management Studio Express, both are free to download.
Network Essentials
•Establish a database interface for users to view the data
•Using a web development tool such as Visual Web Studio is easy and free to download.
•If creating a SQL database for network use, your computer needs to be running a web service such as Apache or IIS.
Options
•Full blown packages for free are available to dowload and install on both Windows and Linux computers •WAMP servers: Windows, Apache, MySQL, PHP
•LAMP servers: Linux, Apache, MySQL, PHP
Everything that has been listed so far is available to download on the internet for free. There are, however, many retail programs for sale that can assist in SQL database development and deployment such as Adobe ColdFusion (formerly made by Macromedia), Oracle, Microsoft SQL Enterprise Edition, as well as many others. These are often cost prohibitive for most enthusiasts or students, but do provide much more flexibility and functionality for network database intensive development and deployment.
Database Networking
SQL server databases are often used in medium to large network situations. Stand alone databases can be used across networks on very small networks of four to five computers in limited capacities without many problems. However, if the data in the database is being accessed by more than five users
simultaneously it becomes increasingly necessary from a speed and database integrity standpoint to rely on the stability and reliability of a SQL database engine. The reason why is because SQL database engines protect data from network problems, such as data packet collisions on the network, by acting as a traffic controller and central manager of the information. By acting as the single point of entry it keeps the data safe from corruption by multiple requests being implemented at exactly the same time. In this manner, requests for the data are queued and implemented one at a time. A SQL server timestamps each transaction that occurs in the database table in case a major problem arises or if a conflict takes place and it needs to decide what to do. For example, if two users access the same record at the same time, and each save different information to that record, SQL will choose a “winner” and a “loser” for that particular record. Only the winner’s data will be written to the master database table and an error message will be sent to the “loser” indicating that their record was not saved to the database table. Across large networks of hundreds and even thousands of people accessing a database, this can be extremely helpful in making sure that database tables do not get corrupted or that information does not get accidentally changed.
SQL servers are often confused by the uninformed as large machines that only large corporations can afford to buy. This is far from the truth. SQL server software can be installed and run on virtually any computer today and can be helpful to create, access, and organize information with the flexibility of collecting the simplest of data to complex multidimensional tables of related information. If you are not experienced with relational databases, I suggest looking into Microsoft Access. Additionally, an
excellent learning manual to accompany your learning process is the Access 2007 Bible, by Groh, Stockman, Powell, Prague, Irwin, and Reardon. In my opinion, the Access 2002 Bible covers SQL database implementation in greater depth than the 2007 republication, but may be harder to find than the 2007 release. If you have used dynamic (interactive) web sites in the past, most likely they are driven by accessing backend SQL server databases. Within the professional world, many groups including businesses, educational institutions, and government agencies are turning toward intranet sites that collect information in SQL databases to share, collect, and update information in real time. SQL allows us to efficiently and securely provide network users the ability to interact with information in more meaningful ways than the static displays of database tables. As the internet continues to become more dynamic and interactive, the use of SQL server databases will become increasingly popular to use and connect network users to the information requested by web site visitors.
References
1. Cary N. Prague and Michael R. Irwin. Access 2002 Bible. Indianapolis, Indiana: Wiley Publishing, 2001.
2. Julie C. Meloni. Sams Teach Yourself PHP, MySQL, and Apache. Indianapolis, Indiana: Sams Publishing, 2004.
3. Michael R. Groh, Joseph C. Stockman, Gavin Powell, Cary N. Prague, Michael R. Irwin, and Jennifer Reardon. Access 2007 Bible. Indianapolis, Indiana: Wiley Publishing, 2007.
4. Mike Gunderloy and Susan Harkins. Mastering SQL Server 2005 Express Edition. Indianapolis, Indiana: Wiley Publishing, 2006.