高校平台集考试系统、权限系统、基础系统、评教系统、新生入学系统等,有幸参加其中之一的考试系统。在考试系统中存在这样一种情况,关于题库表怎么在数据库中存放的问题。 题库看着简单的两个字,却包含了很多,题库中包含很多题型,每个题型有很多题,就廊
高校平台集考试系统、权限系统、基础系统、评教系统、新生入学系统等,有幸参加其中之一的考试系统。在考试系统中存在这样一种情况,关于题库表怎么在数据库中存放的问题。
题库看着简单的两个字,却包含了很多,题库中包含很多题型,每个题型有很多题,就廊坊师范学院来说,到现在为止,经历过得题型就有28种,而且每年都有可能会新增很多题型,如果单纯只是将题型列举,怎么也列举不完,每个题型中有多少道题也不确定,也许今年多,明年就少,也许今年少,明年多。。。
那么应该如何解决这个问题?有以下三种解决方案:
第一:动态建表(题型+课程=一个题库)
动态建表,一个题型和一门课程决定一张题库表,当在给课程配置章节题型的时候就动态创建这张表。
弊端:
会用到sql语句,不符合面向对象的思想
抽题时访问表数量多
第二:28种题库表+动态创建表(添加新题型时动态加表)
列举现有的28中题型,这28个题型符合面向对象思想,对于新添加的题型,采用sql语句创建和操作。抽题时,从相应题型对应的题库表中抽取。
弊端:
数据库中题库表太多,仍然需要sql语句,不符合面向对象思想
对于动态创建的表,在抽题过程中需要访问的表数量多
第三:所有题型的题放在一张表
优点:
方便添加新题型
抽题时只需查询一张表
弊端:
表中数据量大,考试时,访问数据频繁,容易瘫痪
数据冗余,存在多余字段
我们最后选择了第三种解决方案,理由如下:
主要是应对新题型更加灵活,抽题方便,关于它存在的弊端,我们的解决方法是抽题提前,考试前将这门课程的题取出来放在一张临时表中,抽题过程中访问这张临时表,除此之外,提前抽题,考试前几分钟,将题按照一定规则取出入库。
既然这种方案方便添加新题型,那么他又是如何方便的呢?在设计相应的表时又是如何设计的呢?
我们分析知道,一个再复杂的题型构成的题库都是由最基本的一些属性(比如课程、题型等)+选项+空数+正确答案+听力+题库从表等最基本的组件组成的。因此我们设计的表是这样的。
题组件如下:将组件当做一个题型分别存入题型和题型详情中
题型表和题型详情表如下:
题库表如下:
关于添加题型的页面如下:组合成新题型后存入题型和题型详情表中喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+ICAgICAgICAgICAgIDxpbWcgc3JjPQ=="http://www.2cto.com/uploadfile/Collfiles/20141226/20141【本文来自鸿网互联 (http://www.68idc.cn)】22609232952.png" alt="">
道路是曲折的,实现是纠结的,至于效果嘛,还不知道,正在实现中。。。。。。。

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

Subqueries can improve the efficiency of MySQL query. 1) Subquery simplifies complex query logic, such as filtering data and calculating aggregated values. 2) MySQL optimizer may convert subqueries to JOIN operations to improve performance. 3) Using EXISTS instead of IN can avoid multiple rows returning errors. 4) Optimization strategies include avoiding related subqueries, using EXISTS, index optimization, and avoiding subquery nesting.

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

Renaming a database in MySQL requires indirect methods. The steps are as follows: 1. Create a new database; 2. Use mysqldump to export the old database; 3. Import the data into the new database; 4. Delete the old database.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version
Recommended: Win version, supports code prompts!

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor
