Simple tutorial for SQL statements in linux --- CREATE TABLE, simple tutorial --- create

Source: Internet
Author: User

Simple tutorial for SQL statements in linux --- CREATE TABLE, simple tutorial --- create

A table is the basic architecture for storing data in a database. In most cases, the database vendor cannot know how to store your data. Therefore, you usually need to create tables in the database. Although many database tools allow you to create tables without using SQL, since tables are the most basic architecture, we decided to includeCREATE TABLEIn this website.

Jump inCREATE TABLEBefore using the syntax of table, we 'd better have a better understanding of table. The table is divided into column and row ). Each column represents a piece of data, and each column represents a part of the data. For example, if we have a table that records customer data, the column may include the surname, name, address, city, country, birthday... and so on. When defining a table, we need to specify the title of the column and the category of the column.

So what is the type of data? Materials may exist in many different forms. It may be an integer (such as 1), a real number (such as 0.55), a string (such as 'SQL '), a date/time (for example, '1970-JAN-25 03:22:22 '), or even a binary state. When defining a table, we need to define the data types of each column. (For example, the data type of the column 'surname' is char (50) character string, which indicates that this is a string of 50 characters ). Note that different databases have different types of data. Therefore, before defining a table, you are advised to refer to the description of the database.

CREATE TABLESyntax:

Create table "TABLE name"
("Column 1" "column 1 Data Type ",
"Column 2" "column 2 data types ",
...);

If we want to create the customer table we mentioned above, we will enter the following SQL:

Create table Customer
(First_Name char (50 ),
Last_Name char (50 ),
Address char (50 ),
City char (50 ),
Country char (25 ),
Birth_Date datetime );


Linux has been tested as follows:





Reprinted, please note: Xiao Liu

Bytes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.