Difference between revisions of "Database Table: birthdays"

From Dreamwidth Notes
Jump to: navigation, search
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#set:name=birthdays|table type=global}}
+
{{Database Table|name=birthdays|table type=clustered|repo=dw-free}}
 
[[Description::This is a table on the clustered database that stores information about upcoming birthdays.]] Note that actual birthdates are stored in {{DBField|user|bdate}}.
 
[[Description::This is a table on the clustered database that stores information about upcoming birthdays.]] Note that actual birthdates are stored in {{DBField|user|bdate}}.
 
= Definition =
 
= Definition =
 
 
<source lang="sql">
 
<source lang="sql">
 
CREATE TABLE birthdays (
 
CREATE TABLE birthdays (
  userid INT UNSIGNED NOT NULL,
+
    userid INT UNSIGNED NOT NULL,
  nextbirthday INT UNSIGNED,
+
    nextbirthday INT UNSIGNED,
  PRIMARY KEY (userid),
+
 
  KEY (nextbirthday)
+
    PRIMARY KEY (userid),
 +
    KEY (nextbirthday)
 
)
 
)
 
</source>
 
</source>
 
{{Database Table Footer}}
 
{{Database Table Footer}}

Latest revision as of 11:43, 7 September 2010

This is a clustered table. This is a table on the clustered database that stores information about upcoming birthdays. Note that actual birthdates are stored in user.bdate.

Definition

CREATE TABLE birthdays (
    userid INT UNSIGNED NOT NULL,
    nextbirthday INT UNSIGNED,
 
    PRIMARY KEY (userid),
    KEY (nextbirthday)
)

Relationships

Outgoing

  • Foreign key: userid to user.userid