MySQL CREATE DATABASE and insert Data command

Source: Internet
Author: User
Tags mysql create mysql create database reserved

Brief introduction:

To learn the MySQL environment for Ubantu, here are some basic passwords for creating databases and inserting data

Learning resources from the experimental building: HTTPS://WWW.SHIYANLOU.COM/COURSES/9

Open the MySQL service and log in with root:

# turn on the MySQL service sudo service MySQL start         # log in with the root user, the password is empty mysql-u root   

Here is an example operation: Create a database called Library, containing book, reader two tables, arrange the contents of the table and insert the data according to your understanding

Create a new database and use:

# What databases are first viewed after entering the SQL service show databases; # If you do not create a new CREATE DATABASE Library; # use the database using the library;

Create a new table and use the view

# See what tables are available show tables;





# New table: CREATE table xxxx (); # Book: Title and author CREATE TABLE Book (name Char, author Char); # Reader: Name, date of borrowing and gender CREATE TABLE Reader (name char), date Int (ten), Sex char (5));

#再次查看表








#View the contents of the table: SELECT * from xxx;SELECT * from book;SELECT * from reader;#insert content into table: INSERT INTO XXX VALUES ();INSERT into book VALUES ('C language','Niuren') INSERT into book VALUES (' JAva','Lihairen')
Insert into book values (' python ', ' YJJ ') inserts into reader values ('Kumata'.20180530,'Mans'INSERT into Reader (name,sex) VALUES ('Kusada','Mans'INSERT into Reader (name,date) VALUES ('Wuyifan', 20187475);#Check AgainSELECT * from book;















SELECT * from reader;

Note:

First, in most systems, SQL statements are case-insensitive, so the following statements are valid:

CREATE database name1;create database name2; CREATE database name3;create database name4;

But out of rigor, and easy to differentiate between reserved words (reserved word): Refers to words that have already been defined in a high-level language, and the user can no longer use them as variable names or procedure names. and variable names, we capitalize the reserved words, and the variables and data are lowercase.

Ii. Types of data

MySQL Common data type: 51284106#comments

MySQL data type http://www.cnblogs.com/bukudekong/archive/2011/06/27/2091590.html

MySQL CREATE DATABASE and insert Data command

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.