Friday, April 3, 2009

SQL




Introduction



The standard in the industry for interacting with RDBMS (Relational Database Management System) is through Structured Query Language (SQL). It is not a programming language like COBOL or Java. SQL is a sublanguage, and it can process sets of data as groups unlike programming language.(1)

Using SQL statements, users can instruct the DBMS to create, modify tables, enter and maintain data, and retrieve data for a variety of situations. These commands or statements let users perform interactive searches and set environmental variables.(1)

Two industry-accepted committees set the industry standards for SQL: the American National Standards Institute (ANSI) and the International Standards Organization (ISO).(1)




Examples



  • An example code used in SQL to create a table is as follows:

CREATE TABLE STATION
(ID INTEGER PRIMARY KEY,
CITY CHAR(20),
STATE CHAR(2),
LAT_N REAL,
LONG_W REAL); (2)

This will create a table called: STATION with columns: ID, City, State with Latitude and Longitude coordinates.

  • Another example of SQL code is:
SELECT ID, CITY, STATE FROM STATION
WHERE LAT_N > 39.7;

This will display the following columns: ID, CITY, STATE from the STATION table where the Latitude Coordinate is higher than 39.7 (2)





(1)
http://www.itl.nist.gov/div897/ctg/dm/sql_examples.htm#create%20table
(2) Oracle 9i: SQL Lannes L. Morris-Murphy

No comments:

Post a Comment