按學號查詢成績
1. SQL按學號查詢每人的各科總成績,感激不盡
CREATETABLESTU_INFO(
XHINT,
XMvarchar(6)
);
CREATETABLEXK(
XHINT,
KCHvarchar(6),
KSCJINT,
KKNYvarchar(6)
);
GO
INSERTINTOSTU_INFOVALUES(1,'張三');
INSERTINTOSTU_INFOVALUES(2,'李四');
INSERTINTOSTU_INFOVALUES(3,'王五');
INSERTINTOSTU_INFOVALUES(4,'趙六');
INSERTINTOXKVALUES(1,'大英',90,'20011');
INSERTINTOXKVALUES(2,'大英',80,'20011');
INSERTINTOXKVALUES(3,'大英',70,'20011');
INSERTINTOXKVALUES(4,'大英',60,'20011');
INSERTINTOXKVALUES(1,'高數',80,'20011');
INSERTINTOXKVALUES(2,'高數',70,'20011');
INSERTINTOXKVALUES(3,'高數',60,'20011');
INSERTINTOXKVALUES(1,'物理',70,'20011');
INSERTINTOXKVALUES(2,'物理',60,'20011');
go
SELECT
STU_INFO.XH,
STU_INFO.XM,
COUNT(XK.KCH)AS考試課程總數,
SUM(XK.KSCJ)AS考試總成績,
AVG(XK.KSCJ)AS考試平均分
FROM
STU_INFOJOINXKON(STU_INFO.XH=XK.XH)
WHERE
KKNY='20011'
GROUPBY
STU_INFO.XH,
STU_INFO.XM;
go
XHXM考試課程總數考試總成績考試平均分
--------------------------------------------------
1張三324080
2李四321070
3王五213065
4趙六16060
(4行受影響)
2. 在EXCEL中如何用學號查詢各科目成績
用VLOOKUP函數,打開EXCEL,按F1幫助,查找此函數,表面講解很細。需要幫助可以HI,我。
3. 用EXCEL的VLOOKUP函數按學號查找各科成績
=VLOOKUP(查找值,區域,對應列,0)
具體教程:
網路專經驗圖屬文教程;
http://jingyan..com/user/nuc/interact?tab=comment
4. 1、學生信息的錄入。如:學生編號、學生姓名、學生成績。 2、學生信息的查詢及顯示。如:按學號查詢、按成
#include<iostream>
#include<string>
using namespace std;
#define OVERFLOW -1
typedef struct
{
string name;
int study_num;
int score_num;
}message, * message_point;
typedef struct
{
message * a; //存儲空間基址
int length; //當前長度
int lisesize; //當前分配的存儲容量
}SqList;
void InitList(SqList & L) //建立線性表函數
{
L.lisesize=20; //表的空間容量是20
L.length=1; //空表的長度為
L.a=new message[L.lisesize];
if(!L.a) exit(OVERFLOW);
}
void Add(SqList & L) //增加函數
{
string b;
if(L.length==L.lisesize)
cout<<"該空間已滿"<<endl;
else
{
if(L.length==0)
{
cout<<"姓名:";
cin>>L.a[0].name;
cout<<"學號:";
cin>>L.a[0].study_num;
cout<<"成績:";
cin>>L.a[0].score_num;
L.length++;
}
else
{
cout<<"姓名:";
cin>>L.a[L.length].name;
cout<<"學號:";
cin>>L.a[L.length].study_num;
cout<<"成績:";
cin>>L.a[L.length].score_num;
L.length++;
}
if(L.length==L.lisesize)
cout<<"空間已滿"<<endl;
}
}
void Delete(SqList & L) //刪除函數
{
bool c=false;
int i,j,b,k=L.length;
if(L.length==1)
cout<<"空間已空"<<endl;
else
{
cout<<"輸入刪除學生的學號"<<endl;
cin>>b;
for(i=1;i<L.length;i++)
{
if(L.a[i].study_num==b)
{
c=true;for(j=i+1;j<L.length;j++)
L.a[j-1]=L.a[j];
}
}
}
if(c==true)
L.length--;
else
cout<<"該學生不存在"<<endl;
}
void Modify(SqList & L) //修改函數
{
bool c=false;
int i,b;
cout<<"輸入要修改的學生的學號"<<endl;
cin>>b;
for(i=1;i<L.length;i++)
{
if(L.a[i].study_num==b)
{
c=true;
cout<<"姓名:";cin>>L.a[i].name;
cout<<"學號:";cin>>L.a[i].study_num;
cout<<"成績:";cin>>L.a[i].score_num;
}
}
if(c==false)
cout<<"該學生不存在"<<endl;
}
void Display(SqList L)//輸出函數,顯示學生信息
{
int i;
if(L.length==1)
cout<<"空間已空"<<endl;
for(i=1;i<L.length;i++)
{
cout<<"學生姓名:"<<L.a[i].name<<" "<<"學號:"<<L.a[i].study_num<<" "<<"成績:"<<L.a[i].score_num<<endl;
}
}
void Select_name(SqList L) //查詢學生姓名函數
{
int i=0;
int j=0;
string b;
cout<<"輸入待查詢的學生的姓名"<<endl;
cin>>b;
for(i=1;i<L.length;i++)
{
if(b==L.a[i].name)
{
cout<<"姓名: "<<L.a[i].name<<endl;
cout<<"學號: "<<L.a[i].study_num<<endl;
cout<<"成績:"<<L.a[i].score_num<<endl;
break;
}
j++;
}
if(j==(L.length-1))
cout<<"該學生不存在"<<endl;
}
void Select_study_num(SqList L) //查詢學生學號函數
{
int i,j=0;int b;
cout<<"輸入待查詢的學生的學號"<<endl;
cin>>b;for(i=1;i<L.length;i++)
{
if(b==L.a[i].study_num)
{
cout<<"姓名:"<<L.a[i].name<<endl;
cout<<"學號:"<<L.a[i].study_num<<endl;
cout<<"成績:"<<L.a[i].score_num<<endl;
break;
}
j++;
}
if(j==(L.length-1))
cout<<"該學生不存在"<<endl;
}
void Select_score_num(SqList L) //查詢學生成績函數
{
int i,j=0;
int b;cout<<"輸入待查詢的學生的成績"<<endl;
cin>>b;
for(i=1;i<L.length;i++)
{
if(b==L.a[i].score_num)
{
cout<<"姓名:"<<L.a[i].name<<endl;
cout<<"學號:"<<L.a[i].study_num<<endl;
cout<<"成績:"<<L.a[i].score_num<<endl;
break;
}
j++;
}
if(j==(L.length-1))
cout<<"該學生不存在"<<endl;
}
void Menu()
{
char ch;
cout<<"增加學生信息請輸入 a"<<endl;
cout<<"刪除學生信息請輸入 b"<<endl;
cout<<"修改學生信息請輸入 c"<<endl;
cout<<"顯示學生信息請輸入 d"<<endl;
cout<<"按姓名查詢請輸入 e"<<endl;
cout<<"按學號查詢請輸入 f"<<endl;
cout<<"按成績查詢請輸入 g"<<endl;
}
int main()
{
int s=1;
char ch;
SqList L;
InitList(L);
while(s==1)
{
Menu();
cin>>ch;
s=0;
while(s==0)
{
switch(ch)
{
case'a': Add(L); break;
case'b': Delete(L); break;
case'c': Modify(L); break;
case'd': Display(L); break;
case'e': Select_name(L);break;
case'f': Select_study_num(L);break;
case'g': Select_score_num(L);break;
}
cout<<"繼續前一操作請輸入"<<0<<endl;
cout<<"返回主菜單請輸入"<<1<<endl;
cout<<"退出程序請輸入"<<2<<endl;
cin>>s;
}
}
return 0;
}
看看符不符合 是否還需要添加別的功能
5. C語言,按學號查詢學生成績
#include "stdio.h"
#include "string.h"
struct student
{
char num[10];
int cscore;//yu wen
int iscore;//ying yu
char name[20]
};
void main()
{
struct student qq[3];
int i;
for(i = 0;i < 3;i++)
{
printf("請輸入 語文成績 英語成績 學號 姓名:\n");
scanf("%d %d %s %s",&qq[i].cscore,&qq[i].iscore,qq[i].num,qq[i].name);
printf("語文成績%d 英語成績%d 學號%s 姓名%s\n",qq[i].cscore,qq[i].iscore,qq[i].num,qq[i].name);
printf("---%d ---%d --%s --%s\n",qq[i].cscore,qq[i].iscore,qq[i].num,qq[i].name);
}
//下面是查詢
char nnm[10];
printf("請輸入 學號:\n");
scanf("%s",nnm);
for(i = 0;i < 3;i++)
{
if(memcmp(nnm,qq[i].num,strlen(nnm)) == 0)
{
printf("語文成績%d 英語成績%d 學號%s 姓名%s\n",qq[i].cscore,qq[i].iscore,qq[i].num,qq[i].name);
break;
}
else
printf("未找到\n");
}
}
6. C語言,按學號查詢學生成績
#include <stdio.h>
#include <stdlib.h>
typedef struct node //定義結點//
{
long num;
char Name[10];
char sex;
int age;
struct node *next;
}NODE;
NODE *create(int n) //創建鏈表//
{
NODE *s,*head=NULL,*r=NULL;
int i;
for(i=0;i<n;i++)
{
s=(NODE *)malloc(sizeof(NODE));
printf("\n輸入學號:");
scanf("%ld",&s->num);
getchar();
printf("\n輸入姓名:");
scanf("%s",s->Name);
getchar();
printf("\n輸入性別(M/W):");
scanf("%c",&s->sex);
getchar();
printf("\n輸入年齡:");
scanf("%d",&s->age);
getchar();
s->next=NULL;
if(head==NULL)
{
head=s;
r=s;
}
else
{
r->next=s;
r=s;
}
}
return head;
}
void sch(NODE *head,int num)
{
NODE *p=head;
while(1)
{
if(p->num==num)
{
printf("學號:%ld 姓名:%s 性別: %c 年齡:%d",
p->num,
p->Name,
p->sex,
p->age);
break;
}
else
p=p->next;
}
if(p==0)
printf("not find!");
}
main()
{
int num,n;
NODE *head=NULL;
printf("\n請輸入學生數:");
scanf("%d",&n);
getchar();
head=create(n);
printf("輸入要查找的學號:");
scanf("%d",&num);
getchar();
sch(head,num);
return 0;
}
7. excel如何實現輸入學號查詢成績
假設你A列是學號 ,B列是成績
現在在C1輸入學號,D1顯示成績
在D1輸入公式=VLOOKUP(C1,A:B,2,0)
8. 急求c語言大神輸入成績學號姓名查詢成績
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedefstructstudent
{
charname[12];
charstudent_id[12];
unsignedshortChinese;
unsignedshortEnglish;
unsignedshortMath;
unsignedshortaverage;
}student_t;
unsignedshortnum;
unsignedshortpass_rate;
voidenter_message(student_t*p);
voidsort(student_t*p);
voidprint_message(student_t*p);
voidswit_student(student_t*p,student_t*q);
voidsearch_student(student_t*p);
intmain(intargc,charconst*argv[])
{
printf("Enterthenumberofstudents:");
scanf("%hu",&num);
student_t*p=NULL;
p=malloc(num*sizeof(student_t));
printf("Enterstudentsmessage,example:namestudent_idChineseEnglishMath ");
enter_message(p);
sort(p);
print_message(p);
printf("Thepass_rateis%f ",(pass_rate*1.0)/(num*1.0));
search_student(p);
free(p);
return0;
}
voidenter_message(student_t*p)
{
unsignedshorti=0;
student_t*temp=p;
while(i<num)
{
("Enterthe%humessage: ",i+1);
scanf("%s%s%hu%hu%hu",temp->name,temp->student_id,&temp->Chinese,&temp->English,&temp->Math);
temp->average=(temp->Chinese+temp->English+temp->Math)/3;
if(temp->average>60)
pass_rate++;
temp+=1;
i++;
}
}
voidsort(student_t*p)
{
student_t*temp;
for(inti=0;i<num;++i)
for(intj=i+1;j<num;++j)
if(p[i].average<p[j].average)
swit_student(&p[i],&p[j]);
temp=p;
printf("Thebaststudentis:name:%sstudent_id:%sChinese:%huEnglish:%huMath:%huaverage:%hu "
,temp->name,temp->student_id,temp->Chinese,temp->English,temp->Math,temp->average);
temp+=num-1;
printf("Theworststudentis:name:%sstudent_id:%sChinese:%huEnglish:%huMath:%huaverage:%hu "
,temp->name,temp->student_id,temp->Chinese,temp->English,temp->Math,temp->average);
}
voidprint_message(student_t*p)
{
unsignedshorti=0;
student_t*temp=p;
while(i<num)
{
printf("name:%sstudent_id:%sChinese:%huEnglish:%huMath:%huaverage:%hu "
,temp->name,temp->student_id,temp->Chinese,temp->English,temp->Math,temp->average);
temp+=1;
i++;
}
}
voidswit_student(student_t*p,student_t*q)
{
student_ttemp;
strcpy(temp.name,p->name);
strcpy(p->name,q->name);
strcpy(q->name,temp.name);
strcpy(temp.student_id,p->student_id);
strcpy(p->student_id,q->student_id);
strcpy(q->student_id,temp.student_id);
temp.Chinese=p->Chinese;
p->Chinese=q->Chinese;
q->Chinese=temp.Chinese;
temp.English=p->English;
p->English=q->English;
q->English=temp.English;
temp.Math=p->Math;
p->Math=q->Math;
q->Math=temp.Math;
temp.average=p->average;
p->average=q->average;
q->average=temp.average;
}
voidsearch_student(student_t*p)
{
charstudent_id[12]={0};
printf("Plsenterthestudent_id ");
scanf("%s",student_id);
for(inti=0;i<num;++i)
{
if(!strcmp(p[i].student_id,student_id))
printf("Thestudentis:name:%sstudent_id:%sChinese:%huEnglish:%huMath:%huaverage:%hu "
,p[i].name,p[i].student_id,p[i].Chinese,p[i].English,p[i].Math,p[i].average);
}
}
寫的有點亂,時間有限,見諒。功能都給你實現了