I am new to database design and despite my research I can really only find basic examples on design which does not help for my situation.
Currently using MySQL
The problem I have is as follows:
I am building a site to manage aircraft information, then display that information and how it changes in the form of graphs (things like air speed, plane speed, wing tilt, ect ect).
At the moment I get all this data in CSV form, but different planes give different data (for example one plane might not have wing tilt).
At the moment all I have set up is a table with userID, username, and password.
The concept I do not understand is how I can store something like planeSpeed, especially since it would be a bunch of numbers because it is over the course of the flight (it gets a value every minute).
Also some users would have multiple planes.
So I am stuck visualizing this as a column would be airspeed and then have a ton of numbers in it?
Or would I somehow build a separate table for each plane and instead of userID I would have time?
Very unsure how to design this, any help or tips would be a huge help, sorry for sounding so inexperienced have never built more than a simple login before.
Best Answer
As user1786423 said in your question's comment, you will probably have a
User
table, anAircraft
table and a table for each type of measurement.As a minimum,
User
would have an id, sayidUser
. I'd imagine there would be more static data about a user in there as well.As a minimum,
Aircraft
would have an id, sayidAircraft
, andidUser
.idUser
would referenceUser.idUser
. I'd imagine there would be more static data about an aircraft in there as well.The
AirspeedMeasurement
table would have, based on your descriptions, columns likeidAirspeedMeasurement
,idAircraft
,time
,airSpeed
.idAircraft
would referenceAircraft.idAircraft
.You may want to have a parent table for all of the measurements. For example, an
AircraftMeasurement
table would have the columnsidAircraftMeasurement
,idAircraft
,time
. Then, the child tables would have a primary key that referencesidAircraftMeasurement
, and wouldn't have to each storeidAircraft
andtime
.An ER diagram would look something like this:
Some sample data:
In this example Aircraft 1 records
PlaneSpeedMeasurement
s andWingTiltMeasurement
s, whilst Aircraft 2 only recordsPlaneSpeedMeasurement
s.Let us know if something is unclear : ]