你说的那些数据库语句,可以用简单的字符串匹配来做
如:
strcmp
匹配"create
table"这个字符串
对接下来字符进行提取,直到"("
以后的关键字符也是用类似方法判断","等实现
提取了需要的关键字符之后就可以进行对应的传参,调用相应 *** 作
1、select Cno,Cname from Course where Teacher='刘老师'2、select Sno,Sname from Student where Sage <22
3、select Sname from Student where Sno not in(
select Sno from sc inner join Course on sc.Cno=Course.Cno where Course.Teacher='刘老师')
4、select Sname from Student where Sno in(
select Sno from sc inner join Course on sc.Cno=Course.Cno where sc.Grade>90 and Course.Cname='程序设计')
5、select Sname from Student where Sno not in(
select Sno from sc inner join Course on sc.Cno=Course.Cno where Course.Cname='C3课')
6、select Sno from Student where Sno not in(
select Sno from sc inner join Course on sc.Cno=Course.Cno where Course.Cname='C1课' or Course.Cname='C2课')
group by Sno having count(*) >= 2
---
以上,希望对你有所帮助。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)