MySQL learning starting from 0: creating a Table

Source: Internet
Author: User

The following example is a table named "Persons":

id lastname firstname address city
1 adams john oxford Street london
2 bush george fifth Avenue new York
3 carter thomas changan Street beijing

The table above contains three records (one per person) and five columns (Id, last name, first name, address, and city).

Now let's create the data table above:

Mysql> CREATE TABLE Persons (

ID int auto_increment NOT NULL primary key,

Lastname varchar (30),

Firstname varchar (30),

Address varchar (30),

City varchar (30)

);

Okay, now the creation column is successful.

Use the command SELECT * from persons to see if it is a hint to empty set, that's right, because no specific data has been added, so far it has just created columns.

So now it's time to add the data:

Mysql> INSERT INTO persons (lastname,firstname,address,city) values ("Adams", "John", "Oxford Street", "London");

The creation of the entire table can be done by adding two additional sets of data according to the insert command above.

Insert into persons (lastname,firstname,address,city) values ("Bush", "George", "Fifth Avenue", "New York");

Insert into persons (lastname,firstname,address,city) values ("Carter", "Thomas", "Changan Street", "Beijing");

Let's summarize the creation of the table today. Tomorrow write again, recently mood is not good, change a job quite helpless. Very tangled do not know where to go to the best.

Received ZTE's offer, do not know whether or not to go.

Another two companies offer, one is to do graphics processing using OPENCV and OpenGL and other graphics libraries,

One is to do the development and use of C + + service, this is more in line with my ideal job, the specific content is: Google specification, List,unordered_map,redis,dump analysis method, STL's bind function, memory pool and thread pool

MySQL learning starting from 0: creating a Table

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.