### create user
MariaDB [(none)]> create user 'training'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
##########create new DB training
MariaDB [(none)]>create database training DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> grant all privileges on `training`.* to 'training'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
##########
#############Table create
CREATE TABLE `student` (
`id` int(11) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL,
`sex` varchar(8) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
`major` varchar(32) DEFAULT NULL
) ;
INSERT INTO student(id,name,sex,age,major) VALUES(1,'ZhangSan','M',18,'Computer');
INSERT INTO student(id,name,sex,age,major) VALUES(2,'LiSi','F',21,'Manager');
INSERT INTO student(id,name,sex,age,major) VALUES(3,'wangwu','F',19,'electronic');
CREATE TABLE `course` (
`id` int(11) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL,
`score` int(11) DEFAULT NULL
) ;
INSERT INTO course(id,name,score) VALUES(1,'SQL', 4);
INSERT INTO course(id,name,score) VALUES(2,'Chinese',3);
INSERT INTO course(id,name,score) VALUES(3,'Math',2);
CREATE TABLE `sc` (
`id` int(11) DEFAULT NULL,
`Stu_id` int(11) DEFAULT NULL,
`Course_id` int(11) DEFAULT NULL,
`make` int(11) DEFAULT NULL
) ;
INSERT INTO sc(id,Stu_id,Course_id,make) VALUES(1,1,1,88);
INSERT INTO sc(id,Stu_id,Course_id,make) VALUES(2,2,1,90);
INSERT INTO sc(id,Stu_id,Course_id,make) VALUES(3,2,2,70);
INSERT INTO sc(id,Stu_id,Course_id,make) VALUES(4,3,3,79);
### Update
select * from course WHERE id=3;
UPDATE course SET score = 3 WHERE id=3;
select * from course WHERE id=3;
#### select
select * from student WHERE age>18;
select * from student WHERE age>18 ORDER BY age DESC;