答案:
1. mysql> Select * into B from A
mysql> select * into B from A where 1<>1 mysql> insert into B from select name,sex,0 from A; 2. mysql> create table admin as (select * from bookinfo.admin);
Insert into B values(1,2,3)
3.(1)Select A.key,isnull(B.value,0) From A Left join B on A.key=B.key (2)Update B set B.value=A.value From A,B where A.key=B.key
4.Select * From A Where ID in (select id from A Group by ID having count(name)>=3)
5.(1)Select * from A where name not in (select name from A where fenshu<80) (2)Select name,avg(fenshu) as pingjunfen, case when avg(fenshu)<60 then '不及格' when avg(fenshu)>=60 and avg(fenshu)<70 then '及格' when avg(fenshu)>=70 and avg(fenshu)<80 then '中' when avg(fenshu)>=80 and avg(fenshu)<90 then '良' when avg(fenshu)>=90 then '优秀' end as kaohe From A Group by name
6.Delede From A Where IDX not in (Select min(ID) group by NO,NAME,KCNO,KCNAME,FENSHU)
7.(1)Select * From A,B Where A.a=B.a and A.b=B.b and A.c=B.c (2)Select A.* From A Left join B on A.a=B.a and A.b=B.b and A.c=B.c where B.a is null
8.Select ID,count(Logintime) AS count,max(Logintime) AS LastLogintime From A where Logintime>=convert(char(10),dateadd(dd,-7,getdate()),20) And Logintime<getdate()
9.Select B1.ID,A1.Name,B1.Logintime,B1.playtime,B1.LastIP, B2.Lev,B2.GD,B2.guildno,B3.guildname, B4.data AS data1,B5.data AS data2 From A1 Inner join B.BDB.DBO.B1 on A1.name=B1.name Inner join B.BDB.DBO.B2 on B1.ID=B2.ID Inner join B.BDB.DBO.B3 on B2.guildno=B3.guildno Inner join B.BDB.DBO.B4 on B1.ID=B4.ID Inner join B.BDB.DBO.B5 on B1.ID=B5.ID Where A1.name like '%moliyo%'
|