摘要:
For every database, you should set the root or sa passwords to something other than the default, unless you want to get hacked. For mysql, the system administrator user is called root. You will use the mysqladmin utility from a command line to set the new password. Notice that there are two commands 阅读全文
摘要:
这个可选的宽度规格说明是用于在数值显示时,对某些值的宽度短于该列宽度的值进行左填补显示的,而不是为了限制在该列中存储值的宽度,也 不是为了限制那些超过该列指定宽度的值的可被显示的数字位数。注意,如果在一个整型列中存储一个超过显示宽度的更大值时,当mysql为某些复杂的联结(join)生成临时表时,你可能会遇到问题,因为在这种情况下,mysql信任地认为所有的值均适合原始的列宽度。而int本身就是4个字节 bigint是8个字节 所以说int(X)的含义就是 int决定数据存储的字节 X表示期望数据的列宽度在SQL语句中int代表你要创建字段的类型,int代表整型,11代表字段的长度。这个代表显 阅读全文
摘要:
参考http://docs.djangoproject.com/en/dev/topics/db/models/简介Model 描述了数据模型,通过 Python 的类实现与关系数据库的对应(即著名的 ORM — Object Relation Mapping)。通常,我们定义的每个 Model 对象都对于 一个数据库表。每个 Model 都是 django.db.models.Model 的子类Model 对象的每个属性都是数据表中的一个区域通过这些对应,Django 可以自动同数据库交互 (请参考:Making queries -- 模型数据库查询)Quick example假设有如下 m 阅读全文
摘要:
mysql> DESCRIBE city;+------------+----------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+------------+----------+------+-----+---------+----------------+| Id | int(11) | NO | PRI | NULL | auto_increment || Name | char(35) | NO | | | || Country | char(3 阅读全文
摘要:
(After having explained this for the 35th time, I decided it's time to simply put something on-line.)When a MyISAM table grows large enough, you'll encounter the dreaded "The table is full" error. Now I could simply point at that page and leave this subject alone, but there's m 阅读全文
摘要:
Most programmers may already know the main different between CHAR and VARCHAR - Thefirst onesupports fixed-length data and the second one supports variable-lengths of data.Some people may think, since VARCHAR can do what CHAR does, then why we still need CHAR in ourdatabase design. I even have heard 阅读全文