mSQL Tutorial 1
The "Create" Clause
The create clause in mSQL creates a table in your
database. If don't yet have a database created please contact us and we'll get
you set up.
To create a table you would do the following:
CREATE TABLE table_name (
col_name col_type [not null
[ , col_name col_type [not null
)
An Example:
CREATE TABLE emp_details(
first_name char(15) not null,
last_name char(15) not null,
dept char(20),
emp_id int primary key,
salary int
)
|
In this example we are creating a table named
"emp_details" (Employee Details). We are defining the
first and last names and giving them the type "char"
(character) with a length of 15 and a "not null"
attribute.
We are defining the "dept" (Department) as a 20 length
character type.
Finally we are defining the "emp_id" (Employee ID) as
an integer and assigning it as the primary key. We also define
the "salary" field as an integer.
Having done this we are ready to insert
some data into these fields.
|