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