GAMES
  UTILITIES
  PALM PILOTS
 SCREENSAVERS
 BUSINESS
 GRAPHICS
 INTERNET
 MAC
 AND MORE!

PC Magazine

  PC Tech

SQL: The Universal Database Language

Introduction

What is SQL?

What is a Relational Database System?

Relational Model Basics

SQL and the Relational Model

Static and Dynamic SQL

SQL Tutorial

FIGURE 1: CREATE TABLE Syntax

SIDEBAR: What's in a Name?



X10.com - The SuperSite for Home Automation!

NextCard Visa- 2.9% intro APR -Apply Now

 
  Category
Software

Related Stories
Handling Data with SQL
-- 11/17/98

Next: SQL Tutorial

SQL: The Universal Database Language
Static and Dynamic SQL

Continued from SQL and the Relational Model

Now that you know a little about the relational model, we're going to ask you to forget about it. Well, not really, but at this point we should explain that even though SQL is based on Codd's relational model, it is not a full or faithful implementation of it. (That's one reason the SQL-92 standard doesn't mention relations.) For example, a SQL table is not exactly the same as a relation, because among other things, a SQL table allows duplicate rows and relations don't have duplicate tuples. Also, SQL doesn't support relational domains, although it does support data types to some extent. (Several prominent relational advocates are lobbying to include relational domains in a future SQL standard, however.)

Unfortunately, the disparity between SQL and the relational model has caused a lot of confusion and debate over the years. Since the focus of this article is to teach you about SQL, not relational theory, we won't discuss all of the discrepancies here. For now, you just need to know that because there are differences, relational terms and SQL terms are not always interchangeable. From now on, we'll only use SQL terminology. Instead of relations, attributes, and tuples, we'll refer to their SQL counterparts: tables, columns, and rows.

Static and Dynamic SQL

You may have heard the terms static SQL and dynamic SQL. SQL is static when it is compiled and optimized prior to execution. We've already mentioned one form of static SQL when we talked about "embedding" it in C or COBOL applications. (This is also known as embedded SQL.) As you may have guessed, dynamic SQL is compiled and optimized during execution. Most end-user tools use dynamic SQL, because it enables you to write ad hoc queries. One way of executing dynamic SQL is through interactive or direct invocation (also known as directSQL), where the SQL statements are executed interactively from a terminal. There are some differences in syntax and behavior between static and dynamic SQL, but we don't need to go into them here. The main point is that for the sake of simplicity, we will give our examples in direct SQL, since more people--nonprogrammers as well as programmers--can learn SQL that way.

Next: SQL Tutorial

Published as PC Tech Feature in the 11/3/98 issue of PC Magazine.

Elsewhere on ZDNet
Learn SQL Online -- ZD University
Business Software: Databases -- ZD Products

 
 SPONSORED LINKS
@Backup   Your Solid Online Backup Plan. Download Now.
Services   9c/MINUTE LONG DISTANCE, 5c/MINUTE ON SUNDAYS!
STORAGE   Quantum means non-stop business, 24 hours a day
Software   X10.com -- The SuperSite for Home Automation
Books   Bargain Books up to 90% off at barnesandnoble.com
 ZDNET FEATURED LINKS
Downloads   Check out the best new downloads in Reviewer's Raves
Bargains!   Shop the Basement for best buys on computer products
Free Help   Got computing questions? ZDHelp has all the answers!
 MAGAZINE OFFERS
Free Offer   Get a FREE SUBSCRIPTION to Inter@ctive Week

TOP
Copyright (c) 1998 Ziff-Davis Inc.