# Create member_pass table for US Historical League
# It generates a member_pass table containing a password for each
# member by calculating an MD5() checksum based on the member's name
# taking the first 8 characters.
# It also inserts a row for the fake member ID value of 0 that is used
# for the administrative password (use this password to get permission
# to edit any entry)

CREATE TABLE member_pass
(
	member_id INT UNSIGNED NOT NULL PRIMARY KEY,
	password CHAR(8)
);
INSERT INTO member_pass (member_id, password)
	SELECT
		member_id,
		LEFT(MD5(CONCAT(last_name, first_name)), 8) AS password
	FROM member;
INSERT INTO member_pass (member_id, password) VALUES(0, "secret");
