create table Authors (
Au_Num INT (3) Primary Key,
Au_LName VARCHAR (10) NOT NULL,
Au_FName VARCHAR (10),
Book_Number Int (2),
Client_Name VARCHAR (20)
);
CodePudding user response:
Removing the parenthesized numbers from INT declarations works:
CREATE table Authors (
Au_Num INT Primary Key,
Au_LName VARCHAR(10) NOT NULL,
Au_FName VARCHAR(10),
Book_Number Int,
Client_Name VARCHAR(20)
);
If the primary key should be an autonumber:
CREATE table Authors (
Au_Num AUTOINCREMENT Primary Key,
Au_LName VARCHAR(10) NOT NULL,
Au_FName VARCHAR(10),
Book_Number Int,
Client_Name VARCHAR(20)
);
CodePudding user response:
Data types such as int, bigint, datetime, smallint, tinyint, bit, bool and date has predefined length, hence it is not required to specify the length explicitly.
Remove the length for int data types
create table Authors (
Au_Num INT Primary Key,
Au_LName VARCHAR (10) NOT NULL,
Au_FName VARCHAR (10),
Book_Number Int,
Client_Name VARCHAR (20)
);
