Answer the question
In order to leave comments, you need to log in
Design a table relationship?
There is this table:
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nickname` varchar(30) DEFAULT NULL,
`email` varchar(30) DEFAULT NULL,
`password` varchar(32) DEFAULT NULL,
`reg_date` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `nickname` (`nickname`)
)
Answer the question
In order to leave comments, you need to log in
ID
UNIQUE KEY `nickname` (`nickname`)
and `nickname` varchar(30) DEFAULT NULL
means that there can be only one user without a nickname.
Firstly, use an ID
; secondly, expand the mail field to 256 characters, make a unique index on it
so what is better to take the id or nickname field?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question