0

I have created a test table with constraint Unique (column username), using mariaDB (10.3 v) which installed by default with Xammp. What i m doing wrong ? is this accept NULL ??

enter image description here Please help once Snapshot

select * from tbltest \G;
*************************** 1. row ***************************
       id: 1
full_name: user1
**user_name: NULL**
   status: 1
      age: 19
*************************** 2. row ***************************
       id: 2
full_name: user2
**user_name: NULL**
   status: 1
      age: 20
*************************** 3. row ***************************
       id: 3
full_name: user3
**user_name: NULL**
   status: 0
      age: 20
3 rows in set (0.001 sec)
Navneet
  • 347
  • 1
  • 10
  • Even at 500% magnification the image is unreadable can you add your table definition as text and expand on 'What i m doing wrong ? is this accept NULL ??' – P.Salmon Nov 28 '19 at 06:41
  • Does this answer your question? [Does MySQL ignore null values on unique constraints?](https://stackoverflow.com/questions/3712222/does-mysql-ignore-null-values-on-unique-constraints) – P.Salmon Nov 28 '19 at 06:55

1 Answers1

0

Line up the columns; it may be obvious what you did wrong:

INSERT ... ( full_name, status, age )
  VALUES   ( 'user2',   TRUE,   20  )
Rick James
  • 135,179
  • 13
  • 127
  • 222