(ii) MySQL: Learn SQL syntax on W3Schools documents (create a table using the database)

Source: Internet
Author: User

1. Select the database you want to use (select the test database created in the previous article)

The existing database

Mysql>use test;

Select the test database;

2. Create a table

2.1column represents the name of each column, datatype represents the data type of each column (available data type: https://www.w3schools.com/sql/sql_datatypes.asp)

2.2 Creating a Table

Mysql> CREATE TABLE Persons (
-PersonID int,
LastName varchar (255),
FirstName varchar (255),
Address varchar (255),
-City varchar (255)
);

The request was successful!

3. Querying the table data (at this point we are creating a table that has no input data and therefore returns NULL)

column represents the name of the columns we are querying (using * for all information), TABLE_NAME represents the name of the table (i.e. persons)

Returns an empty table (no data)

W3Schools Official Document: https://www.w3schools.com/sql/sql_create_db.asp

(ii) MySQL: Learn SQL syntax on W3Schools documents (create a table using the database)

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.