MySQLエラー:SQL構文にエラーがあります。使用する正しい構文については、MySQLサーバーのバージョンに対応するマニュアルを確認してください。

タヌジシャルマ

実際、Springブートを使用していますが、データベースにテーブルを作成する際にエラーが発生しました。データベースとしてMySQLを使用しています

エラーは

SpringBootでのエラー表示

java.sql.SQLSyntaxErrorException: 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 'like bigint not null, time_created time, primary key (blog_id)) engine=InnoDB' at line 1

テーブルを手動で作成しようとするとエラーが発生します

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 'like bigint not null, time_created time, primary key (blog_id)) engine=InnoDB' at line 1

私の命令

create table blogs (blog_id integer not null, date_created date, discription varchar(999), dislike bigint not null, like bigint not null, time_created time, primary key (blog_id)) engine=InnoDB;

そして私の実体

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int blogId;

@Column(length = 999)
private String discription;

@CreatedDate
private LocalDate dateCreated;

private LocalTime timeCreated;
private long like;
private long dislike;


public blogs(int blogId, String discription, LocalDate dateCreated, LocalTime timeCreated, long like,
        long dislike) {
    this.blogId = blogId;
    this.discription = discription;
    this.dateCreated = dateCreated;
    this.timeCreated = timeCreated;
    this.like = like;
    this.dislike = dislike;
}
レイキー

エラーはSQLステートメントにあります。LIKEキーワード/予約語であり、属性の名前として使用することはできません。

SQLステートメントを-から変更します。 create table blogs (blog_id integer not null, date_created date, discription varchar(999), dislike bigint not null, like bigint not null, time_created time, primary key (blog_id)) engine=InnoDB;

に-

CREATE TABLE blogs (blog_id integer not null, date_created date, discription varchar(999), dislike bigint not null, liked bigint not null, time_created time, primary key (blog_id)) engine=InnoDB;

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

TOP 一覧

  1. 1

    Oracle11gクライアントを使用したOracle19Cサーバーへの接続

  2. 2

    Ansibleで複数行のシェルスクリプトを実行する方法

  3. 3

    Reactでclsxを使用する方法

  4. 4

    Python / SciPyのピーク検出アルゴリズム

  5. 5

    小さいデータセットサイズと大きいデータセットサイズを使用するMPI_Gatherを使用したMPI_Barrier?

  6. 6

    フィルタスライダーで複数の範囲を選択します-Tableau

  7. 7

    MariaDBによるデータベースの破損:テーブルがエンジンに存在しません

  8. 8

    複数の条件でループを構築する

  9. 9

    Google Cloud Storage から単一ページの React アプリを提供する

  10. 10

    Hide textOutput() when un-click row of a DT::datatable in shiny app

  11. 11

    JavaのREST APIの認証、JWTとベストプラクティス

  12. 12

    Angular 9 TypeError:未定義のプロパティ「subscribe」を読み取れません

  13. 13

    JavaからのMATLAB関数によりランタイムエラーが発生する(EXCEPTION_ACCESS_VIOLATION)

  14. 14

    Eclipseに既存のJavaプロジェクトをインポートしますが、JFrameのデザインビューが存在しませんか?

  15. 15

    Openlayers 3 : Interaction DragBox が機能しない

  16. 16

    print( "\ 0007")がビープ音を鳴らさないのはなぜですか?

  17. 17

    なぜArrays.copyOfは2倍高速System.arraycopyのより小さなアレイ用のでしょうか?

  18. 18

    App Engineクイックスタートから「helloworld.go」をアンデプロイし、代わりにバケット内のhtmlをポイントするにはどうすればよいですか?

  19. 19

    LaravelはDB接続を自動的に閉じますか?

  20. 20

    グラフ(.PNG)ファイルをエクスポートするZabbix

  21. 21

    Eclipseエラー:ビルドパスが不完全であると表示されます

ホットタグ

アーカイブ