A little tutorial for me please? Rep+
#2

First four are datatypes. For integers, the number between the brackets is used when the "zerofill" option is used; in that case the number gets padded with zeros in front to meet the specified amount of digits.
For the varchar type (variable length string) it denotes the maximum length of the string.

Every table has, or rather should have, a primary key. The primary key uniquely identifies a row in the table. It is used when updating or deleting a row. The primary key mustn't have any intrinsic value (name, e-mail address, social security number, ...) so a surrogate automatically incrementing integer key is often chosen.

There are a few different storage engines. The most common ones are MyISAM and InnoDB. MyISAM is always enabled while InnoDB may not be. If InnoDB is available, then use InnoDB. MyISAM used to be faster retrieving data but the difference between MyISAM and InnoDB in that context is neglectable nowadays.

NOT NULL specifies that the column does not accept NULL values. NULL is special in that it is equal to nothing, not even to itself. If a column is NULL it means the value is unknown. It is different from 0. Let's say you ask someone how many children they have. If the column is 0 you know they have no children. If the column is NULL you don't know how many children they have (yet).

The DEFAULT keyword is followed by a default value for that column. If no value is specified for the column when a new row is inserted the default value will be used.

Much of this information, however, could've been found out by Googling.
Reply


Messages In This Thread
A little tutorial for me please? Rep+ - by radiobizza - 01.04.2016, 20:02
Re: A little tutorial for me please? Rep+ - by Vince - 01.04.2016, 20:54

Forum Jump:


Users browsing this thread: 1 Guest(s)