Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
barricades
Starting Member
2 Posts |
Posted - 2011-03-10 : 10:22:56
|
| Hi there, I've been following a tutorial and in it a Categories table has to be created, the tutorial gives the following sqlCREATE TABLE IF NOT EXISTS 'categories' ('id' int (10) unsigned NOT NULL auto_increment,'parent_id' int(11) NOT NULL default '0','name' varchar(50) character NOT NULL,'description' varchar(200) character NOT NULL,PRIMARY KEY ('id'),KEY 'cat_parent_id' ('parent_id'),KEY 'cat_name' ('name'));The last two lines (eg KEY 'cat_name' ('name')) I'm not too sure about what that means. I've googled and only found out that it might have something to do with indexes. From what I've read I understand indexes (sort of) but I can't find anywhere which uses that KEY instruction when creating a table. Any other article I find about indexes uses something like: CREATE INDEX IDX_CUSTOMER_LAST_NAMEon CUSTOMER (Last_Name)Can anyone explain what exactly KEY does, and what the 'cat_name' ('name') beside it means, is cat_name and alias? Obviuosly 'name' is the column in the table that the instruction is dealing with.confused... |
|
|
|
|
|