Alex Rivera | Logout

How to define the default values for a column when creating tables in MySQL?

Asked 2011-04-27T21:01:58.543
22

What is the SQL to define DEFAULT values in MySQL?

In the code below what needs to be added / changed to give IsObsolete a default value of N?

CREATE TABLE Team
(
    TeamId              CHAR(16) NOT NULL,
    DateCreated          TIMESTAMP NOT NULL,
    IsObsolete           CHAR(1) NOT NULL DEFAULT N,
    UpdateTime           TIMESTAMP NOT NULL
);
Edit
Report

2 Answers

24
IsObsolete           CHAR(1) NOT NULL DEFAULT 'N'
answered 2011-04-27T21:05:51.450
1

If your are changing your structure via phpMyAdmin, you should just type in the char (e.g N) as opposed to 'N'

answered 2013-03-26T09:29:50.283

Your Answer