点击file->如下图红色标记的按钮->找到自己电脑上的yiibaidb.sql脚本导入即可
导入之后,点击运行脚本,运行完即可生成数据库(运行按钮如下图红色标注)
在customers表的customername列中,建立一个index_name
show index from customers # 显示索引
select *
from customers
show index from customers
alter table customers add index index_name(customername)
show index from customers
drop index index_name on customers
show index from customers
create view t1
as
select customername,phone
from customers
select *
from t1
create view v_stu_g
as
select students.sno,sn,cname,grade
from students,sc,course
where students.sno=sc.sno and sc.cno=course.cno
select sno,sn,cname,grade
from v_stu_g
where sno='1224'
select sno,count(*)
from sc
group by sno
select students.sno,sn,count(*)
from students,sc
where students.sno=sc.sno
group by sno
create view stu_info
as
select sno,sn,sage
from students
select *
from stu_info
create view v_stu_info
as
select sno,sn,sgender
from students
select *
from v_stu_info
delete from v_stu_info
where sn='李佳'
select *
from students
insert into students values('1225','Tom','男',20,'数学')
select *
from students
update v_stu_g
set grade=84
where sname='张丽'and cname='数学'
select *
from sc
drop view v_stu_g
select *
from v_stu_g
where sname='张丽'and cname='数学'