Introduction to Structured Query Language

Submitted by: Submitted by

Views: 466

Words: 8947

Pages: 36

Category: Science and Technology

Date Submitted: 02/07/2012 07:00 AM

Report This Essay

Introduction to Structured Query Language

Version 3.53

By: Jim

Hoffman

jhoffman@one.net.

Introduction

This is a tutorial of the Structured Query Language (also known as SQL) and is a pioneering effort on the World Wide Web, as this is the first comprehensive SQL tutorial available on the Internet. SQL allows users to access data in relational database management systems, such as Oracle, Sybase, Informix, Microsoft SQL Server, Access, and others, by allowing users to describe the data the user wishes to see. SQL also allows users to define the data in a database, and manipulate that data. This document will describe how to use SQL, and give examples. The SQL used in this document is "ANSI", or standard SQL, and no SQL features of specific database management systems will be discussed until the "Nonstandard SQL" section.

Comments or suggestions? Mail me at jhoffman@one.net.

Copyright 1996-1998, James Hoffman. This document can be used for free by any Internet user, but cannot be included in another document, published in any other form, or mass produced in any way.

Last updated: 1-10-1998; miscellaneous tasks.

Table of Contents

Section 1 1.1 1.2 1.3 1.4 1.5 1.6 Section 2 2.1 2.2 2.3 2.4 2.5 Section 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 Section 4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 Indexes GROUP BY & HAVING More Subqueries EXISTS & ALL UNION & Outer Joins Embedded SQL Common SQL Questions Nonstandard SQL Syntax Summary Aggregate Functions Views Creating New Tables Altering Tables Adding Data Deleting Data Updating Data Joins Keys Performing a Join Eliminating Duplicates Aliases & In/Subqueries Basics of the SELECT Statement Conditional Selection Relational Operators Compound Conditions IN & BETWEEN Using LIKE

Section 1.1

Basics of the SELECT Statement

In a relational database, data is stored in tables. An example table would relate Social Security Number, Name, and Address: EmployeeAddressTable SSN 512687458 758420012 102254896 876512563...