AGConsoleHelp.Пример SQL запроса для MySQL
Версия от 09:08, 13 апреля 2015; Grax (обсуждение | вклад) (Новая страница: «CREATE TABLE Coordinate ( ID int(11) NOT NULL auto_increment, DeviceID int(11) NOT NULL, FlagsId int(11) NULL, DataDateTime datetime NOT NULL, Latitud…»)
CREATE TABLE Coordinate (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NULL,
DataDateTime datetime NOT NULL,
Latitude double NULL,
Longtitude double NULL,
lnHDOP decimal(1,0) NULL,
HDOP decimal(2,0) NULL,
ValidTime decimal(1,0) NOT NULL,
Source decimal(1,0) NULL,
Power decimal(1,0) NOT NULL,
ReservPower decimal(1,0) NULL,
Antenna1 decimal(1,0) NULL,
Antenna2 decimal(1,0) NULL,
SatCount decimal(2,0) NULL,
Speed float NULL,
Azimut int(11) NULL,
Altitude int(11) NULL,
In1 decimal(1,0) NULL,
In2 decimal(1,0) NULL,
In3 decimal(1,0) NULL,
In4 decimal(1,0) NULL,
In5 decimal(1,0) NULL,
In6 decimal(1,0) NULL,
In7 decimal(1,0) NULL,
In8 decimal(1,0) NULL,
Flag1 decimal(1,0) NULL,
Flag2 decimal(1,0) NULL,
Flag3 decimal(1,0) NULL,
Flag4 decimal(1,0) NULL,
Flag5 decimal(1,0) NULL,
Flag6 decimal(1,0) NULL,
Flag7 decimal(1,0) NULL,
Flag8 decimal(1,0) NULL
PRIMARY KEY (ID)
);
CREATE TABLE Flags (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Power decimal(1,0) NOT NULL,
ReservPower decimal(1,0) NULL,
Antenna1 decimal(1,0) NULL,
Antenna2 decimal(1,0) NULL,
In1 decimal(1,0) NULL,
In2 decimal(1,0) NULL,
In3 decimal(1,0) NULL,
In4 decimal(1,0) NULL,
In5 decimal(1,0) NULL,
In6 decimal(1,0) NULL,
In7 decimal(1,0) NULL,
In8 decimal(1,0) NULL,
Flag1 decimal(1,0) NULL,
Flag2 decimal(1,0) NULL,
Flag3 decimal(1,0) NULL,
Flag4 decimal(1,0) NULL,
Flag5 decimal(1,0) NULL,
Flag6 decimal(1,0) NULL,
Flag7 decimal(1,0) NULL,
Flag8 decimal(1,0) NULL,
PRIMARY KEY (ID)
);
CREATE TABLE Analog (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
UPower int(11) NOT NULL,
UReservPower int(11) NULL,
AIN1 int(11) NOT NULL,
AIN2 int(11) NOT NULL,
FlagsId int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE CAN1 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Speed int(11) NOT NULL,
CruiseControl decimal(1,0) NOT NULL,
BrakePedal decimal(1,0) NOT NULL,
CouplingPedal decimal(1,0) NOT NULL,
LayBrake decimal(1,0) NOT NULL,
GasPedal int(11) NOT NULL,
FuelConsumption int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE CAN2 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
FuelLevel1 int(11) NOT NULL,
FuelLevel2 int(11) NOT NULL,
FuelLevel3 int(11) NOT NULL,
FuelLevel4 int(11) NOT NULL,
FuelLevel5 int(11) NOT NULL,
FuelLevel6 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE CAN3 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
EngineTurns int(11) NOT NULL,
TripToService int(11) NOT NULL,
MotoHours int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE CAN4 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
CoolingTemp int(11) NOT NULL,
OilTemp int(11) NOT NULL,
FuelTemp int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE CAN5 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
TotalTrip int(11) NOT NULL,
DayTrip int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE CAN6 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
RecId int(11) NOT NULL,
Wheel1 int(11) NOT NULL,
Wheel2 int(11) NOT NULL,
Wheel3 int(11) NOT NULL,
Wheel4 int(11) NOT NULL,
Wheel5 int(11) NOT NULL,
Wheel6 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE CAN7 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
RecId int(11) NOT NULL,
User1 int(11) NOT NULL,
User2 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE Count12 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Count1 int(11) NOT NULL,
Count2 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE Count34 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Count3 int(11) NOT NULL,
Count4 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE Count56 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Count5 int(11) NOT NULL,
Count6 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE Count78 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Count7 int(11) NOT NULL,
Count8 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE Event (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
EventId int(11) NOT NULL,
EventData binary(5) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE InExp (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
InHeight int(11) NOT NULL,
InLow int(11) NOT NULL,
InStatus int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE LLS14 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
LLS1 int(11) NOT NULL,
ValidLLS1 decimal(1,0) NOT NULL,
LLS2 int(11) NOT NULL,
ValidLLS2 decimal(1,0) NOT NULL,
LLS3 int(11) NOT NULL,
ValidLLS3 decimal(1,0) NOT NULL,
LLS4 int(11) NOT NULL,
ValidLLS4 decimal(1,0) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE LLS58 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
LLS5 int(11) NOT NULL,
ValidLLS5 decimal(1,0) NOT NULL,
LLS6 int(11) NOT NULL,
ValidLLS6 decimal(1,0) NOT NULL,
LLS7 int(11) NOT NULL,
ValidLLS7 decimal(1,0) NOT NULL,
LLS8 int(11) NOT NULL,
ValidLLS8 decimal(1,0) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE Temp14 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Temp1 int(11) NOT NULL,
Temp2 int(11) NOT NULL,
Temp3 int(11) NOT NULL,
Temp4 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE Temp58 (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
Temp5 int(11) NOT NULL,
Temp6 int(11) NOT NULL,
Temp7 int(11) NOT NULL,
Temp8 int(11) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE iButton (
ID int(11) NOT NULL auto_increment,
DeviceID int(11) NOT NULL,
FlagsId int(11) NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
iButtonId binary(6) NOT NULL
PRIMARY KEY (ID)
);
CREATE TABLE TirePressure (
ID int(11) NOT NULL auto_increment,
DeviceID int NOT NULL,
FlagsId int NOT NULL,
DataDateTime datetime NOT NULL,
ValidTime decimal(1,0) NOT NULL,
WheelPosition int NOT NULL,
AxletreePosition int NOT NULL,
TireTemperature int NOT NULL,
Pressure float NOT NULL,
LowPressure decimal(1,0) NOT NULL,
HighPressure decimal(1,0) NOT NULL,
HighTemperature decimal(1,0) NOT NULL,
LowBattery decimal(1,0) NOT NULL,
Reserv decimal(1,0) NOT NULL,
HighLeakage decimal(1,0) NOT NULL,
LowLeakage decimal(1,0) NOT NULL,
TireDamage (1,0) NOT NULL,
PRIMARY KEY (ID)
);