create table score (
id INT(10) NOT NULL UNIQUE PRIMARY KEY AUTO_INCREMENT ,
stu_id INT(10) NOT NULL ,
c_name VARCHAR(20) ,
grade INT(10)
);
select * from student;
select id,name,sex,birth,department,address from student;
select * from student limit 3 offset 1;
select id,name,department from student;
select * from student where "2008"-birth >= "12" AND "2008"-birth <= "22";
select * from student where "2008"-birth BETWEEN 12 AND 22;
select department,count(department) as "人数" from student group by department;
select c_name,max(grade) from score group by c_name;
select s.name,c.c_name,c.grade from score c INNER JOIN student s ON s.id = c.stu_id where s.name = "李四";
select s.*,c* from score c INNER JOIN student s ON s.id = c.stu_id;
select s.name,avg(c.grade) as "平均分" from score c INNER JOIN student s ON s.id = c.stu_id group by s.name;
select s.name,c.* from score c INNER JOIN student s ON s.id = c.stu_id where c.c_name = '计算机' order by c.grade desc;
select * from employee where name NOT IN ('张三','李四') ;
systemctl set-default multi-user.target
cd ~/.ssh/
ssh localhost
cd ~/.ssh/
ssh-keygen -t rsa
ssh-copy-id 主机名
select * from employee limit 2 offset 3;
select * from employee where age <=30 AND age >=25;
select d_id,SUM(salary) from employee group by d_id;
select * from employee order by salary desc;
select * from employee where address like "北京市%";
select * from employee where name like "_ric";
select * from employee where name like "L__y";
https://www.budingcy.net/archives/34039
https://zh.moegirl.org.cn/%E5%B0%9A%E6%9C%89%E4%BD%B3%E8%9C%9C%E4%BC%B4%E6%81%8B%E5%BF%83
create table `order`(o_num int NOT NULL AUTO_INCREMENT,o_date datetime NOT NULL,c_id int NOT NULL,PRIMARY KEY (o_num)) ;
select o.o_date from orders as o where o_num = "30001";
select IFNULL((select TRUE from employee where d_id = 1002),FALSE);
select * from score where stu_id = (select id from student where name = "张老大");
select s.*,c.* from score c inner join student s on s.id = c.stu_id where s.name = "李四";
select s.*,c.* from score c inner join student s on s.id = c.stu_id where s.name = "李四";
CREATE VIEW department_view3(d_id,name ,function,address) AS select d_id,d_name ,function,address from department;
ALTER VIEW department_view1 AS <SELECT语句>
ALTER VIEW department_view1 AS SELECT d_name as department,function,address aslocation FROM department;
create or replace
create table index2( id int unique,name varchar(20),unique index index2_id(id asc));