Discussion:
[Middlegen-user] Re: script SQM for mySQL
a***@bekk.no
2002-03-14 09:07:05 UTC
Permalink
<FONT face="Default Sans Serif, Verdana, Arial, Helvetica, sans-serif" size=2><DIV><DIV><DIV>Salut Richard,</DIV><DIV>&nbsp;</DIV><DIV>I'm using mysql 3.23.47-max (with InnoDB enabled. You need that for fk/relations). Use mysqld-max to start the database.</DIV><DIV>Driver: mm.mysql 2.0.9. (you might wanna try a later version)</DIV><DIV>&nbsp;</DIV><DIV>Here&nbsp;is a script that creates some tables with relations.</DIV><DIV>&nbsp;</DIV><DIV>DROP TABLE reservation;<BR>DROP TABLE flight;<BR>DROP TABLE person;</DIV><DIV>CREATE TABLE person(<BR>&nbsp;person_id INT NOT NULL,<BR>&nbsp;first_name VARCHAR(32) NOT NULL,<BR>&nbsp;last_name VARCHAR(32) NOT NULL,<BR>&nbsp;PRIMARY KEY( person_id )<BR>) TYPE=INNODB;</DIV><DIV>CREATE TABLE flight(<BR>&nbsp;flight_id INT NOT NULL,<BR>&nbsp;name VARCHAR(32) NOT NULL,<BR>&nbsp;departure_utc DATETIME NOT NULL,<BR>&nbsp;arrival_utc DATETIME NOT NULL,<BR>&nbsp;PRIMARY KEY( flight_id )<BR>) TYPE=INNODB;</DIV><DIV>CREATE TABLE reservation(<BR>&nbsp;reservation_id INT NOT NULL,<BR>&nbsp;person_id_fk INT NOT NULL,<BR>&nbsp;flight_id_fk INT NOT NULL,<BR>&nbsp;registration_utc DATETIME NOT NULL,<BR>&nbsp;comment TEXT,<BR>&nbsp;PRIMARY KEY(reservation_id,person_id_fk,flight_id_fk),<BR>&nbsp;INDEX person_ind(person_id_fk),<BR>&nbsp;INDEX flight_ind(flight_id_fk),<BR>&nbsp;FOREIGN KEY (person_id_fk) REFERENCES person(person_id),<BR>&nbsp;FOREIGN KEY (flight_id_fk) REFERENCES flight(flight_id)<BR>) TYPE=INNODB;</DIV><DIV>INSERT INTO person VALUES(1,'Aslak','Hellesøy');<BR>INSERT INTO person VALUES(2,'Jesus','Christ');<BR>INSERT INTO person VALUES(3,'Allah','Akhbar');</DIV><DIV>INSERT INTO flight VALUES(1,'SK000','1971-02-28 23:45:00','2002-02-14 16:51:00' );<BR>INSERT INTO flight VALUES(2,'HV000','0001-12-24 00:00:00','0035-06-19 21:07:00' );<BR>INSERT INTO flight VALUES(3,'MY000','1234-02-28 23:45:00','2005-02-14 16:51:00' );</DIV><DIV>SELECT * FROM person;</DIV><DIV>&nbsp;</DIV><DIV>for more info about relations and fks in mysql, please refer to the mysql manual.</DIV><DIV>-and please use the mailing list for support. next time you mail me personally, i'll send you an invoice ;-)</DIV><DIV>&nbsp;</DIV><DIV>hth,</DIV><DIV>aslak</DIV><DIV>&nbsp;</DIV><FONT color=#990099>-----"Richard Aillet" &lt;***@kalimagroup.com&gt; wrote: -----<BR><BR></FONT>To: &lt;***@bekk.no&gt;<BR>From: "Richard Aillet" &lt;***@kalimagroup.com&gt;<BR>Date: 03/14/2002 11:40AM<BR>Subject: script SQM for mySQL<BR><BR><div class=Section1><p class=MsoNormal><font size=2 face=Arial><TABLE class=s-form-bg cellSpacing=0 cellPadding=2 width="100%" border=0> <TBODY> <TR> <TD colSpan=3> <DIV class=s-form-bodyhtml-read id=MAILBODY style="WIDTH: 100%; HEIGHT: 100px" onclick=wx() target="_blank"> <DIV class=Section1> <P class=MsoNormal><FONT face=Arial size=2></font></p></div></DIV></TD></TR> <TR id=AttachRow> <TD colSpan=3> </TD></TR></TBODY></TABLE></P><DIV id=AnimationDiv style="DISPLAY: none; Z-INDEX: 300; VISIBILITY: hidden; POSITION: absolute"></DIV></FONT></DIV></DIV></DIV></FONT>
Loading...