本篇博客的主要内容有Java程序设计,MySQL应用等相关内容
mysql sqlyog java
关于Java
Java是一门面向对象的编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的代表,极好地实现了面向对象理论,允许程序员以优雅的思维方式进行复杂的编程 [1] 。
Java具有简单性、面向对象、分布式、健壮性、安全性、平台独立与可移植性、多线程、动态性等特点 [2] 。Java可以编写桌面应用程序、Web应用程序、分布式系统和嵌入式系统应用程序等 [3] 。
项目来源及背景
个人成绩单管理系统是学生在每学期期末记录学期各科成绩的主要应用,具有较强的实用性,贴近实际,便于完成系统的分析与设计,适用于多用户。
功能设计
注册:输入账户、密码和确认密码完成新用户的注册。
登录:输入账号和密码,完成登录操作,进入主界面,显示成绩单管理系统中可进行的相关操作的选项。
退出:登录后可进行退出操作,结束整个程序。
添加信息:输入一份成绩单的各项基本信息(用户名、课程号、课程名等),或者输入这份成绩单中各科的成绩(课程号、课程名、考试记录、考试成绩、考试年份等),完成课程表或成绩表的添加操作。
删除信息:根据显示的课程表或成绩表基本信息,输入某个表的主键或者相应信息,完成表数据的删除操作。
修改成绩单:根据显示的成绩单基本信息,输入某个成绩单的主键或者相应信息,显示成绩单的基本信息和成绩单中的各科成绩信息,根据提示选项,选择修改课程表基本信息或修改某科成绩或删除某科成绩,输入相应字段值或某科成绩的主键,完成成绩单信息的修改。
查询信息:利用主键查询,获得一份成绩单的详细信息。
查询某课程年平均成绩:输入相关信息,输出查询结果,以表格形式按创建年平均成绩结果,并导出文本文档。
查询年某课程考试成绩:输出课程相关信息,输出以分数升序显示的,年考试成绩的变化信息。
修改密码:进入系统后,选择修改密码,输入用户名以及旧密码,输入新密码并确认完成用户密码修改。
导出功能
对成绩单信息进行导出操作,存储至一个文本文档中,将查询到的年平均成绩存入导出文本文档中。
代码
主页面
package top; import com.mysql.jdbc.Driver; import java.io.FileNotFoundException; import java.sql.*; import java.util.Scanner; public class Test_J { public static void main(String[] args) throws SQLException, ClassNotFoundException, FileNotFoundException { System.out.println("----------欢迎使用个人成绩信息管理系统----------"); System.out.println("请选择你要进行的操作( 1 or 2 ): \n —— 1- 注册.\t —— 2- 登录."); Scanner input = new Scanner(System.in); int num = input.nextInt(); if (num == 1) { while (true) { Scanner reader = new Scanner(System.in); System.out.println("------注册页面------"); System.out.println("请输入用户名:"); String username = reader.next(); System.out.println("请输入密码:"); String password = reader.next(); System.out.println("请确认密码:"); String password1 = reader.next(); if (password.equals(password1)) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); ResultSet s = sql.executeQuery("select * from users where username='" + username + "'"); if (s.next()) { System.out.println("对不起,用户名已存在!"); } else { int n = sql.executeUpdate("insert into users(username,password) value('" + username + "','" + password + "')"); if (n > 0) { System.out.println("......注册中"); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("\n注册成功!"); System.out.println("\n已退出,请重新登录!"); break; } else { System.out.println("注册失败,请重试!"); con.close(); } } } catch (SQLException e) { e.printStackTrace(); } } else { System.out.println("注册失败,两次密码输入不一致!"); } } } if (num == 2) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { int number = 0; while (true) { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); System.out.println("-----登陆页面-----"); System.out.println("请输入用户名: "); Scanner reader = new Scanner(System.in); String username = reader.next(); System.out.println("请输入密码: "); String password = reader.next(); ResultSet rs = sql.executeQuery( "select * from users where username='" + username + "' and password='" + password + "'"); if (rs.next()) { System.out.println("......登陆中\n"); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("登陆成功!\n"); break; } else { number = number + 1; System.out.println("登陆失败,用户名或密码错误,请认真核对!\n"); // System.out.println("" + number); if (number == 3) { System.out.println("登陆失败错误次数过多,即将退出!\n"); System.exit(0); break; } } /* * 正常退出 status为0时为正常退出程序,也就是结束当前正在运行中的java虚拟机。 * * 非正常退出 status为非0的其他整数(包括负数,一般是1或者-1),表示非正常退出当前程序。 */ // 5.断开连接,关闭数据库 rs.close(); con.close(); } } catch (SQLException e) { e.printStackTrace(); } while (true) { System.out.println("----------欢迎使用个人成绩信息管理系统----------"); System.out.println("—— 1-添加课程.\t\t5-查询信息.\t ——"); System.out.println("—— 2-添加成绩.\t\t6-修改信息.\t ——"); System.out.println("—— 3-查询年平均成绩.\t7-删除信息. \t ——"); System.out.println("—— 4-查询按年成绩排序.\t8-修改密码.\t ——"); System.out.println("—— 9-退出程序\t\t\t\t ——"); System.out.println("---------------------------------------------"); System.out.println("\n请输入你的指令( 1 ~ 9 ): ______"); Scanner scanner = new Scanner(System.in); String cmd = scanner.nextLine(); switch (cmd) { case "1": AddCourse.Addcourse(); break; case "2": AddScores.Addscores(); break; case "3": Select_avg.select_avg(); break; case "4": SelectDesc.Selectdesc(); break; case "5": SelectUser.Selectuser(); break; case "6": UpdateScores.Updatescores(); break; case "7": DeleteScores.Deletescores(); break; case "8": Updatepassword.updatepassword(); break; case "9": System.out.println("感谢使用!Byebye~"); System.exit(0); Connection connection = null; Statement statement = null; ResultSet set = null; try { // 1.加载数据库驱动 Class.forName("com.mysql.jdbc.Driver"); // 2.通过DriverManager获取数据库连接 Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); } catch (ClassNotFoundException e) { System.out.println("---错误提示:数据库驱动加载失败"); e.printStackTrace(); } catch (SQLException e) { System.out.println("---错误提示:数据库操作失败"); e.printStackTrace(); } finally { if (set != null) { try { set.close(); } catch (SQLException e) { e.printStackTrace(); } } if (connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } if (statement != null) { try { statement.close(); } catch (SQLException e) { e.printStackTrace(); } } } } } } } }
- 添加课程页面
package top; import java.sql.*; import java.util.Scanner; class AddCourse extends Test_J { public static void Addcourse() throws ClassNotFoundException, SQLException { @SuppressWarnings("resource") Scanner reader = new Scanner(System.in); System.out.println("------添加课程页面------"); System.out.println("请输入用户名:"); String username = reader.next(); System.out.println("请输入课程号:"); String Cno = reader.next(); System.out.println("请输入课程名:"); String Cname = reader.next(); if (1 > 0) /* true */ { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); ResultSet s = sql.executeQuery( "select * from course where username='" + username + "'and course.Cno='" + Cno + "'"); if (s.next()) { System.out.println("添加失败,课程已存在!"); } else { int n = sql.executeUpdate("insert into course(username,Cno,Cname) value('" + username + "','" + Cno + "','" + Cname + "')"); if (n > 0) { System.out.println("课程添加成功"); } else { System.out.println("课程添加失败"); con.close(); } } } catch (SQLException e) { e.printStackTrace(); } } } }
添加成绩页面
package top; import java.sql.*; import java.util.Scanner; class AddScores extends Test_J { public static void Addscores() throws ClassNotFoundException, SQLException { Scanner reader = new Scanner(System.in); System.out.println("------添加成绩页面------"); System.out.println("请输入课程号:"); String Cno = reader.next(); System.out.println("请输入课程名:"); String Cname = reader.next(); System.out.println("请输入考试记录:"); String C_record = reader.next(); System.out.println("请输入考试分数:"); String C_score = reader.next(); System.out.println("请输入考试年份:"); String C_date = reader.next(); if (1 > 0) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); ResultSet s = sql.executeQuery("select * from grade where grade.Cno='" + Cno + "'and grade.Cname='" + Cname + "'and grade.C_record='" + C_record + "'and grade.C_score='" + C_score + "'and grade.C_date='" + C_date + "'"); if (s.next()) { System.out.println("对不起,成绩信息已存在!"); } else { int n = sql.executeUpdate("insert into grade(Cno,Cname,C_record,C_score,C_date) value('" + Cno + "','" + Cname + "','" + C_record + "','" + C_score + "','" + C_date + "')"); if (n > 0) { System.out.println("成绩信息添加成功!"); } else { System.out.println("成绩信息添加失败"); con.close(); } } } catch (SQLException e) { e.printStackTrace(); } } } }
删除页面
package top; import java.util.*; import java.sql.*; class DeleteScores extends Test_J { public static void Deletescores() throws ClassNotFoundException, SQLException { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); Scanner reader = new Scanner(System.in); System.out.println("-----删除界面-----"); System.out.println("—— 1- 成绩表 \t—— 2-课程表\n"); System.out.println("请选择你要删除的表( 1 or 2 ): "); int type = reader.nextInt(); if (type == 1) { System.out.println("请输入课程号:"); String Cno = reader.next(); System.out.println("请输入课程名:"); String Cname = reader.next(); System.out.println("请输入考试记录:"); String C_record = reader.next(); int n = sql.executeUpdate("delete from grade where Cno='" + Cno + "'and Cname='" + Cname + "' and C_record='" + C_record + "'"); if (n > 0) { System.out.println("删除成功!"); } else { System.out.println("未查询到相应数据,删除失败!"); } } else if (type == 2) { System.out.println("请输入用户名:"); String username1 = reader.next(); System.out.println("请输入课程号:"); String Cno = reader.next(); int n = sql .executeUpdate("delete from course where username='" + username1 + "' and Cno='" + Cno + "'"); if (n > 0) { System.out.println("删除成功!"); } else { System.out.println("未查询到相应数据,删除失败!"); } } else { System.out.println("请按要求选择你要删除的表!"); } // 5.断开连接,关闭数据库 con.close(); } catch ( SQLException e) { e.printStackTrace(); } } }
查询平均分
package top; import java.io.FileNotFoundException; import java.io.PrintStream; import java.sql.*; import java.util.Scanner; class Select_avg extends Test_J { public static void select_avg() throws ClassNotFoundException, SQLException, FileNotFoundException { // 1.加载JDBC驱动程序 try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } // 2.创建数据库的链接 try { System.out.println("连接数据库..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); // 3.执行SQL语句 Scanner reader3 = new Scanner(System.in); System.out.println("------查询页面------"); Scanner reader = new Scanner(System.in); System.out.println("请输入你的用户名:"); String username = reader.next(); System.out.println("请输入你的课程号:"); String Cno = reader.next(); System.out.println("请输入年份:"); String C_date = reader.next(); Statement sql1 = con.createStatement();// Statement接口 ResultSet re1 = sql1.executeQuery("SELECT username,course.Cno,AVG(C_score) FROM grade,course WHERE C_date='" + C_date + "' AND course.`username`='" + username + "' AND course.Cno='" + Cno + "' AND course.`Cno`=grade.`Cno` AND course.`Cname`=grade.`Cname` group by username,course.Cno");// executeQuery查询----ResultSet结果集 // 4.接收并处理结果集 System.out.println(" 查询中....."); if (re1.next()) { // 创建一个打印输出流,输出的目标是E盘下的Select_avg.txt文件 PrintStream out = System.out; // 保存系统默认的打印输出流缓存 PrintStream ps = new PrintStream("E:\\Select_avg.txt"); System.setOut(ps); // 把创建的打印输出流赋给系统。即系统下次向 ps输出 String username1 = re1.getString("username"); System.out.println("用户名: " + username1); String Cno1 = re1.getString("course.Cno"); System.out.println("课程号: " + Cno1); String avg = re1.getString("avg(C_score)"); System.out.println("年平均分: " + avg); ps.close(); System.setOut(out);// 把打印输出流还给系统 String username11 = re1.getString("username"); System.out.println("用户名: " + username11); String Cno11 = re1.getString("course.Cno"); System.out.println("课程号: " + Cno11); String avg1 = re1.getString("avg(C_score)"); System.out.println("年平均分: " + avg1); System.out.print("----查询结束!\n"); } else { System.out.print("未查询到相关信息,请认真核对!\n"); } re1.close(); con.close(); } catch (SQLException e) { e.printStackTrace(); } } }
查询成绩表
package top; import java.sql.*; import java.util.Scanner; import java.io.FileNotFoundException; import java.io.PrintStream; class SelectDesc extends Test_J { public static void Selectdesc() throws ClassNotFoundException, SQLException { // 1.加载JDBC驱动程序 try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } // 2.创建数据库的链接 try { System.out.println("连接数据库..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); // 3.执行SQL语句 Scanner reader3 = new Scanner(System.in); System.out.println("------查询页面------"); Scanner reader = new Scanner(System.in); System.out.println("请输入课程号:"); String Cno = reader.next(); System.out.println("请输入课程名:"); String Cname = reader.next(); System.out.println("请输入年份:"); String C_date = reader.next(); Statement sql1 = con.createStatement();// Statement接口 ResultSet re1 = sql1.executeQuery("SELECT * FROM grade WHERE `Cno`='" + Cno + "' AND `Cname`='" + Cname + "' AND C_date='" + C_date + "' ORDER BY C_score DESC");// executeQuery查询----ResultSet结果集 // 4.接收并处理结果集 System.out.println(" 查询中....."); while (re1.next()) { String Cno1 = re1.getString("Cno"); System.out.print("\t课程号: " + Cno1); String Cname1 = re1.getString("Cname"); System.out.print("\t课程名: " + Cname1); String C_record = re1.getString("C_record"); System.out.print("\t考试记录: " + C_record); String C_score = re1.getString("C_score"); System.out.print("\t考试分数: " + C_score); String C_date1 = re1.getString("C_date"); System.out.println("\t考试年份: " + C_date1); } System.out.print("----查询结束!\n"); re1.close(); con.close(); } catch (SQLException e) { e.printStackTrace(); } } }
查询课程表
package top; import java.sql.*; import java.util.Scanner; class SelectUser extends Test_J { public static void Selectuser() throws ClassNotFoundException, SQLException { // 1.加载JDBC驱动程序 try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } // 2.创建数据库的链接 try { System.out.println("连接数据库..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); // 3.执行SQL语句 Scanner reader3 = new Scanner(System.in); System.out.println("------查询页面------"); System.out.println("请选择你要进行的操作( 1 or 2 ): \n—— 1-查询课程表. \t—— 2-查询成绩表.\n"); int n = reader3.nextInt(); if (n == 1) { Scanner reader = new Scanner(System.in); System.out.println("-----查询课程记录页面-----"); System.out.println("请输入您的用户名:"); String username1 = reader.next(); Statement sql = con.createStatement();// Statement接口 ResultSet re = sql.executeQuery("select * from course where username='" + username1 + "'");// executeQuery查询----ResultSet结果集 // 4.接收并处理结果集 System.out.println(" 查询中....."); if (re.next() == false) { System.out.print("未查询到相关信息,请认真核对!\n"); } else { String username = re.getString("username"); String Cno = re.getString("Cno"); String Cname = re.getString("Cname"); // 输出数据 System.out.println("用户名: " + username); System.out.println("课程号: " + Cno); System.out.println("课程名: " + Cname); System.out.print("----查询结束!\n"); while (re.next() == true) { String username11 = re.getString("username"); String Cno1 = re.getString("Cno"); String Cname1 = re.getString("Cname"); // 输出数据 System.out.println("用户名: " + username11); System.out.println("课程号: " + Cno1); System.out.println("课程名: " + Cname1); System.out.print("----查询结束!\n"); } } re.close(); } else if (n == 2) { System.out.println("------查询成绩记录页面------"); System.out.println("请输入您的用户名:"); Scanner reader2 = new Scanner(System.in); String username1 = reader2.next(); System.out.println("请输入您的课程号:"); Scanner reader4 = new Scanner(System.in); String Cno1 = reader2.next(); Statement sql2 = con.createStatement();// Statement接口 ResultSet re2 = sql2.executeQuery( "SELECT * FROM grade,course WHERE grade.`Cno`='" + Cno1 + "' AND course.username='" + username1 + "'AND grade.`Cno`=course.`Cno`AND grade.Cname=course.`Cname`");// executeQuery查询----ResultSet结果集 // 4.接收并处理结果集 System.out.println(" 查询中....."); if (re2.next() == false) { System.out.print("未查询到相关信息,请认真核对!\n"); } else { String Cno = re2.getString("Cno"); String Cname = re2.getString("Cname"); String C_record = re2.getString("C_record"); String C_score = re2.getString("C_score"); String C_date = re2.getString("C_date"); // 输出数据 System.out.println("课程号: " + Cno); System.out.println("课程名: " + Cname); System.out.println("考试记录: " + C_record); System.out.println("考试成绩: " + C_score); System.out.println("考试时间: " + C_date); System.out.print("----查询结束!\n"); while (re2.next()) { String Cno11 = re2.getString("Cno"); String Cname1 = re2.getString("Cname"); String C_record1 = re2.getString("C_record"); String C_score1 = re2.getString("C_score"); String C_date1 = re2.getString("C_date"); // 输出数据 System.out.println("课程号: " + Cno11); System.out.println("课程名: " + Cname1); System.out.println("考试记录: " + C_record1); System.out.println("考试成绩: " + C_score1); System.out.println("考试时间: " + C_date1); System.out.print("----查询结束!\n"); } } re2.close(); } // 5.断开连接,关闭数据库 else { System.out.print("请按要求进行选择查询页面!"); } con.close(); } catch (SQLException e) { e.printStackTrace(); } } }
修改密码页面
package top; import java.util.*; import java.sql.*; class Updatepassword extends Test_J { public static void updatepassword() throws ClassNotFoundException, SQLException { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); Scanner reader = new Scanner(System.in); System.out.println("-----修改密码页面-----"); System.out.println("请输入用户名:"); String name = reader.next(); System.out.println("请输入旧密码:"); String oldpwd = reader.next(); ResultSet re = sql .executeQuery("select * from users where username='" + name + "' and password='" + oldpwd + "'"); if (re.next()) { System.out.println("请输入新密码:"); String newpwd1 = reader.next(); System.out.println("请确认新密码:"); String newpwd2 = reader.next(); if (newpwd1.equals(newpwd2)) { int n = sql .executeUpdate("update users set password='" + newpwd1 + "'where username='" + name + "'"); if (n > 0) { System.out.println("密码修改成功!"); } else { System.out.println("密码修改失败!"); } } else { System.out.println("修改失败,你输入的新密码与旧密码不一致!"); } } else { System.out.println("对不起,你输入的密码或用户名有误!"); } // 5.断开连接,关闭数据库 re.close(); con.close(); } catch ( SQLException e) { e.printStackTrace(); } } }
修改页面
package top; import java.sql.*; import java.util.Scanner; class UpdateScores extends Test_J { public static void Updatescores() throws ClassNotFoundException, SQLException { // TODO Auto-generated method stub try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/system", "root", "dai324542"); Statement sql = con.createStatement(); Scanner reader = new Scanner(System.in); System.out.println("输入你要修改的表( 1 or 2 ): \n—— 1- 成绩表 \t —— 2- 课程表"); int type = reader.nextInt(); if (type == 1) { System.out.println("请输入你的课程号:"); String Cno = reader.next(); System.out.println("请输入你的考试记录:"); String C_record = reader.next(); System.out.println("请输入你修改后的分数:"); String new_score = reader.next(); int a = sql.executeUpdate("update grade set C_score='" + new_score + "' where Cno='" + Cno + "' and C_record='" + C_record + "'"); if (a > 0) { System.out.println("修改成功"); } else { System.out.println("修改失败!\\n---输入信息有误,请认真核对!"); } } else if (type == 2) { System.out.println("请输入你的用户名:"); String username = reader.next(); System.out.println("请输入你的课程号:"); String Cno = reader.next(); System.out.println("请输入你修改后的课程名:"); String Cname = reader.next(); int b = sql.executeUpdate("update course set Cname='" + Cname + "' where username='" + username + "'and Cno='" + Cno + "'"); if (b > 0) { System.out.println("修改成功"); } else { System.out.println("修改失败!\n---输入信息有误,请认真核对!"); } } else { System.out.println("输入选项有误,请按要求进行选择!"); } con.close(); } catch (SQLException e) { e.printStackTrace(); } } }
MySQL相关数据代码
创建表
/* SQLyog Ultimate v11.11 (64 bit) MySQL - 5.5.37 : Database - system ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`system` /*!40100 DEFAULT CHARACTER SET gbk */; USE `system`; /*Table structure for table `course` */ DROP TABLE IF EXISTS `course`; CREATE TABLE `course` ( `username` char(20) NOT NULL, `Cno` char(10) NOT NULL, `Cname` char(20) NOT NULL, PRIMARY KEY (`username`,`Cno`) ) ENGINE=InnoDB DEFAULT CHARSET=gbk; /*Data for the table `course` */ insert into `course`(`username`,`Cno`,`Cname`) values ('3','3','3'),('admin','1234','思政'),('admin','A01','Java程序设计'),('admin','A02','HTML'),('admin','A03','数学'),('user02','A01','C语言'); /*Table structure for table `grade` */ DROP TABLE IF EXISTS `grade`; CREATE TABLE `grade` ( `Cno` char(10) NOT NULL, `Cname` char(20) NOT NULL, `C_record` char(20) NOT NULL, `C_score` float NOT NULL, `C_date` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=gbk; /*Data for the table `grade` */ insert into `grade`(`Cno`,`Cname`,`C_record`,`C_score`,`C_date`) values ('A01','C语言','月考',67,2022),('A01','Java程序设计','第一次月考',56,2021),('A01','Java程序设计','第三次月考',46,2021),('A01','C语言','二次月考',89,2021),('A02','数学','周测',89,2021),('A01','Java程序设计','考试7',23,2021),('A01','Java程序设计','月考',78,2021); /*Table structure for table `users` */ DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `Username` char(20) NOT NULL, `Password` char(20) NOT NULL, PRIMARY KEY (`Username`) ) ENGINE=InnoDB DEFAULT CHARSET=gbk; /*Data for the table `users` */ insert into `users`(`Username`,`Password`) values ('admin','12345aaa'),('admin1','123456'),('admin12','asd'),('admin5','123'),('asd','123'),('asdf','123456'),('user01','123456'),('user02','123456'),('user03','123456'),('user04','123456'),('user05','12345678'),('user06','asd'); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
以上就是课程实践作业——个人信息管理系统的全部程序设计分析及相关代码,供大家学习使用,希望可以帮助到大家!如果各位有疑问的话,欢迎私信,发现错误,也希望可以指出,共同改进学习,加油💪!