0

The whole error code says:

Error 1064(42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT NULL'

It's telling me I don't have the right syntax but here is my code what am I missing:

 CREATE TABLE CONTACTAPPTABLE
(
MAId int unsigned NOT NULL AUTO_INCREMENT,
MAName varchar(50) DEFAULT NOT NULL,
MAEmail varchar(45) DEFAULT NOT NULL,
MASMS varchar(15) DEFAULT NOT NULL,
MAOpinion text DEFAULT NOT NULL,
MAOtherPaperCompanies varchar(20) DEFAULT NOT NULL,
MAStreetAddress varchar(20) DEFAULT NOT NULL,
MAColor varchar(20) DEFAULT NOT NULL,
MAZipCode varchar(20) DEFAULT NOT NULL,
MAMailingType varchar(20) DEFAULT NOT NULL,
MADT timestamp,
PRIMARY KEY(MAId)

)Engine=MyISAM AUTO_INCREMENT=1128 DEFAULT CHARSET=latin1;
Noelle Browne
  • 3
  • 1
  • 1
  • 3
  • which RDBMS are you using? i see three different in your tags – Hiten004 Nov 09 '16 at 21:01
  • If I'm reading the question right I think it's mysql. My teacher told us to use code similar to his and his was written the same way. – Noelle Browne Nov 09 '16 at 21:03
  • This [SQL Fiddle](http://sqlfiddle.com/#!9/6b859/1/0) compiles must set values for default values and can't set default on a text data type. – xQbert Nov 09 '16 at 21:08
  • 1
    Please do not link to screengrabs of error messages. The text of the error message should be included directly in the question. This is so that others who have this problem another time can benefit from the answers to this question. – Joe C Nov 09 '16 at 21:34

1 Answers1

1

You need to specify a default value:

NOT NULL DEFAULT "abc"

From the docs

column_definition:
    data_type [NOT NULL | NULL] [DEFAULT default_value]

edit in response to xQbert

According to MariaDB's docs,

MariaDB starting with 10.2.1
BLOB and TEXT columns can now have a DEFAULT value.

If you are running Maria < 10.2.1, you can not use DEFAULT on your TEXT data field.

Matt Clark
  • 27,671
  • 19
  • 68
  • 123