37
37
KEY `numreponse` (`numreponse`)
39
39
CREATE TABLE `t2` (
40
`numeropost` bigint(20) unsigned NOT NULL default '0',
41
`icone` tinyint(4) unsigned NOT NULL default '0',
42
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
40
`numeropost` bigint NOT NULL default '0',
41
`icone` int NOT NULL default '0',
42
`numreponse` bigint NOT NULL auto_increment,
43
43
`contenu` text NOT NULL,
44
44
`pseudo` varchar(50) NOT NULL default '',
45
`date` datetime NOT NULL default '0000-00-00 00:00:00',
46
`ip` bigint(11) NOT NULL default '0',
47
`signature` tinyint(1) unsigned NOT NULL default '0',
46
`ip` bigint NOT NULL default '0',
47
`signature` int NOT NULL default '0',
48
48
PRIMARY KEY (`numeropost`,`numreponse`),
50
50
KEY `date` (`date`),
570
569
replace into t1 select * from t2;
571
570
select * from t1;
576
575
drop table t1,t2;
577
CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
578
CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
576
CREATE TABLE t1 ( USID INTEGER, ServerID int, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER, NASPort INTEGER, NASPortType INTEGER, ConnectSpeed INTEGER, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER, SessionTime INTEGER, PacketsIn INTEGER, OctetsIn INTEGER, PacketsOut INTEGER, OctetsOut INTEGER, TerminateCause INTEGER, UnauthTime int, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
577
CREATE TABLE t2 ( USID INTEGER AUTO_INCREMENT, ServerID int, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER, NASPort INTEGER, NASPortType INTEGER, ConnectSpeed INTEGER, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER, SessionTime INTEGER, PacketsIn INTEGER, OctetsIn INTEGER, PacketsOut INTEGER, OctetsOut INTEGER, TerminateCause INTEGER, UnauthTime int, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
579
578
INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
580
579
INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
581
580
drop table t1,t2;
583
582
Month date NOT NULL,
584
Type tinyint(3) unsigned NOT NULL auto_increment,
585
Field int(10) unsigned NOT NULL,
586
Count int(10) unsigned NOT NULL,
583
Type int NOT NULL auto_increment,
587
587
UNIQUE KEY Month (Month,Type,Field)
589
insert into t1 Values
590
(20030901, 1, 1, 100),
591
(20030901, 1, 2, 100),
592
(20030901, 2, 1, 100),
593
(20030901, 2, 2, 100),
594
(20030901, 3, 1, 100);
589
insert into t1 Values (20030901, 1, 1, 100);
590
insert into t1 Values (20030901, 2, 2, 100);
591
insert into t1 Values (20030901, 3, 3, 100);
592
insert into t1 Values (20030901, 4, 4, 100);
593
insert into t1 Values (20030901, 5, 5, 100);
595
594
select * from t1;
596
595
Month Type Field Count
597
596
2003-09-01 1 1 100
600
597
2003-09-01 2 2 100
602
601
Select null, Field, Count From t1 Where Month=20030901 and Type=2;
606
604
create table t2(No int not null, Field int not null, Count int not null);
607
605
insert into t2 Select 0, Field, Count From t1 Where Month=20030901 and Type=2;
608
606
select * from t2;
612
609
drop table t1, t2;
613
610
CREATE TABLE t1 (
614
ID int(11) NOT NULL auto_increment,
615
NO int(11) NOT NULL default '0',
616
SEQ int(11) NOT NULL default '0',
611
ID int NOT NULL auto_increment,
612
NO int NOT NULL default '0',
613
SEQ int NOT NULL default '0',
617
614
PRIMARY KEY (ID),
618
615
KEY t1$NO (SEQ,NO)