Skip to content
Advertisement

IDENTITY is red underlined while trying to create a table in SQL

I’m a Java student and I was trying to create a table for my database web app project.

So I used IDENTITY(1,1) to get the id start from 1 and auto increment by 1. But IDENTITY is underlined and I do not know why. Also when I try to run the code I get this Output :

Advertisement

Answer

You have multiple syntax errors. But the code you want is:

Notes:

  • The syntax in Oracle is different from SQL Server. There are no arguments to IDENTITY and you want GENERATED ALWAYS AS for the column.
  • Oracle prefers VARCHAR2() to VARCHAR().
  • You have missing and extra commas.
  • 45 characters seems too short for the columns, particularly the email.
  • I prefer table names in the plural because they contain multiple copies of an entity.
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement