网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
现有两张数据表(MySQL数据库)如下:
x_pt_info x_user_info
字段 类型 长度 小数位 字段 类型 长度 小数位
user_id int 11 user_id int 11
pt_group int 11 user_name varchar 20
pt_number decimal 10 2 user_work int 1
描述一下这个SQL语句的作用:
SELECT b.user_id as user_id,b.user_name as user_name,round(sum(a.pt_number),2) as ptnum from x_pt_info a,x_user_info b where
a.user_id=b.user_id and a.pt_group=1 and b.user_work=2 group by a.user_id order by ptnum desc
另外,就你的经验,你觉得该语句是否有改进的余地,如有,请阐述。
参考答案
更多 “ 现有两张数据表(MySQL数据库)如下:x_pt_info x_user_info字段 类型 长度 小数位 字段 类型 长度 小数位user_id int 11 user_id int 11pt_group int 11 user_name varchar 20pt_number decimal 10 2 user_work int 1描述一下这个SQL语句的作用:SELECT b.user_id as user_id,b.user_name as user_name,round(sum(a.pt_number),2) as ptnum from x_pt_info a,x_user_info b wherea.user_id=b.user_id and a.pt_group=1 and b.user_work=2 group by a.user_id order by ptnum desc另外,就你的经验,你觉得该语句是否有改进的余地,如有,请阐述。 ” 相关考题
考题
欲创建如下数据表。“图书”表结构:书号:普通编码定长字符类型,长度为20,主键。书名:普通编码可变长字符类型,长度为40,非空。出版年份:整型。印刷数量:整型。单价:整型请补充完整SQL语句:CREATE TABLE 图书(书号 char(20) ______________ key,书名 varchar(40) not ______________,出版年份 int,印刷数量 int,单价 ______________)
考题
比较MAX(2,4,6,8,10)、ROUND(8.5,0)、INT(8.5)、ABS(-11)的大小,正确顺序为( )。A.ABS(-11)<ROUND(8.5,0)<INT(8.5)<MAX(2,4,6,8,10)B.ABS(-11)<INT(8.5)<ROUND(8.5,0)<<MAX(2,4,6,8,10)C.INT(8.5)<ROUND(8.5,0)<MAX(2,4,6,8,10)<ABS(-11)D.ROUND(8.5,0)<INT(8.5)<MAX(2,4,6,8,10)<ABS(-11)
考题
有如下程序: include using namespace std; int main(){ int sum;
有如下程序: #include<iostream> using namespace std; int main(){ int sum; for(int i=0;i<6;i+=3){ sum=i; for(int j=i;j<6;j++)sum+=j; } cout<<sum<<end1; return 0; } 运行时的输出结果是( )。A.3B.10C.12D.15
考题
请编写一个函数sum(int array[],int len),该函数返回数组array的所有整数元素的和,其中len为数组array的长度。注意:部分源程序已存在文件test34_2.cpp中。请勿修改主函数main和其他函数中的任何内容,仅在函数sum的花括号中填写若干语句。程序输出结果如下:sum of array 15文件test34_2.cpp的内容如下:include <iostream.h>int sum(int array[],int len){}void main(){static int a[5]-{1,2,3,4,5};int result=sum(a,5);cout<<"sum of array "<<result<<end1;}
考题
include “stdio.h” void main() { int sum=0,a=11; while(a
#include “stdio.h” void main() { int sum=0,a=11; while(aA. sum=0B. sum=55C. sum=10D. sum=11
考题
在FoxPro中定义一个新数据库时,需要定义( )。A.字段名称、字段宽度,字段类型、小数位数B.字段长度,字段类型、字段大小C.字段名称、字段类型、字段宽度、小数长度D.字段名称、字段类型、字段长度、小数长度
考题
请编写一个函数int sum(int n),该函数完成1+2+3+…+n的运算,并返回运算结果,其中n>0。注意:请使用递归算法实现该函数。注意:部分源程序已存在文件:test11.cpp中。请勿修改主函数main和其他函数中的任何内容,仅在函数sum的花括号中填写若干语句。文件test11_2.cpp的内容如下:include<iostream.h>int sum(int n){}void main(){int n;cout<<"输入n:";cin>>n;int result;sum(n);cout<<"结果为:"<<result<<endl;}
考题
下面的程序中定义了两个方法求自然数1~100的和。具体如下:int suml(int n);利用循环求1~n的和,int sum2(int n);利用递归方法求和1~n的和;在main()方法中调用这两个方法求1~100的和并显示。在程序的每条横线处填写一个适当的语句,使程序的功能完整。public class Sum{public static void main(String args[]){//1.调用suml(int n),求1~100的和System.out.println("1~100的和:"+sum1(100));//2,调用sum2(int n),求1~100的和System.out.println("1~100的和:"+sum2(100));}static int suml(int n){int result=0;for(int i=1;i<=n;i++)________________retrun result;}static int sum2(int n){if(______________)return 1;else_____________}}
考题
有如下函数模板定义:templateT1 sum(T1 a1) {return(a1+a2+a3);}则
有如下函数模板定义: template<typename T1,int a2,int a3> T1 sum(T1 a1) { return(a1+a2+a3); } 则以下调用中正确的是( )。A.sum<int,4,3>(5);B.sum<4,3>(5);C.sum<int,int,int>(5);D.sum(5);
考题
这个sql语句怎么写?
有三个表如下users(id,name);type(id,name);note(id,title,contents,user_id,author_id,type_id);其中,user_id是作者、author_id是原创作者都是与users中的id进行关联的,type_id是分类编号,与type的id关联。现在需要创建一个视图显示note中的id、title、contents、user_id、author_id、type_id、以及user_id、author_id、type_id对应的name。怎样写sql语句呢?
考题
现有: class TestApp{ public static void main (String[] args){ int [5] myarray={ 10, 11, 12, 13, 14); int sum=0; for (int x : myarray) sum+=x; System. out. println( "sum= "+sum); } } 上述程序运行后的结果是哪项?()A、sum=10B、sum=70C、sum=60D、运行时抛出异常
考题
假定在名称为教学库的数据库中包含有学生、课程和选课三个表,它们的定义如下所示:
学生(学生号char(7),姓名char(8),性别char(2),专业char(10),年级int)
课程(课程号char(4),课程名char(10),课程学分int)
选课(学生号char(7),课程号char(4),成绩int)
在下面查询语句中,所使用的字段函数sum是用来()。 select sum(成绩) from 选课A、求平均值B、求最大值C、求最小值D、求总和
考题
假定在名称为教学库的数据库中包含有学生、课程和选课三个表,它们的定义如下所示:
学生(学生号char(7),姓名char(8),性别char(2),专业char(10),年级int)
课程(课程号char(4),课程名char(10),课程学分int)
选课(学生号char(7),课程号char(4),成绩int)
在下面查询语句中,所使用的星号*代表选课表中的()。 select* from 选课 order by 成绩A、一部分字段B、所有字段C、最后一个字段D、第一个字段
考题
下列语句中,不能正确定义长度为4的数组a的语句是()A、 int[] a=new int[]{1,2,3,4};B、 int[] a= {1,2,3,4};C、 int[] a=new int[4]{1,2,3};D、 int[] a=new int[4]{1,2,3,4};
考题
下列语句中,不能够正确定义长度为4的数组a的语句是()A、int[]a={1,2,3,4};B、int[]a=newint[4]{1,2,3};C、int[]a=newint[4]{1,2,3,4};D、int[]a=newint[]{1,2,3,4};
考题
现有表Employee,字段:id(int)、firstname(varchar)、lastname(varchar);以下sql语句错误的是()A、select firstname+’.’+lastnameas’name’from employeeB、select firstname+’.’+lastname=’name’from employeeC、select’name’=firstname+’.’+lastnamefrom employeeD、select firstname,lastname from employee
考题
mysql数据库中一张user表中,其中包含字段A,B,C,字段类型如下:A:int,B:int,C://int根据字段A,B,C按照ABC顺序建立复合索引idx_A_B_C,以下查询语句中使用到索引idx_A_B_C的语句有哪些()。A、 select *from user where A=1 and B=1B、 select *from user where 1=1 and A=1 and B=1C、 select *from user where B=1 and C=1D、 select *from user where A=1 and C=1
考题
单选题下列语句中,不能正确定义长度为4的数组a的语句是()A
int[] a=new int[]{1,2,3,4};B
int[] a= {1,2,3,4};C
int[] a=new int[4]{1,2,3};D
int[] a=new int[4]{1,2,3,4};
考题
单选题现有: class TestApp{ public static void main (String[] args){ int [5] myarray={ 10, 11, 12, 13, 14); int sum=0; for (int x : myarray) sum+=x; System. out. println( "sum= "+sum); } } 上述程序运行后的结果是哪项?()A
sum=10B
sum=70C
sum=60D
运行时抛出异常
考题
单选题现有表Employee,字段:id(int)、firstname(varchar)、lastname(varchar);以下sql语句错误的是()A
select firstname+’.’+lastnameas’name’from employeeB
select firstname+’.’+lastname=’name’from employeeC
select’name’=firstname+’.’+lastnamefrom employeeD
select firstname,lastname from employee
热门标签
最新试卷