|
SQL Home
SQL TutorialIntroductionSQL Syntax SQL Select SQL Where SQL Order By SQL Top SQL Distinct SQL In SQL Alias SQL Join SQL Inner Join SQL Outer Join SQL Insert SQL Update SQL Delete SQL Functions SQL Count SQL Create SQL Create Database SQL Create Table SQL Create Index SQL Alter Table SQL Summary Got a MySpace Page?Get "www.yourname.com" for your MySpace page. Learn how >>. |
SQL Create TableYou create a table using the CREATE TABLE command. SQL syntax
Example
ResultThis results in an empty table. You can now use an INSERT statement to add data to the table.
Data TypesYou'll notice we explicitly stated the data type in our CREATE TABLE statement. This is because, when you create a column, you need to tell the database what type of data it can hold. The exact data types and how their expressed differs with each database system and vendor, but you'll find that generally, there will be support for fixed length strings (eg char), variable length strings (eg varchar), date/time values (eg datetime), numbers and integers (eg, bigint, int, smallint, tinyint, numeric). The following base data types are available in SQL Server 2000.
You may need to consult your database system's documentation if you're unsure of which data type to use or how it is expressed in that system. Next, we learn how to create an index for our table with the CREATE INDEX command. Enjoy this website?
Oh, and thank you for supporting Quackit! |
FREE Hosting!With every domain name you register with ZappyHost, you get FREE (ad supported) hosting.PLUS you get:
Featured Template:
(Build your websites in minutes!) |