Jump to content

mysql


termanater13

Recommended Posts

NULL/NOT NULL defines whether the default for the value is NULL or notyou have to define a primary key, and it has to be different for every entry in the photo (I usually auto_increment this)and i don't believe the rest serve any great importance, I havn't bothered with them when setting up my tables (although the primary key is indexed by default)you can find a little more information here, or go to the official mysql site -> community -> documentationPS: this should be in the mysql area, the fact that you are using php with it is fairly irrelavent in this case

Link to comment
Share on other sites

there is not MySql are, there is a sql area, and last time I checked SQL is a server code to communicate with a database, while MySql is the database part of the server, and MySql uses the SQL script to do what you want it to. and to let you know thats what every site Ive been to said about NULL and NOT NULL, what can I do if its set to NULL and NOT NULL

Link to comment
Share on other sites

there is not MySql are, there is a sql area, and last time I checked SQL is a server code to communicate with a database, while MySql is the database part of the server, and MySql uses the SQL script to do what you want it to.
That's right. MySQL is a relational database management system (DBMS), and it understands a variant of the Structured Query Language (SQL) to perform operations. Other DBMSs include things like Microsoft SQL Server, Oracle, PostgreSQL, Microsoft Access, etc.NULL and NOT NULL do not necessarily have to do with the default value, they just say whether a column can accept a NULL value at all. NULL is a special value that essentially means "no value". If a column has a value of NULL, then the column basically has no value. Usually if you compare NULL to anything the result is false, even if you check if NULL = NULL, the answer is still false. There is a special function to check if the value is NULL. So, if a column is set to NULL then all that means is that the column is allowed to have a NULL value. If a column is set to NOT NULL, then NULL values are not allowed. That is, if you do an insert on a table that does not allow NULL values, all columns need to be given a value. You can insert a row into a table, and if there are columns that allow NULLs you can skip them, and the skipped columns will be given NULL values. You can't do that with a table that does not allow NULLs. Saying that a column is NOT NULL basically means that the column is required. Or, if you are upgrading an application and need to add columns to a table that already has records, you *must* add columns as NULL columns, so that all of the existing rows can get a NULL value there. If you add a new column as NOT NULL, even if it has a default, the existing rows will fail because they don't allow NULLs and the table update operation in general will fail.A primary key is a column or columns that is defined on a table that must be unique for every row of that table. If you have a single column as a primary key, then every row in the table needs to have a different value for the primary key. Primary keys on a table are necessary for fast searching on the table. People typically use an integer column and set it up as an autonumber (a column where the DBMS will automatically increment the value each time a new row is inserted). But, you can make the primary key whatever you want. You can even make multiple columns the primary key. For example, if you have one table called "books", you might have a column called "book_id" that is an autonumber primary key. You might also have a table called "authors", where the "author_id" column is an autonumber primary key. And if you have a table to relate the books and authors, such as "book_authors", where you have 2 columns, "book_id" and "author_id", which says a certain person is the author of a certain book, you could set both columns as the primary key. Then, you could have several records in the table with the same book_id, and several with the same author_id, but you could only have 1 record with the same book_id/author_id combination.Table indexes are important for everything. Whenever you do an operation on a table such as SELECT, UPDATE, or DELETE, the presence of indexes on the table will determine how long that operation takes. If the table has good indexes, the operation will be quick. If the table has poor or no indexes, the operation will take longer. Choosing the correct indexes for your tables is one way to speed up the operation of your database. Also, being able to design the database correct in the first place with appropriate indexes is one skill of database design. You can read about indexes on Wikipedia, and at the bottom of the page you can see links to other database topics, such as primary keys and foreign keys:http://en.wikipedia.org/wiki/Index_(database)Unique is what it says - a column that is unique cannot have duplicate values in the table. Each row must have a different value. This is similar to a primary key, except that the column is not indexed.A full text index is used for searching. When a column is labelled as a full text index, the entire text in the column is used as an index for later searching. This helps drastically speed up searching the column, versus the same thing with no full text index. Different DBMSs handle full text searching differently, so you can read about how MySQL does it here:http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...