----- Original Message ----- From: "Aji Andri" <[EMAIL PROTECTED]> To: <mysql@lists.mysql.com> Sent: Saturday, April 02, 2005 2:13 AM Subject: Newbie :create table multi, index
> hi seniors, > I assume that English is not your first language. "Seniors" means "old people" and some people would be offended by being called old if they are not old ;-) > I'm trying to create a table, here my table > properties, > > create table user ( > UserID int primary, > Password varchar (20), > User_stats int multi > ); > > i'm still confuse in User_stats properti's that is > multi, > what really use 'multi' is ? > and what the conection between primary key and index > I don't know what you are trying to do with the word 'multi'. If you look at the article in the manual that describes CREATE TABLE - http://dev.mysql.com/doc/mysql/en/create-table.html - the word 'multi' is not one that belongs in a CREATE TABLE statement. I assume that 'user_stats' is the name that you want to give to your third column and you want the datatype to be 'int'. That's fine, but I don't see what you want the word 'multi' to do in that statement. The primary key clause in your statement tells MySQL that the columns named in the clause uniquely identify each row in the table. For example, if you say primary key(UserID) you are saying that each row of the table has a different, non-null, value in UserID. In other words, each row in the table can be uniquely identified by the value of UserID; you will never get two or more rows that have the same UserID. This is very important because most updates will be made based on the primary key value and you will want to be sure that only the desired row gets updated. An index is a shortcut that helps the database find rows more quickly. However, if you have no indexes, the database will still be able to find the rows that satisfy your query. An index in a database is very similar to an index in a reference book: if you have an index in a book, you can look up the information you want in the index and you will see that the information can be found on page 27; then, you can go to page 27 and find the exact information. If you don't have an index, you can still find the information but you'll have to read every page of the book to find it, which will usually take much longer. Database designers usually created indexes on the primary keys of tables. In fact, some databases *automatically* build primary key indexes. However, indexes don't have to be unique. You can create indexes on non-unique columns of a table if you like. For instance, if you had a column listing the name of the city in which your customers live, you can create an index on that column. Then, if you want to find all the rows where the city is Tokyo, the index will help the database find all the Tokyo customers faster. Non-unique indexes normally have to be built manually via CREATE INDEX statements. Rhino -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 01/04/2005 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]