Logo
Home More Free Tutorials Educational Resources

Basic SQL Commands

If you need an introduction to basic SQL commands, this is the site. Our free online SQL tutorial covers SQL syntax and is an excellent SQL command reference. Take our tutorial and learn the SQL command language.

Table of Contents

Creating Tables

You must create your tables before you can enter data into them. Use the Create Table command.

Syntax:

Create table tablename using filename
(fieldname fieldtype(length),
fieldname fieldtype(length),
fieldname fieldtype(length));

Explanation:

  • Table names cannot exceed 20 characters.
  • Table names must be unique within a database.
  • Field names must be unique within a table.
  • You may specify the data file to use. If you do not specify a data file, Scalable SQL will create one, using a .dat extension.
  • The list of fields must be enclosed in parentheses.
  • You must specify the field type.

Examples:
Char -- a character string 
Float -- a number 
Date -- a date field 
Logical -- a logical field

  • You must specify the field length.
  • The field length must be enclosed in parentheses.
  • You must separate field definitions with commas.
  • You must end each SQL statement with a semicolon.

Example:

Create tables TrnVendor and TrnAPDoc. We will use these tables in the exercises that follow: 

  1. In the SQL text box, type:

Create table TrnVendor using 'TVendor.dat'
(VendId char(10),
Name char(30),
Add1 char(30),
City char(30),
State char(3),
CurrBal float(8),
ExpAcct char(10));

Create table TrnAPDoc using 'TAPDoc.dat'
( VendId char(10),
RefNbr char(10),
DocDate date(4),
OrigDocAmt float(8),
CuryDocBal float(8),
OpenDoc logical(2));
 

  1. Execute the commands. To create the first table, click on First, the Run button located to the right of the SQL text box.
  2. You should receive the following message:

Scalable SQL informative status = -105. The CREATE statement completed successfully.

  1. Click on Next to create the second table.
  2. You should receive the following message:

Scalable SQL informative status = -105. The CREATE statement completed successfully. 

Click on Stop to return to the original screen.

Table of Contents

 

 

Our Free Tutorials Word Basics 2007 Word Basics 2003/2002 Word Basics 97 Excel Basics 2007 Excel Basics 2003/2002 Excel Basics 97 PowerPoint Basics Windows Vista Tutorial Windows XP Tutorial Windows 98 Tutorial Scalable SQL -- A Tutorial RealSlideshow for RealPlayer Guide to Paint Shop Pro Flash Photoshop
Google
Web
www.baycongroup.com

Online Learning University of Phoenix - Obtain a Degree in Information Technology Online or on Campus. Click Here! The Art Institute of Pittsburgh -- Online Division - Learn Graphic Design Online. Click Here! DeVry University - Earn a Bachelor's Degree Online or on Campus. Click Here!
 
 
 
Legal Privacy
Copyright©1999-2008 Baycon Group, Inc. All Rights Reserved