SQL Getting Started Tutorial: SQL creation table create tables and database [create DATABSE]

Source: Internet
Author: User
Tags create database

SQL Getting Started Tutorial: SQL creation table create tables and database [create DATABSE]

In the declaration of creating a database
The CREATE DATABASE statement is used to set up a data base.

SQL syntax for creating a database

CREATE DATABASE database_name
Example of creating a database now, we are going to build a database called "my_db". We use the following CREATE DATABASE statement: CREATE DATABASE my_db

Here's a look at the SQL creation table create tables
In creating a table declaration in creating a table declaration is used to create a table in the database. Creating table SQL syntax CREATE TABLE table_name
(
Column_name1 Data_type,
Column_name2 Data_type,
Column_name3 Data_type,
....
)
Data types specify what type of data columns can be shelved. For a complete reference of all data types provided by Ms Access, MySQL, and SQL Server, please give us a complete data type reference. Example of creating a table now, we're going to create a table called "people" that contains five columns: p_id, last name, address, and city. We use the following creation Table declaration: 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 held some. Last name, first name, address, and city column varchar The maximum length of the type is 255 characters. The blank "People" table now looks like this: _id LastName FirstName Address City

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.