Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if a field is NULL or NOT NULL in mysql workbench gui?

Is there any gui functionality within mysql workbench where you can view whether a field is set to NULL or NOT NULL?

For example this:

CREATE TABLE Peoples (
id INT NOT NULL AUTO_INCREMENT,
first_name VARCHAR (200) NULL,
last_name VARCHAR (100) NOT NULL,
PRIMARY KEY (id)
);

Is displayed as

Table Peoples
=============
id, first_name, last_name
-------------
id               int(11) PK
first_name       varchar(200)
last_name        varchar(100)

In the Object Information tab. The object information tab does not specify that the first_name is NULL and the last name is NOT NULL.

like image 928
user784637 Avatar asked Oct 01 '11 00:10

user784637


2 Answers

It seems unfortunate that one would need to create an entire EER model just to see if a column is nullable.. another workaround i found is to right-click on the table and choose 'Alter Table' and the editor that comes up shows the NN column, checked or not (version 5.2.47).

like image 100
ilasno Avatar answered Sep 18 '22 15:09

ilasno


Under "Data Modelling" use "Create EER Model From Existing Database" or open up an existing model of the desired database if you have one. Then select the desired table and the bottom window will show the table's properties. The "Columns" tab will show what columns are NULL by default.

like image 34
R. Valbuena Avatar answered Sep 17 '22 15:09

R. Valbuena