多选题
MySQL中,查询学生的学号、姓名,并将标题改为“学号”、“姓名”。正确的SQL语句是()。
A
select sno as 学号, name 姓名 from student
B
select sno 学号, name 姓名 from student
C
select sno 学号, name as 姓名 from student
D
select sno as 学号, name as 姓名 from student
答案解析
正确答案:ABCD
解析:
MySQL中,查询学生的学号、姓名,并将标题改为“学号”、“姓名”。正确的SQL语句是()。答案: ABCD
解析:
A. "select sno as 学号, name 姓名 from student" 正确,使用了AS关键字将查询结果的列标题改为指定的名称。
B. "select sno 学号, name 姓名 from student" 也正确,直接给列起了新的标题。
C. "select sno, name as 姓名 from student" 此选项漏掉了对"学号"列标题的更改,但查询本身是有效的。
D. "select sno as 学号, name as 姓名 from student" 同样正确,给两列都起了新的标题。
相关知识点:
SQL查询改名语句要记准
