• 2022-06-26
    根据用户在文本框txtName中输入的姓名对Student表进行查询,以下SQL语句定义正确的是__________________。
    A: String sql=Select * from Student where Sname=+txtName.getText();
    B: String sql=Select * from Student where Sname='+txtName.getText()+';
    C: String sql=Select * from Student where Sname like +txtName.getText();
    D: String sql=Select * from Student where Sname like '+txtName.getText()+';
  • B

    举一反三

    内容

    • 0

      在student(sno,sname,ssex,sage,sdept)表中,查询学生姓名中包含“大”或“小”的学生信息。以下查询语句正确的是( )。 A: select * from student where sname in( '_[大小]%') B: select * from student where sname ='%大%' or sname='%小%' C: select * from student where sname like'%大%' or sname like'%小%' D: select * from student where sname like '%[大小]%'

    • 1

      在学生关系student(sid,sname……)中,student的属性分别表示学号和姓名,若要查询学号为19170201的学生姓名,下列SQL语句正确的是( )。Ⅰ.SELECT sname FROM student WHERE sid LIKE '19170201'Ⅱ.SELECT sname FROM student WHERE sid LIKE= '19170201'Ⅲ.SELECT sname FROM student WHERE sid='19170201' A: Ⅰ、Ⅱ B: Ⅰ、Ⅲ C: Ⅱ、Ⅲ D: Ⅰ、Ⅱ、Ⅲ

    • 2

      对于学生信息表:student(sno,sname,sex,age,dept),要查询所有刘姓学生的信息,正确的语句是 A: SELECT * FROM student WHERE sname LIKE'刘 * ' B: SELECT * FROM student WHERE sname LIKE'刘 $' C: SELECT * FROM student WHERE sname LIKE'刘%' D: SELECT * FROM student WHERE sname LIKE'刘&'

    • 3

      查询姓"张"的学生姓名,下列()语句不能实现。 A: SELECT sname FROM student WHERE left(sname,1)= '张' B: SELECT snameFROM student WHERE sname LIKE '张%' C: SELECT sname FROM student WHERE substring(sname,1,1)= '张' D: SELECT sname FROM student WHERE sname='张%'

    • 4

      S_T数据库关系图如下:[img=332x128]17e448fc85e997f.jpg[/img]查询与“刘晨”在同一个系学习的学生,要求显示学生学号(Sno)、姓名(Sname)及系别(Sdept)。下列SQL语句正确的是()。 A: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept = (SELECT Sdept FROM Student WHERE Sname = '刘晨'); B: SELECT S1.Sno, S1.Sname , S1.Sdept FROM Student S1 , Student S2 WHERE S1.Sdept = S2.Sdept AND S2.Sname = '刘晨'; C: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept IN (SELECT Sdept FROM Student WHERE Sname = '刘晨'); D: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept LIKE (SELECT Sdept FROM Student WHERE Sname = '刘晨');