feipoh 0 Report post Posted October 18, 2006 Hello ,On most tutorial website for mysql all the date format is in this form 2006-10-17..User table-----------User_name VARCHAR(20),Join_date DATE,Alive VARCHAR(1),..etc etc I was wondering , 1) is it possible that i can put the date in this format 17/10/2006.. rather the usual 2006-10-17??Also.... how can i initial a default value to a column..e.g...Alive VARCHAR(1) NOT NULL,When i create a table User2) How can i initial 'Y' Or 'True/false' as the initial value in column Alive, e.g... if i type DESCRIBE USER Field Type NULL Defaultit will show-> user_name varchar(20) No Join_date date No No 00/00/0000 Alive varchar(1) No YOR DESCRIBE USER Field Type NULL Defaultit will show-> user_name varchar(20) No Join_date date No 00/00/0000 Alive boolean No TrueThank you! Share this post Link to post Share on other sites
Galahad 0 Report post Posted October 20, 2006 (edited) It would have been better, if you had put this into PHP section of the forums... Mods, please move it when you see it...Here's an example of what you are trying to do: CREATE TABLE `probni` (`field1` VARCHAR(20) DEFAULT 'field test' NOT NULL,`field2` DATE DEFAULT '00-00-0000' NOT NULL,`field3` VARCHAR(1) DEFAULT 'Y' NOT NULL); As you can see, you should only put DEFAULT keyword, before setting the new default value for the field... Also, I don't think you can change the format of the DATE field, if you're not comfortable with it, use your own format, in a regular text field, or UNIX timestamp in a number field... I think that about covers it...Oh yes, there is no BOOLEAN type in MySQL (at least in version 4.x), so you can either use ENUM, and specify True and False as it's values (or Yes/No, or others), or use number type, and use 1 and 0...Hope this helped... Edited October 20, 2006 by Galahad (see edit history) Share this post Link to post Share on other sites