创建一个升序索引 index_subject。
Database changed mysq|>CREATE INDEX index_subject ON content(subject(3)ASC);
到 c 盘的 backup 目录下一个名为 backupcontent.txt 的文件中。
select * from db_test.content into outfile 'c:\backup\backupcontent.txt'
CREATE TABLE student( id INT(4), name VARCHAR(20) NOT NULL, grade FLOAT );
insert into student values(5,'lily',100);
SELECT * FROM score WHERE 姓名=’张三’;
SELECT * FROM score WHERE 学科=’英语’ AND 分数>90;
SELECT 学号 FROM score GROUP BY 学号HAVING SUM(分数)>180;
create database student use student create table student_web ( s_id int not null, s_name varchar(12), s_fenshu int, s_hometown varchar(50), s_tuition int )
insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition) values(1,’Jacktomas’,89,’郑州金水’,2800) insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition) values(2,’TomJoe’,88,’洛阳涧西’,3000) insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition) values(3,’Smiths’,87,’郑州中原’,2700)
select * from student_web
select * from student_web where s_name like ’%J%’
select * from student_web where s_hometown=’北京%’
select * from student_web where s_tuition<(select avg(s_tuition) from student_web)
delete from user where id is null;
update user set name=' 匿名' where name is null;
CREATE VIEW view_sales AS SELECT first_half+ latter_half FROM sales;
SELECT * FROM send WHERE DATEDIFF(DD, sendtime,GETDATE())=0
SELECT id,name,grade,gender FROM student WHERE name LIKE 'h%' OR gender=' 女 ' OR grade=100;
select * from dept,employee where exists(select did from employee where age>21);
select p1.* from employee p1 join employee p2 on p1.did =p2.did where name="王红";
auto_increment 连接concat 去重distinct 分页limit 默认default 结束符delimiter 临时表create temporarytable 定义变量 declare