ERROR in SQL syntax near Integer data type while creating a table, don't know why it's failing

StackOverflow https://stackoverflow.com/questions/20210084

  •  05-08-2022
  •  | 
  •  

سؤال

CREATE TABLE ProfileMiningStats(server VARCHAR(20), DateStatsCollected DATE(), NoSubmittedCompanies INT, NoCompaniesFinishedSuccessfully INT, AvgTimeTakenByEachProfile TIME());

seeing the below ERROR Message:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(), NoSubmittedCompanies INT, NoCompaniesFinishedSuccessfully INT, AvgTimeTakenB' at line 1

Please correct the query if its wrong

هل كانت مفيدة؟

المحلول

Is this what you're after?

create table ProfileMiningStats(
  server VARCHAR(20), 
  DateStatsCollected DATE, 
  NoSubmittedCompanies INT, 
  NoCompaniesFinishedSuccessfully INT, 
  AvgTimeTakenByEachProfile TIME);

You had () after the DATE and the TIME datatypes.

نصائح أخرى

Please try this it will work. (You have used functions like Date(), Time() that is the problem)
create table ProfileMiningStats( server VARCHAR(20), DateStatsCollected DATE, NoSubmittedCompanies INT, NoCompaniesFinishedSuccessfully INT, AvgTimeTakenByEachProfile TIME );

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top