我必须创建多少个数据库表? [英] How Many Database Tables Must I Create?

查看:99
本文介绍了我必须创建多少个数据库表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库,其中有一个表来存储学生记录,其中包含字段 - studentId,student_name,student_ department和student_marks。现在我的应用程序旨在以excel表格的形式导入学生详细信息。学院的每个部门都应该将相应的excel表格提交给将数据导入数据库的应用程序的用户。



我应该只创建一个表格或每个部门的单独表格?如果我只创建一个表,如何防止双重导入同一个Excel表?如果我为每个部门创建单独的表,我猜这个检查会变得更容易,但创建一个单独的表似乎不对。

I have a database with one table to store student records with the fields - studentId , student_name , student_ department and student_marks. now my application is designed to import student details in the form of excel sheets. each department in the institute is supposed to submit its respective excel sheet to the user of the application who will import the data into the database.

should I create only one table or a separate table for each department? if I create only one table how can I prevent double import of the same excel sheet? if I create separate tables for each department this check becomes easier I guess but it just doesn't seem right to create a separate tables.

推荐答案

你应该有一个单独的表表为部门,每个部门都会给出一个唯一的ID。然后,您的学生记录应包含一个具有该学生部门ID的字段。可以使用主键和外键字段链接记录。
You should have a separate table for the departments, and each department will be given a unique id. Your student records should then each contain a field with the id of that student's department. Records can be linked using primary and foreign key fields.


我的目标是第三范式 [ ^ ](如果我正确阅读了您的要求)表示学生[Id,Name]的一个表和StudentMarks的一个表[StudentID,Department,Mark]
I would aim for Third Normal Form[^] which (if I read your requirement correctly) would mean one table for Students [Id, Name] and one table for StudentMarks [StudentID, Department, Mark]


这篇关于我必须创建多少个数据库表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆