create table student(id string, name string, stature double);
insert into student values(“1”, “Tom”, 180);
insert into student values(“2”, “Lily”, 165);
insert into student values(“3”, “Mary”, 172);
insert into student values(“4”, “Jack”, 175);
insert into student values(“5”, “Rob”, 177);
insert into student values(“6”, “John”, 192);
insert into student values(“7”, “Alice”, 163);
insert into student values(“8”, “Kate”, 168);
create table course(id string,c_name string, score double);
insert into course values(“1”,”en”,85);
insert into course values(“2”,”en”,72);
insert into course values(“3”,”en”,60);
insert into course values(“4”,”en”,95);
insert into course values(“5”,”en”,88);
insert into course values(“6”,”en”,78);
insert into course values(“7”,”en”,81);
insert into course values(“8”,”en”,68);
insert into course values(“1”,”ma”,100);
insert into course values(“2”,”ma”,90);
insert into course values(“3”,”ma”,85);
insert into course values(“4”,”ma”,80);
insert into course values(“5”,”ma”,70);
insert into course values(“6”,”ma”,86);
insert into course values(“7”,”ma”,60);
insert into course values(“8”,”ma”,85);
select from course;
select from student;
select from course where c_name=”en”;
select from course where c_name=”ma” sort by id asc ; //按升序的顺序输出 DESC(降序)
显示当前数据库中的表:show tables;
删除当前数据库中的表:drop table if exists student;
重命名
ALTER TABLE table_name RENAME TO new_table_name
修改列名
ALTER TABLE course CHANGE score grade double;