EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Database/World Building (https://www.eqemulator.org/forums/forumdisplay.php?f=625)
-   -   Quick MYSQL question... (https://www.eqemulator.org/forums/showthread.php?t=9329)

Kolo 09-04-2003 05:58 PM

Quick MYSQL question...
 
How would you phrase a CREATE statement to state the following...

I have 2 columns, each column can have duplicate values, but no rows can have both duplicated...hrm..example:
| I1| I2| Data
| 1 | 2 | Data
| 1 | 3 | Data
| 2 | 2 | Data
| 3 | 1 | Data
| 3 | 2 | Data

but I could not add (1 | 3) again. I1 and I2 are the keys in this example. I've been searching the internet for a response to this but keep coming up with syntax formats and whatnot. I would prefer a plain english response :)

Thanks in advance...

Kolo 09-04-2003 06:14 PM

I think I might have gotten it, but I want to be sure this is the correct method of doing this :/

CREATE TABLE `blah` (
`ID_1` int(11) unsigned NOT NULL default '0',
`ID_2` int(11) unsigned NOT NULL default '0',
`data` varchar(50) NOT NULL default '',
PRIMARY KEY (`ID_1`,`ID_2`),
UNIQUE KEY `Unique` (`ID_1`,`ID_2`)
);

Again, if you can provide me insight on this, Thanks!


All times are GMT -4. The time now is 09:19 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.