The CREATE TABLE Statement
The CREATE TABLE statement is used to create a table in a database.
SQL CREATE TABLE Syntax
CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type, .... ) |
The data type specifies what type of data the column can hold. For a complete reference of all the data types available in MS Access, MySQL, and SQL Server, go to our complete Data Types reference.
CREATE TABLE Example
Now we want to create a table called "Persons" that contains five columns: P_Id, LastName, FirstName, Address, and City.
We use the following CREATE TABLE statement:
CREATE TABLE Persons ( P_Id int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) ) |
The P_Id column is of type int and will hold a number. The LastName, FirstName, Address, and City columns are of type varchar with a maximum length of 255 characters.
The empty "Persons" table will now look like this:
P_Id | LastName | FirstName | Address | City |
---|
| | | | |
The empty table can be filled with data with the INSERT INTO statement.
I have read so many articles regarding the blogger lovers except this paragraph
ReplyDeleteis genuinely a fastidious article, keep it
up.
Here is my weblog :: minecraft demo
naturally like your web site however you have to test the spelling on quite a few of
ReplyDeleteyour posts. A number of them are rife with spelling problems and
I to find it very bothersome to tell the reality however I'll
certainly come again again.
My webpage ... quest bars
You are so interesting! I do not think I've truly read
ReplyDeleteanything like that before. So wonderful to discover another person with a few original thoughts on this topic.
Really.. many thanks for starting this up. This
site is something that is needed on the web, someone with some originality!
Here is my webpage Diet Plans for Women to Lose Weight
This piece of writing is really a good one it helps new net
ReplyDeleteviewers, who are wishing for blogging.
My site; Lose Weight for Women
Howdy! This blog post could not be written much better! Looking through this article reminds me of my
ReplyDeleteprevious roommate! He continually kept preaching about this.
I most certainly will forward this post to him. Fairly certain he's going to have a very good read.
Thanks for sharing!
Here is my page: Diet Plans to Lose Weight
It's awesome in support of me to have a web site, which is good in support of my know-how.
ReplyDeletethanks admin
Here is my blog post - Diet Plans to Lose Weight
It's genuinely very complex in this busy life to listen news on TV, therefore I just use world wide
ReplyDeleteweb for that purpose, and obtain the most up-to-date news.
Here is my web-site: coconut oil for hair