如何用SQL建立一个学生信息管理系统数据库

发布网友

我来回答

3个回答

懂视网

gbk; use school_db; create table students ( student_id int unsigned not null primary key, name char(10) not null, sex char(4) not null, birth date not null, politily char(20) not null ); insert into students values (201080701,"张三","男","1994-12-2","自动化1"); insert into students values (201080702,"李四","男","19-10-8","自动化2"); insert into students values (201080703,"王五","男","1994-8-8","自动化2"); insert into students values (201080704,"路人1","女","1994-7-9","自动化2"); insert into students values (201080705,"路人2","男","1994-12-8","自动化2"); insert into students values (201080706,"路人3","女","1994-11-8","自动化2"); insert into students values (201080707,"路人4","男","1992-1-23","自动化2");

。。。。

  

     2.编写代码

  

技术分享
#include <stdlib.h>
#include <stdio.h>
#include <mysql.h>
#include <ctype.h>
#include <curses.h>


//#define MAX_PASSWD_LEN 16


void printf_mune(void);
char *getPasswd(void);
int insert_student(void);
int delete_student(void);
int inquiry_student(void);





int main(int argc,char** argv)
{
 char user[20];
 char passwd[20];
 char c;
 int i;
 printf("***********************************************************
");
 printf("* welcome to student information managent system *
");
 printf("***********************************************************
");
// printf("  user: ______________
");
// printf("  psaawd:______
");

 while(1){
 
 printf("   user:");
 scanf("%s", user);

  printf("   passwd:");
 
  scanf("%s",passwd);
 
 /* while ((c=getch())!=‘
‘)
 {
  if (i<MAX_PASSWD_LEN && isprint(c)) //isprint函数判断c是否是可打印字符
  {
  passwd[i++] = c;
  putchar(‘*‘);
  }
  else if (i>0 && c==‘‘)
  {
  --i;
  putchar(‘‘);
  putchar(‘ ‘);
  putchar(‘‘);
  }
 }
 putchar(‘
‘);
 passwd[i] = ‘